summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2015-04-07 14:24:12 +0200
committerLubomir Rintel <lkundrak@v3.sk>2015-05-28 11:40:27 +0200
commit1b95eab27c9ec973d8994caaaa694a4ec3557935 (patch)
treecc4f9d5ddbb62f42d66bdc325b062bac6cb9708a
parent70db36109cca5a5c72c4b5e6ecf6fa70f067e431 (diff)
downloadNetworkManager-1b95eab27c9ec973d8994caaaa694a4ec3557935.tar.gz
device: move the decision whether to wait for IFF_UP a virtual function
We'd like to override it for veths. (cherry picked from commit adb6e9afb196ffa9498e7c2708ba11fba9273377)
-rw-r--r--src/devices/nm-device.c14
-rw-r--r--src/devices/nm-device.h7
2 files changed, 15 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 35198fb0d6..e8f902dd40 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -1019,8 +1019,15 @@ nm_device_release_one_slave (NMDevice *self, NMDevice *slave, gboolean configure
return success;
}
+/**
+ * can_unmanaged_external_down:
+ * @self: the device
+ *
+ * Check whether the device should stay NM_UNMANAGED_EXTERNAL_DOWN unless
+ * IFF_UP-ed externally.
+ */
static gboolean
-is_software_external (NMDevice *self)
+can_unmanaged_external_down (NMDevice *self)
{
return nm_device_is_software (self)
&& !nm_device_get_is_nm_owned (self);
@@ -1041,7 +1048,7 @@ nm_device_finish_init (NMDevice *self)
g_assert (priv->initialized == FALSE);
/* Do not manage externally created software devices until they are IFF_UP */
- if ( is_software_external (self)
+ if ( NM_DEVICE_GET_CLASS (self)->can_unmanaged_external_down (self)
&& !nm_platform_link_is_up (priv->ifindex)
&& priv->ifindex > 0)
nm_device_set_initial_unmanaged_flag (self, NM_UNMANAGED_EXTERNAL_DOWN, TRUE);
@@ -1297,7 +1304,7 @@ device_link_changed (NMDevice *self, NMPlatformLink *info)
/* Manage externally-created software interfaces only when they are IFF_UP */
g_assert (priv->ifindex > 0);
- if (is_software_external (self)) {
+ if (NM_DEVICE_GET_CLASS (self)->can_unmanaged_external_down (self)) {
gboolean external_down = nm_device_get_unmanaged_flag (self, NM_UNMANAGED_EXTERNAL_DOWN);
if (external_down && info->up) {
@@ -8757,6 +8764,7 @@ nm_device_class_init (NMDeviceClass *klass)
klass->can_auto_connect = can_auto_connect;
klass->check_connection_compatible = check_connection_compatible;
klass->check_connection_available = check_connection_available;
+ klass->can_unmanaged_external_down = can_unmanaged_external_down;
klass->is_up = is_up;
klass->bring_up = bring_up;
klass->take_down = take_down;
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index 46de099804..84b3437425 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -130,9 +130,10 @@ typedef struct {
void (* link_changed) (NMDevice *self, NMPlatformLink *info);
/* Hardware state (IFF_UP) */
- gboolean (*is_up) (NMDevice *self);
- gboolean (*bring_up) (NMDevice *self, gboolean *no_firmware);
- gboolean (*take_down) (NMDevice *self);
+ gboolean (*can_unmanaged_external_down) (NMDevice *self);
+ gboolean (*is_up) (NMDevice *self);
+ gboolean (*bring_up) (NMDevice *self, gboolean *no_firmware);
+ gboolean (*take_down) (NMDevice *self);
/* Carrier state (IFF_LOWER_UP) */
void (*carrier_changed) (NMDevice *, gboolean carrier);