summaryrefslogtreecommitdiff
path: root/src/nm-policy.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-07 10:48:55 +0100
committerThomas Haller <thaller@redhat.com>2017-11-08 11:45:34 +0100
commit5279ab5be6326b911682e53d8c29d20a501d61b8 (patch)
treefcbfe1de7031b63beeba236bdf6ea2cc770ef92b /src/nm-policy.c
parent6fff832fe3b1086c226c8e26a6c3b4d413dde086 (diff)
downloadNetworkManager-5279ab5be6326b911682e53d8c29d20a501d61b8.tar.gz
device: refactor autoconnect blocking by introducing NMDeviceAutoconnectBlockedFlags enum
The flags allow for more then two reasons. Currently the only reasons for allowing or disallowing autoconnect are "user" and "intern". It's a bit odd, that NMDeviceAutoconnectBlockedFlags has a negative meaning. So nm_device_set_autoconnect_intern (device, FALSE); gets replaced by nm_device_set_autoconnect_blocked_set (device, NM_DEVICE_AUTOCONNECT_BLOCKED_INTERN); and so on. However, it's chosen this way, because autoconnect shall be allowed, unless any blocked-reason is set. That is, to check whether autoconnect is allowed, we do if (!nm_device_get_autoconnect_blocked (device, NM_DEVICE_AUTOCONNECT_BLOCKED_ALL)) The alternative check would be if (nm_device_get_autoconnect_allowed (device, NM_DEVICE_AUTOCONNECT_ALLOWED_ALL) == NM_DEVICE_AUTOCONNECT_ALLOWED_ALL) which seems odd too. So, add the inverse flags to block autoconnect. Beside refactoring and inverting the meaning of the autoconnect settings, there is no change in behavior.
Diffstat (limited to 'src/nm-policy.c')
-rw-r--r--src/nm-policy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 0eb5db9993..488d7deac3 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1844,7 +1844,7 @@ device_state_changed (NMDevice *device,
break;
case NM_DEVICE_STATE_DEACTIVATING:
if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) {
- if (!nm_device_get_autoconnect (device)) {
+ if (nm_device_autoconnect_blocked_get (device, NM_DEVICE_AUTOCONNECT_BLOCKED_ALL)) {
/* The device was disconnected; block all connections on it */
block_autoconnect_for_device (self, device);
} else {