mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 07:00:09 +01:00
device: retry creation of default connection after link is initialized
When a new link is detected, NM tries to generate a default "Wired
connection" in nm_settings_device_added(), but if the link has not
been initialized by udev yet the function returns early because
priv->unmanaged_flags = UNMANAGED_PLATFORM_INIT.
To be sure that a default connection is created is such situation, we
need to call again nm_settings_device_added() after link
initialization.
https://bugzilla.redhat.com/show_bug.cgi?id=1254089
(cherry picked from commit b3b0b46250)
This commit is contained in:
parent
b46ed87919
commit
80d4fbf4ac
3 changed files with 26 additions and 0 deletions
|
|
@ -95,6 +95,7 @@ enum {
|
|||
REMOVED,
|
||||
RECHECK_AUTO_ACTIVATE,
|
||||
RECHECK_ASSUME,
|
||||
LINK_INITIALIZED,
|
||||
LAST_SIGNAL,
|
||||
};
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
|
@ -1505,6 +1506,8 @@ device_link_changed (NMDevice *self)
|
|||
NM_UNMANAGED_PLATFORM_INIT,
|
||||
FALSE,
|
||||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||
|
||||
g_signal_emit (self, signals[LINK_INITIALIZED], 0);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
|
|
@ -9837,6 +9840,13 @@ nm_device_class_init (NMDeviceClass *klass)
|
|||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
signals[LINK_INITIALIZED] =
|
||||
g_signal_new (NM_DEVICE_LINK_INITIALIZED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
&dbus_glib_nm_device_object_info);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
#define NM_DEVICE_REMOVED "removed"
|
||||
#define NM_DEVICE_RECHECK_AUTO_ACTIVATE "recheck-auto-activate"
|
||||
#define NM_DEVICE_RECHECK_ASSUME "recheck-assume"
|
||||
#define NM_DEVICE_LINK_INITIALIZED "link-initialized"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -852,6 +852,14 @@ device_removed_cb (NMDevice *device, gpointer user_data)
|
|||
remove_device (NM_MANAGER (user_data), device, FALSE, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
device_link_initialized_cb (NMDevice *device, gpointer user_data)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (user_data);
|
||||
|
||||
nm_settings_device_added (priv->settings, device);
|
||||
}
|
||||
|
||||
static void
|
||||
aipd_handle_event (DBusGProxy *proxy,
|
||||
const char *event,
|
||||
|
|
@ -1813,6 +1821,10 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume)
|
|||
G_CALLBACK (device_removed_cb),
|
||||
self);
|
||||
|
||||
g_signal_connect (device, NM_DEVICE_LINK_INITIALIZED,
|
||||
G_CALLBACK (device_link_initialized_cb),
|
||||
self);
|
||||
|
||||
g_signal_connect (device, "notify::" NM_DEVICE_IP_IFACE,
|
||||
G_CALLBACK (device_ip_iface_changed),
|
||||
self);
|
||||
|
|
@ -1871,6 +1883,9 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume)
|
|||
NM_DEVICE_STATE_REASON_NOW_MANAGED);
|
||||
}
|
||||
|
||||
/* Try to generate a default connection. If this fails because the link is
|
||||
* not initialized, we will retry again in device_link_initialized_cb().
|
||||
*/
|
||||
nm_settings_device_added (priv->settings, device);
|
||||
g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_DEVICES);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue