Commit df537d2e authored by Beniamino Galvani's avatar Beniamino Galvani

manager: set interface as removed when the link disappears

Set the device state as removed when the link disappears, so that in
the call to unrealize() when the device is unmanaged we also perform a
cleanup of it and especially, we terminate any DHCP client instances
running on the device.

If we keep DHCP clients running, we can hit assertions later when we
start another instance on the same interface, because we kill the old
dhclient from the pidfile, and the g_child_watch_add() done by the
first client instance is not able to waitpid() it, complaining with:

  GChildWatchSource: Exit status of a child process was requested but
  ECHILD was received by waitpid(). Most likely the process is
  ignoring SIGCHLD, or some other thread is invoking waitpid() with a
  nonpositive first argument; either behavior can break applications
  that use g_child_watch_add()/g_spawn_sync() either directly or
  indirectly.

https://bugzilla.redhat.com/show_bug.cgi?id=1436602
parent afca8a4c
...@@ -2355,6 +2355,7 @@ _platform_link_cb_idle (PlatformLinkCbData *data) ...@@ -2355,6 +2355,7 @@ _platform_link_cb_idle (PlatformLinkCbData *data)
device = nm_manager_get_device_by_ifindex (self, data->ifindex); device = nm_manager_get_device_by_ifindex (self, data->ifindex);
if (device) { if (device) {
if (nm_device_is_software (device)) { if (nm_device_is_software (device)) {
nm_device_sys_iface_state_set (device, NM_DEVICE_SYS_IFACE_STATE_REMOVED);
/* Our software devices stick around until their connection is removed */ /* Our software devices stick around until their connection is removed */
if (!nm_device_unrealize (device, FALSE, &error)) { if (!nm_device_unrealize (device, FALSE, &error)) {
_LOGW (LOGD_DEVICE, "(%s): failed to unrealize: %s", _LOGW (LOGD_DEVICE, "(%s): failed to unrealize: %s",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment