mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
meson: make net.naming-scheme= default configurable
This is useful for distributions, where the stability of interface names should be preseved after an upgrade of systemd. So when some specific release of the distro is made available, systemd defaults to the latest & greatest naming scheme, and subsequent updates set the same default. This default may still be overriden through the kernel and env var options. A special value "latest" is also allowed. Without a specific name, it is harder to verride from meson. In case of 'combo' options, meson reads the default during the initial configuration, and "remembers" this choice. When systemd is updated, old build/ directories could keep the old default, which would be annoying. Hence, "latest" is introduced to make it explicit, yet follow the upstream. This is actually useful for the user too, because it may be used as an override, without having to actually specify a version.
This commit is contained in:
parent
f7e81fd96f
commit
06da5c63dd
|
@ -92,13 +92,14 @@ systemd-logind:
|
||||||
for it.
|
for it.
|
||||||
|
|
||||||
* `$NET_NAMING_SCHEME=` – if set, takes a network naming scheme (i.e. one of
|
* `$NET_NAMING_SCHEME=` – if set, takes a network naming scheme (i.e. one of
|
||||||
v238, v239, v240 …) as parameter. If specified udev's net_id builtin will
|
"v238", "v239", "v240"…, or the special value "latest") as parameter. If
|
||||||
follow the specified naming scheme when determining stable network interface
|
specified udev's net_id builtin will follow the specified naming scheme when
|
||||||
names. This may be used to revert to naming schemes of older udev versions,
|
determining stable network interface names. This may be used to revert to
|
||||||
in order to provide more stable naming across updates. This environment
|
naming schemes of older udev versions, in order to provide more stable naming
|
||||||
variable takes precedence over the kernel command line option
|
across updates. This environment variable takes precedence over the kernel
|
||||||
`net.naming-scheme=`, except if the value is prefixed with `:` in which case
|
command line option `net.naming-scheme=`, except if the value is prefixed
|
||||||
the kernel command line option takes precedence, if it is specified as well.
|
with `:` in which case the kernel command line option takes precedence, if it
|
||||||
|
is specified as well.
|
||||||
|
|
||||||
installed systemd tests:
|
installed systemd tests:
|
||||||
|
|
||||||
|
|
|
@ -174,16 +174,20 @@
|
||||||
<term><varname>net.naming-scheme=</varname></term>
|
<term><varname>net.naming-scheme=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Network interfaces are renamed to give them predictable names when possible (unless
|
<para>Network interfaces are renamed to give them predictable names when possible (unless
|
||||||
<varname>net.ifnames=0</varname> is specified, see above). The names are derived from various device metadata
|
<varname>net.ifnames=0</varname> is specified, see above). The names are derived from various
|
||||||
fields. Newer versions of <filename>systemd-udevd.service</filename> take more of these fields into account,
|
device metadata fields. Newer versions of <filename>systemd-udevd.service</filename> take more of
|
||||||
improving (and thus possibly changing) the names used for the same devices. With this kernel command line
|
these fields into account, improving (and thus possibly changing) the names used for the same
|
||||||
option it is possible to pick a specific version of this algorithm. It expects a naming scheme identifier as
|
devices. With this kernel command line option it is possible to pick a specific version of this
|
||||||
argument. Currently the following identifiers are known: <literal>v238</literal>, <literal>v239</literal>,
|
algorithm. It expects a naming scheme identifier as argument. Currently the following identifiers
|
||||||
<literal>v240</literal> which each implement the naming scheme that was the default in the indicated systemd
|
are known: <literal>v238</literal>, <literal>v239</literal>, <literal>v240</literal> which each
|
||||||
version. Note that selecting a specific scheme is not sufficient to fully stabilize interface naming: the
|
implement the naming scheme that was the default in the indicated systemd version. In addition,
|
||||||
naming is generally derived from driver attributes exposed by the kernel. As the kernel is updated,
|
<literal>latest</literal> may be used to designate the latest scheme known (to this particular
|
||||||
previously missing attributes <filename>systemd-udevd.service</filename> is checking might appear, which
|
version of <filename>systemd-udevd.service</filename>).</para>
|
||||||
affects older name derivation algorithms, too.</para>
|
|
||||||
|
<para>Note that selecting a specific scheme is not sufficient to fully stabilize interface naming:
|
||||||
|
the naming is generally derived from driver attributes exposed by the kernel. As the kernel is
|
||||||
|
updated, previously missing attributes <filename>systemd-udevd.service</filename> is checking might
|
||||||
|
appear, which affects older name derivation algorithms, too.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
|
@ -694,6 +694,9 @@ else
|
||||||
conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
|
conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
default_net_naming_scheme = get_option('default-net-naming-scheme')
|
||||||
|
conf.set_quoted('DEFAULT_NET_NAMING_SCHEME', default_net_naming_scheme)
|
||||||
|
|
||||||
time_epoch = get_option('time-epoch')
|
time_epoch = get_option('time-epoch')
|
||||||
if time_epoch == -1
|
if time_epoch == -1
|
||||||
NEWS = files('NEWS')
|
NEWS = files('NEWS')
|
||||||
|
@ -3093,6 +3096,7 @@ status = [
|
||||||
'default DNSSEC mode: @0@'.format(default_dnssec),
|
'default DNSSEC mode: @0@'.format(default_dnssec),
|
||||||
'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
|
'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls),
|
||||||
'default cgroup hierarchy: @0@'.format(default_hierarchy),
|
'default cgroup hierarchy: @0@'.format(default_hierarchy),
|
||||||
|
'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
|
||||||
'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
|
'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
|
||||||
|
|
||||||
alt_dns_servers = '\n '.join(dns_servers.split(' '))
|
alt_dns_servers = '\n '.join(dns_servers.split(' '))
|
||||||
|
|
|
@ -156,6 +156,9 @@ option('compat-gateway-hostname', type : 'boolean', value : 'false',
|
||||||
option('default-hierarchy', type : 'combo',
|
option('default-hierarchy', type : 'combo',
|
||||||
choices : ['legacy', 'hybrid', 'unified'], value : 'hybrid',
|
choices : ['legacy', 'hybrid', 'unified'], value : 'hybrid',
|
||||||
description : 'default cgroup hierarchy')
|
description : 'default cgroup hierarchy')
|
||||||
|
option('default-net-naming-scheme', type : 'combo',
|
||||||
|
choices : ['latest', 'v238', 'v239', 'v240'],
|
||||||
|
description : 'default net.naming-scheme= value')
|
||||||
option('time-epoch', type : 'integer', value : '-1',
|
option('time-epoch', type : 'integer', value : '-1',
|
||||||
description : 'time epoch for time clients')
|
description : 'time epoch for time clients')
|
||||||
option('system-uid-max', type : 'integer', value : '-1',
|
option('system-uid-max', type : 'integer', value : '-1',
|
||||||
|
|
|
@ -193,6 +193,19 @@ struct virtfn_info {
|
||||||
char suffix[IFNAMSIZ];
|
char suffix[IFNAMSIZ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const NamingScheme* naming_scheme_from_name(const char *name) {
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (streq(name, "latest"))
|
||||||
|
return naming_schemes + ELEMENTSOF(naming_schemes) - 1;
|
||||||
|
|
||||||
|
for (i = 0; i < ELEMENTSOF(naming_schemes); i++)
|
||||||
|
if (streq(naming_schemes[i].name, name))
|
||||||
|
return naming_schemes + i;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static const NamingScheme* naming_scheme(void) {
|
static const NamingScheme* naming_scheme(void) {
|
||||||
static const NamingScheme *cache = NULL;
|
static const NamingScheme *cache = NULL;
|
||||||
_cleanup_free_ char *buffer = NULL;
|
_cleanup_free_ char *buffer = NULL;
|
||||||
|
@ -216,24 +229,18 @@ static const NamingScheme* naming_scheme(void) {
|
||||||
k = buffer;
|
k = buffer;
|
||||||
|
|
||||||
if (k) {
|
if (k) {
|
||||||
size_t i;
|
cache = naming_scheme_from_name(k);
|
||||||
|
if (cache) {
|
||||||
|
log_info("Using interface naming scheme '%s'.", cache->name);
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(naming_schemes); i++)
|
log_warning("Unknown interface naming scheme '%s' requested, ignoring.", k);
|
||||||
if (streq(naming_schemes[i].name, k)) {
|
|
||||||
cache = naming_schemes + i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cache)
|
|
||||||
log_warning("Unknown interface naming scheme '%s' requested, ignoring.", k);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache)
|
cache = naming_scheme_from_name(DEFAULT_NET_NAMING_SCHEME);
|
||||||
log_info("Using interface naming scheme '%s'.", cache->name);
|
assert(cache);
|
||||||
else {
|
log_info("Using default interface naming scheme '%s'.", cache->name);
|
||||||
cache = naming_schemes + ELEMENTSOF(naming_schemes) - 1;
|
|
||||||
log_info("Using default interface naming scheme '%s'.", cache->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue