mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
Merge pull request #17680 from yuwata/udev-link-mac-address
udev: to make MACAddress= take effect, MACAddressPolicy= must be "none"
This commit is contained in:
commit
567fe1d570
@ -273,18 +273,21 @@
|
||||
<varlistentry>
|
||||
<term><option>none</option></term>
|
||||
<listitem>
|
||||
<para>Keeps the MAC address assigned by the kernel.</para>
|
||||
<para>Keeps the MAC address assigned by the kernel. Or use the MAC address specified in
|
||||
<varname>MACAddress=</varname>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>An empty string assignment is equivalent to setting <literal>none</literal>.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>MACAddress=</varname></term>
|
||||
<listitem>
|
||||
<para>The MAC address to use, if no
|
||||
<varname>MACAddressPolicy=</varname>
|
||||
is specified.</para>
|
||||
<para>The interface MAC address to use. For this setting to take effect,
|
||||
<varname>MACAddressPolicy=</varname> must either be unset, empty, or <literal>none</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
|
@ -181,6 +181,13 @@ int link_load_one(link_config_ctx *ctx, const char *filename) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IN_SET(link->mac_address_policy, MAC_ADDRESS_POLICY_PERSISTENT, MAC_ADDRESS_POLICY_RANDOM) && link->mac) {
|
||||
log_warning("%s: MACAddress= in [Link] section will be ignored when MACAddressPolicy= "
|
||||
"is set to \"persistent\" or \"random\".",
|
||||
filename);
|
||||
link->mac = mfree(link->mac);
|
||||
}
|
||||
|
||||
log_debug("Parsed configuration file %s", filename);
|
||||
|
||||
LIST_PREPEND(links, ctx->links, TAKE_PTR(link));
|
||||
@ -668,8 +675,12 @@ static const char* const mac_address_policy_table[_MAC_ADDRESS_POLICY_MAX] = {
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(mac_address_policy, MACAddressPolicy);
|
||||
DEFINE_CONFIG_PARSE_ENUM(config_parse_mac_address_policy, mac_address_policy, MACAddressPolicy,
|
||||
"Failed to parse MAC address policy");
|
||||
DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(
|
||||
config_parse_mac_address_policy,
|
||||
mac_address_policy,
|
||||
MACAddressPolicy,
|
||||
MAC_ADDRESS_POLICY_NONE,
|
||||
"Failed to parse MAC address policy");
|
||||
|
||||
static const char* const name_policy_table[_NAMEPOLICY_MAX] = {
|
||||
[NAMEPOLICY_KERNEL] = "kernel",
|
||||
|
Loading…
x
Reference in New Issue
Block a user