mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 06:00:12 +01:00
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.
This commit is contained in:
parent
d29ab97c39
commit
b5817dffa0
1 changed files with 28 additions and 0 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue