diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-11-09 16:16:53 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-11-09 17:01:40 +0100 |
commit | a6efddc6d91aad510eade789af82a84e48c3d528 (patch) | |
tree | 5bb553dd36824b1c7f462d5a29d3a219959cb136 | |
parent | 3a47108224f3fcbfd4e97b7df32bc8a9d5183ba6 (diff) | |
download | NetworkManager-bg/rh1437598.tar.gz |
core: allow slaves to autoactivate when master is availablebg/rh1437598
When a master connection is deactivated by user, we set the
autoconnect-blocked reason 'user-request' for the connection and we
propagate the same reason to slaves. Doing so prevents the
autoactivation of slaves when the master is manually activated again,
because the only way to override the 'user-request' reason is through
manual activation of slaves.
Instead what should happen is that the manual deactivation of a master
marks slaves as blocked for failed dependencies. When the master
becomes available again, slaves can autoactivate if the profile allows
it.
https://bugzilla.redhat.com/show_bug.cgi?id=1437598
-rw-r--r-- | src/devices/nm-device.c | 1 | ||||
-rw-r--r-- | src/nm-policy.c | 20 |
2 files changed, 14 insertions, 7 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 1948c6d114..4f4269b478 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -4080,6 +4080,7 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) break; case NM_DEVICE_STATE_REASON_USER_REQUESTED: new_state = NM_DEVICE_STATE_DEACTIVATING; + reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; master_status = "deactivated by user request"; break; default: diff --git a/src/nm-policy.c b/src/nm-policy.c index 87e6f9e49c..4085d42aba 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1697,9 +1697,7 @@ device_state_changed (NMDevice *device, NMPolicyPrivate *priv = user_data; NMPolicy *self = _PRIV_TO_SELF (priv); NMActiveConnection *ac; - NMSettingsConnection *connection = nm_device_get_settings_connection (device); - const char *ip_iface = nm_device_get_ip_iface (device); NMIP4Config *ip4_config; NMIP6Config *ip6_config; @@ -1801,13 +1799,21 @@ device_state_changed (NMDevice *device, update_routing_and_dns (self, FALSE); break; case NM_DEVICE_STATE_DEACTIVATING: - if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) { + if (NM_IN_SET (nm_device_state_reason_check (reason), + NM_DEVICE_STATE_REASON_USER_REQUESTED, + NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED)) { if (connection) { + NMSettingsAutoconnectBlockedReason blocked_reason; + /* The connection was deactivated, so block just this connection */ - _LOGD (LOGD_DEVICE, "blocking autoconnect of connection '%s' by user request", - nm_settings_connection_get_id (connection)); - nm_settings_connection_autoconnect_blocked_reason_set (connection, - NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST); + _LOGD (LOGD_DEVICE, "blocking autoconnect of connection '%s': %s", + nm_settings_connection_get_id (connection), + nm_device_state_reason_to_str (nm_device_state_reason_check (reason))); + if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) + blocked_reason = NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST; + else + blocked_reason = NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED; + nm_settings_connection_autoconnect_blocked_reason_set (connection, blocked_reason); } } ip6_remove_device_prefix_delegations (self, device); |