diff options
author | Dan Williams <dcbw@redhat.com> | 2014-06-12 13:27:14 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-07-23 14:26:39 -0500 |
commit | b5817dffa096f261bfb01312d8503276d6464191 (patch) | |
tree | 3dd592b40d48390a7a9a87ac56eedefea9e4a2c1 | |
parent | d29ab97c39a627b52a13f458416b1dd515ffde9e (diff) | |
download | NetworkManager-b5817dffa096f261bfb01312d8503276d6464191.tar.gz |
core: remove child devices when a parent's ip_iface becomes known
Child devices shouldn't be exposed as real NMDevices (yet) since the
configuration and life cycle is controlled by the parent. We already
do this if the ip_iface is known when the child device is added, but
PPP and other transient interfaces often show up just before we know
the parent's ip_iface.
-rw-r--r-- | src/nm-manager.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 68b1846dc2..e0bb4dc9fb 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1719,6 +1719,30 @@ recheck_assume_connection (NMDevice *device, gpointer user_data) } } +static void +device_ip_iface_changed (NMDevice *device, + GParamSpec *pspec, + NMManager *self) +{ + const char *ip_iface = nm_device_get_ip_iface (device); + GSList *iter; + + /* Remove NMDevice objects that are actually child devices of others, + * when the other device finally knows its IP interface name. For example, + * remove the PPP interface that's a child of a WWAN device, since it's + * not really a standalone NMDevice. + */ + for (iter = NM_MANAGER_GET_PRIVATE (self)->devices; iter; iter = iter->next) { + NMDevice *candidate = NM_DEVICE (iter->data); + + if ( candidate != device + && g_strcmp0 (nm_device_get_iface (candidate), ip_iface) == 0) { + remove_device (self, candidate, FALSE); + break; + } + } +} + /** * add_device: * @self: the #NMManager @@ -1774,6 +1798,10 @@ add_device (NMManager *self, NMDevice *device, gboolean generate_con) G_CALLBACK (device_removed_cb), self); + g_signal_connect (device, "notify::" NM_DEVICE_IP_IFACE, + G_CALLBACK (device_ip_iface_changed), + self); + if (priv->startup) { g_signal_connect (device, "notify::" NM_DEVICE_HAS_PENDING_ACTION, G_CALLBACK (device_has_pending_action_changed), |