diff options
author | Wen Liang <liangwen12year@gmail.com> | 2023-08-27 21:34:07 -0400 |
---|---|---|
committer | Wen Liang <liangwen12year@gmail.com> | 2023-08-29 13:51:24 -0400 |
commit | a274f6852d155cf3dbadfffc3dbc4b36a0ec9d47 (patch) | |
tree | 8ac7f84a280f9f0f49211f2f18d9b78767359841 | |
parent | 194b381d3889882e7ba28f9d4a77abaf6ab21eb3 (diff) |
nm-policy: consider autoconnect priority when activating port connectionswl/activate_slave_conn_fix
When port connenctions are blocked due to failed dependency, the port
device should also be marked as blocked, so that the port device will
stop autoactivating until the controller connection is activated. When
activating the port connection, we should also consider activating in
the order of autoconnect priority.
https://bugzilla.redhat.com/show_bug.cgi?id=2121451
-rw-r--r-- | src/core/nm-policy.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index efdb06360f..2874ddcdea 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1782,6 +1782,8 @@ unblock_autoconnect_for_ports(NMPolicy *self, { NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); NMSettingsConnection *const *connections; + const CList *tmp_lst; + NMDevice *device; gboolean changed; guint i; @@ -1797,7 +1799,7 @@ unblock_autoconnect_for_ports(NMPolicy *self, "")); changed = FALSE; - connections = nm_settings_get_connections(priv->settings, NULL); + connections = nm_settings_get_connections_sorted_by_autoconnect_priority(priv->settings, NULL); for (i = 0; connections[i]; i++) { NMSettingsConnection *sett_conn = connections[i]; NMSettingConnection *s_slave_con; @@ -1828,7 +1830,8 @@ unblock_autoconnect_for_ports(NMPolicy *self, changed = TRUE; } } - + nm_manager_for_each_device (priv->manager, device, tmp_lst) + nm_device_autoconnect_blocked_unset(device, NM_DEVICE_AUTOCONNECT_BLOCKED_INTERNAL); if (changed) nm_policy_device_recheck_auto_activate_all_schedule(self); } @@ -2073,6 +2076,8 @@ device_state_changed(NMDevice *device, "dependency", sett_conn, nm_settings_connection_get_id(sett_conn)); + nm_device_autoconnect_blocked_set(NM_DEVICE(self), + NM_DEVICE_AUTOCONNECT_BLOCKED_INTERNAL); nm_manager_devcon_autoconnect_blocked_reason_set( priv->manager, device, |