From d0df9bf0bd982ebf3dd9cf34dc240bf517012ff8 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 27 Nov 2020 19:31:22 +0100 Subject: [PATCH] manager: return most recent connection in active_connection_find() When a connection is reactivated, there could be two active connections tracked by the manager: the deactivating one and the new one. Ensure that we first return the most recent one so that slaves will pick the right master. Fixes-test: @iptunnel_gretap_doc_procedure Fixes: dc6ec6ce7b8d ('core: reverse the order of active connections in the manager') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/697 --- src/nm-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-manager.c b/src/nm-manager.c index 75117bbc63..03906c8435 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -987,7 +987,7 @@ active_connection_find( nm_assert(!sett_conn || NM_IS_SETTINGS_CONNECTION(sett_conn)); nm_assert(!out_all_matching || !*out_all_matching); - c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) { + c_list_for_each_entry_prev (ac, &priv->active_connections_lst_head, active_connections_lst) { NMSettingsConnection *ac_conn; ac_conn = nm_active_connection_get_settings_connection(ac);