diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2015-04-07 14:24:12 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2015-04-13 13:51:27 +0200 |
commit | adb6e9afb196ffa9498e7c2708ba11fba9273377 (patch) | |
tree | 9702c51e34698c305e496d8702c221ab84be2f7d /src/devices | |
parent | 62f40bade074ac8e555730957149d0888a2b7715 (diff) | |
download | NetworkManager-adb6e9afb196ffa9498e7c2708ba11fba9273377.tar.gz |
device: move the decision whether to wait for IFF_UP a virtual function
We'd like to override it for veths.
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/nm-device.c | 14 | ||||
-rw-r--r-- | src/devices/nm-device.h | 7 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index c6f590c0e9..4735753366 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); @@ -1304,7 +1311,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) { @@ -8903,6 +8910,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 a204bc134f..6de11ba9d7 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); |