diff options
author | Thomas Haller <thaller@redhat.com> | 2016-03-24 14:15:49 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-03-31 10:38:39 +0200 |
commit | 3c8ffa766c1b794914424ac0f1eebcce1660dde6 (patch) | |
tree | f410a02faa7c48850261e28e44801329fab1bfa1 | |
parent | f7523ae6e25f19fe57129149ece2be9aa86b05ad (diff) | |
download | NetworkManager-3c8ffa766c1b794914424ac0f1eebcce1660dde6.tar.gz |
device: refactor by adding set_unmanaged_external_down() function
No functional change.
-rw-r--r-- | src/devices/nm-device.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 980b6e733a..e808bf07af 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -1217,6 +1217,28 @@ is_unmanaged_external_down (NMDevice *self, gboolean consider_can) } static void +set_unmanaged_external_down (NMDevice *self) +{ + NMUnmanFlagOp ext_flags; + + if (!nm_device_get_unmanaged_mask (self, NM_UNMANAGED_EXTERNAL_DOWN)) + return; + + ext_flags = is_unmanaged_external_down (self, FALSE); + if (ext_flags != NM_UNMAN_FLAG_OP_SET_UNMANAGED) { + /* Ensure the assume check is queued before any queued state changes + * from the transition to UNAVAILABLE. + */ + nm_device_queue_recheck_assume (self); + } + + nm_device_set_unmanaged_by_flags (self, + NM_UNMANAGED_EXTERNAL_DOWN, + ext_flags, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); +} + +static void update_dynamic_ip_setup (NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); @@ -1536,22 +1558,7 @@ device_link_changed (NMDevice *self) nm_device_set_unmanaged_by_flags (self, NM_UNMANAGED_PLATFORM_INIT, FALSE, reason); } - if (nm_device_get_unmanaged_mask (self, NM_UNMANAGED_EXTERNAL_DOWN)) { - NMUnmanFlagOp ext_flags; - - ext_flags = is_unmanaged_external_down (self, FALSE); - if (ext_flags != NM_UNMAN_FLAG_OP_SET_UNMANAGED) { - /* Ensure the assume check is queued before any queued state changes - * from the transition to UNAVAILABLE. - */ - nm_device_queue_recheck_assume (self); - } - - nm_device_set_unmanaged_by_flags (self, - NM_UNMANAGED_EXTERNAL_DOWN, - ext_flags, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); - } + set_unmanaged_external_down (self); device_recheck_slave_status (self, &info); return G_SOURCE_REMOVE; |