diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 9e3a10bf0..dec33d408 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1109,7 +1109,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 { diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 64f33af5d..e55670c61 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -4774,6 +4774,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); @@ -4838,16 +4840,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"); @@ -4861,6 +4853,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 @@ -4898,8 +4892,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; diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 13d2d6f11..e521fb155 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -405,10 +405,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); } /** diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 08d032a6c..f34ae811b 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -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);