summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-09-10 10:31:10 +0200
committerThomas Haller <thaller@redhat.com>2018-09-10 11:11:40 +0200
commit3635f462b07cb82b07272deb24aaf9b7c64fd80c (patch)
tree73558b5a582008b49d6575d6f33a5895f9d91388
parentbaa0008313e9bdfd469274e91ccf5b13d991884a (diff)
downloadNetworkManager-3635f462b07cb82b07272deb24aaf9b7c64fd80c.tar.gz
device: detect loopback device explicitly
Don't use NM_UNMANAGED_LOOPBACK for that.
-rw-r--r--src/devices/nm-device.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 4160b8af2f..fd50a149ed 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -80,6 +80,8 @@
#include "nm-audit-manager.h"
#include "nm-connectivity.h"
#include "nm-dbus-interface.h"
+
+#include "nm-device-generic.h"
#include "nm-device-vlan.h"
#include "nm-device-logging.h"
@@ -823,6 +825,13 @@ _ethtool_state_set (NMDevice *self)
/*****************************************************************************/
+static gboolean
+is_loopback (NMDevice *self)
+{
+ return NM_IS_DEVICE_GENERIC (self)
+ && NM_DEVICE_GET_PRIVATE (self)->ifindex == 1;
+}
+
NMSettings *
nm_device_get_settings (NMDevice *self)
{
@@ -2460,7 +2469,7 @@ concheck_is_possible (NMDevice *self)
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if ( !nm_device_is_real (self)
- || NM_FLAGS_HAS (priv->unmanaged_flags, NM_UNMANAGED_LOOPBACK))
+ || is_loopback (self))
return FALSE;
/* we enable periodic checks for every device state (except UNKNOWN). Especially with
@@ -4292,7 +4301,7 @@ realize_start_setup (NMDevice *self,
/* Unmanaged the loopback device with an explicit NM_UNMANAGED_LOOPBACK flag.
* Later we might want to manage 'lo' too. Currently that doesn't work because
* NetworkManager might down the interface or remove the 127.0.0.1 address. */
- nm_device_set_unmanaged_flags (self, NM_UNMANAGED_LOOPBACK, priv->ifindex == 1);
+ nm_device_set_unmanaged_flags (self, NM_UNMANAGED_LOOPBACK, is_loopback (self));
nm_device_set_unmanaged_by_user_udev (self);
nm_device_set_unmanaged_by_user_conf (self);