Skip to content

Commit

Permalink
network: support NET_MANAGED_BY udev property
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwata committed Oct 31, 2023
1 parent 78101ca commit d3448d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/network/networkd-link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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, "NET_MANAGED_BY", &s);
if (r < 0 && r != -ENOENT)
log_device_debug_errno(device, r, "Failed to get 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', unmanaging the interface.", s);
link_set_state(link, LINK_STATE_UNMANAGED);
return 0;
}

r = link_initialized(link, device);
if (r < 0)
link_enter_failed(link);
Expand Down

0 comments on commit d3448d2

Please sign in to comment.