mirror of
https://github.com/systemd/systemd.git
synced 2025-03-09 12:58:26 +03:00
network: support ID_NET_MANAGED_BY udev property
If the property is set, networkd manages the interface only when its value is "io.systemd.Network". Closes #29768.
This commit is contained in:
parent
da79ae6fc5
commit
ba87a61d05
@ -77,6 +77,14 @@
|
||||
configured. The first (in alphanumeric order) of the network files that matches a given interface
|
||||
is applied, all later files are ignored, even if they match as well.</para>
|
||||
|
||||
<para>Note that any network interfaces that have the <varname>ID_NET_MANAGED_BY=</varname> udev property
|
||||
set will never be matched by any .network files – unless the property's value is the string
|
||||
<literal>io.systemd.Network</literal> – even if the [Match] section would otherwise match. This may be
|
||||
used to exclude specific network interfaces from <command>systemd-networkd</command>'s management, while
|
||||
keeping the [Match] section generic. The <varname>ID_NET_MANAGED_BY=</varname> poperty thus declares
|
||||
intended <emphasis>ownership</emphasis> of the device, and permits ensuring that concurrent network
|
||||
management implementations do not compete for management of specific devices.</para>
|
||||
|
||||
<para>A network file is said to match a network interface if all matches specified by the [Match]
|
||||
section are satisfied. When a network file does not contain valid settings in [Match] section, then
|
||||
the file will match all interfaces and <command>systemd-networkd</command> warns about that. Hint:
|
||||
|
@ -1465,6 +1465,7 @@ static int link_check_initialized(Link *link) {
|
||||
|
||||
int manager_udev_process_link(Manager *m, sd_device *device, sd_device_action_t action) {
|
||||
int r, ifindex;
|
||||
const char *s;
|
||||
Link *link;
|
||||
|
||||
assert(m);
|
||||
@ -1499,6 +1500,15 @@ int manager_udev_process_link(Manager *m, sd_device *device, sd_device_action_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = sd_device_get_property_value(device, "ID_NET_MANAGED_BY", &s);
|
||||
if (r < 0 && r != -ENOENT)
|
||||
log_device_debug_errno(device, r, "Failed to get ID_NET_MANAGED_BY udev property, ignoring: %m");
|
||||
if (r >= 0 && !streq(s, "io.systemd.Network")) {
|
||||
log_device_debug(device, "Interface is requested to be managed by '%s', not managing the interface.", s);
|
||||
link_set_state(link, LINK_STATE_UNMANAGED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = link_initialized(link, device);
|
||||
if (r < 0)
|
||||
link_enter_failed(link);
|
||||
|
Loading…
x
Reference in New Issue
Block a user