Commit b4359e57 authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

device: fix the slave state change reason on master connection removal

If we surprise-remove the master, slaves would immediately attempt to bring
things up by autoconnecting. Not cool. Policy, however, blocks
autoconnect if the slaves disconnect due to "dependency-failed", and it
indeed seems to be an appropriate reason here:

  $ nmcli c add type bridge
  $ nmcli c add type dummy ifname dummy0 master bridge autoconnect yes
  $ nmcli c del bridge
  $

Before:

  (nm-bridge): state change: ip-config -> deactivating (reason 'connection-removed')
  (nm-bridge): state change: deactivating -> disconnected (reason 'connection-removed')
  (nm-bridge): detached bridge port dummy0
  (dummy0): state change: activated -> disconnected (reason 'connection-removed')
  (nm-bridge): state change: disconnected -> unmanaged (reason 'user-requested')
  (dummy0): state change: disconnected -> unmanaged (reason 'user-requested')
  policy: auto-activating connection 'bridge-slave-dummy0'

After:

  (nm-bridge): state change: ip-config -> deactivating (reason 'connection-removed')
  (nm-bridge): state change: deactivating -> disconnected (reason 'connection-removed')
  (nm-bridge): detached bridge port dummy0
  (dummy0): state change: activated -> deactivating (reason 'dependency-failed')
  (nm-bridge): state change: disconnected -> unmanaged (reason 'user-requested')
  (dummy0): state change: deactivating -> disconnected (reason 'dependency-failed')
  (dummy0): state change: disconnected -> unmanaged (reason 'user-requested')

https://github.com/NetworkManager/NetworkManager/pull/319
(cherry picked from commit 8f2a8a52)
parent 065fa283
...@@ -5081,6 +5081,11 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason) ...@@ -5081,6 +5081,11 @@ nm_device_slave_notify_release (NMDevice *self, NMDeviceStateReason reason)
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
master_status = "deactivated by user request"; master_status = "deactivated by user request";
break; break;
case NM_DEVICE_STATE_REASON_CONNECTION_REMOVED:
new_state = NM_DEVICE_STATE_DEACTIVATING;
reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
master_status = "deactivated because master was removed";
break;
default: default:
new_state = NM_DEVICE_STATE_DISCONNECTED; new_state = NM_DEVICE_STATE_DISCONNECTED;
master_status = "deactivated"; master_status = "deactivated";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment