mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 10:30:22 +01:00
platform: merge setup_devices() function into constructed()
We already populate the netlink cache in constructed(). No need
to wait with udev devices until nm_platform_query_devices(). Just
do it right away.
Add a hack to keep 'lo' default-unmanaged. Now that we load
udev devices earlier, we end up clearing the default-unmanged
flag on 'lo', which has bad consequences.
(cherry picked from commit d6ce01f115)
This commit is contained in:
parent
cf0a0ed576
commit
acb39d4b31
4 changed files with 12 additions and 19 deletions
|
|
@ -1096,7 +1096,14 @@ nm_device_finish_init (NMDevice *self)
|
|||
nm_device_enslave_slave (priv->master, self, NULL);
|
||||
|
||||
if (priv->ifindex > 0) {
|
||||
if (priv->platform_link_initialized || (priv->is_nm_owned && nm_device_is_software (self))) {
|
||||
if (priv->ifindex == 1) {
|
||||
/* keep 'lo' as default-unmanaged. */
|
||||
|
||||
/* FIXME: either find a better way to unmange 'lo' that cannot be changed
|
||||
* by user configuration (NM_UNMANGED_LOOPBACK?) or fix managing 'lo'.
|
||||
* Currently it can happen that NM deletes 127.0.0.1 address. */
|
||||
nm_device_set_initial_unmanaged_flag (self, NM_UNMANAGED_DEFAULT, TRUE);
|
||||
} else if (priv->platform_link_initialized || (priv->is_nm_owned && nm_device_is_software (self))) {
|
||||
nm_platform_link_get_unmanaged (NM_PLATFORM_GET, priv->ifindex, &platform_unmanaged);
|
||||
nm_device_set_initial_unmanaged_flag (self, NM_UNMANAGED_DEFAULT, platform_unmanaged);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4775,6 +4775,8 @@ constructed (GObject *_object)
|
|||
int channel_flags;
|
||||
gboolean status;
|
||||
int nle;
|
||||
GUdevEnumerator *enumerator;
|
||||
GList *devices, *iter;
|
||||
|
||||
/* Initialize netlink socket for requests */
|
||||
priv->nlh = setup_socket (FALSE, platform);
|
||||
|
|
@ -4839,16 +4841,6 @@ constructed (GObject *_object)
|
|||
|
||||
priv->wifi_data = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) wifi_utils_deinit);
|
||||
|
||||
G_OBJECT_CLASS (nm_linux_platform_parent_class)->constructed (_object);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_devices (NMPlatform *platform)
|
||||
{
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform);
|
||||
GUdevEnumerator *enumerator;
|
||||
GList *devices, *iter;
|
||||
|
||||
/* And read initial device list */
|
||||
enumerator = g_udev_enumerator_new (priv->udev_client);
|
||||
g_udev_enumerator_add_match_subsystem (enumerator, "net");
|
||||
|
|
@ -4862,6 +4854,8 @@ setup_devices (NMPlatform *platform)
|
|||
}
|
||||
g_list_free (devices);
|
||||
g_object_unref (enumerator);
|
||||
|
||||
G_OBJECT_CLASS (nm_linux_platform_parent_class)->constructed (_object);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -4899,8 +4893,6 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
|
|||
object_class->constructed = constructed;
|
||||
object_class->finalize = nm_linux_platform_finalize;
|
||||
|
||||
platform_class->setup_devices = setup_devices;
|
||||
|
||||
platform_class->sysctl_set = sysctl_set;
|
||||
platform_class->sysctl_get = sysctl_get;
|
||||
|
||||
|
|
|
|||
|
|
@ -407,10 +407,6 @@ nm_platform_query_devices (NMPlatform *self)
|
|||
NM_PLATFORM_REASON_INTERNAL);
|
||||
}
|
||||
g_array_unref (links_array);
|
||||
|
||||
/* Platform specific device setup. */
|
||||
if (klass->setup_devices)
|
||||
klass->setup_devices (self);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -368,8 +368,6 @@ struct _NMPlatform {
|
|||
typedef struct {
|
||||
GObjectClass parent;
|
||||
|
||||
void (*setup_devices) (NMPlatform *);
|
||||
|
||||
gboolean (*sysctl_set) (NMPlatform *, const char *path, const char *value);
|
||||
char * (*sysctl_get) (NMPlatform *, const char *path);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue