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: dc6ec6ce7b ('core: reverse the order of active connections in the manager')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/697
This commit is contained in:
Beniamino Galvani 2020-11-27 19:31:22 +01:00
parent 587a1949b2
commit d0df9bf0bd

View file

@ -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);