device: do not set dependency failed for port if master is reconnecting

When a master is re-enslaved, it will be deactivated and reconnecting
immediately, as a result, we should not set the dependency-failed for
its port. Otherwise, we may risk blocking the autoconnect of port
connections with higher autoconnect-priority.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1725
https://gitlab.freedesktop.org/NetworkManager/NetworkManager-ci/-/merge_requests/1473
This commit is contained in:
Wen Liang 2023-09-08 10:45:17 -04:00
parent 510952b036
commit 4d0cf4924f

View file

@ -9746,10 +9746,16 @@ activate_stage1_device_prepare(NMDevice *self)
master = nm_active_connection_get_master(active);
if (master) {
if (nm_active_connection_get_state(master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) {
NMDevice *master_device = nm_active_connection_get_device(master);
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED;
_LOGD(LOGD_DEVICE, "master connection is deactivating");
nm_device_state_changed(self,
NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED);
if (master_device && NM_DEVICE_GET_PRIVATE(master_device)->queued_act_request) {
/* if the controller is going to activate again, don't block this device */
failure_reason = NM_DEVICE_STATE_REASON_NONE;
}
nm_device_state_changed(self, NM_DEVICE_STATE_FAILED, failure_reason);
return;
}
/* If the master connection is ready for slaves, attach ourselves */