manager: fix assertion failure in active_connection_find()

Active-connections in the async_op_lst are not guaranteed to have a
settings-connection. In particular, the settings-connection for an
AddAndActivate() AC is set only after the authorization succeeds. Use
the non-asserting variant of the function to fix the following
failure:

 nm_active_connection_get_settings_connection: assertion 'sett_conn' failed

 1    _g_log_abort()
 2    g_logv()
 3    g_log()
 4    _nm_g_return_if_fail_warning.constprop.14()
 5    nm_active_connection_get_settings_connection()
 6    active_connection_find()
 7    _get_activatable_connections_filter()
 8    nm_settings_get_connections_clone()
 9    nm_manager_get_activatable_connections()
 10   auto_activate_device_cb()
 11   g_idle_dispatch()
 12   g_main_context_dispatch()
 13   g_main_context_iterate.isra.21()
 14   g_main_loop_run()
 15   main()

Fixes: 33b9fa3a3c ('manager: Keep volatile/external connections while referenced by async_op_lst')

https://bugzilla.redhat.com/show_bug.cgi?id=1933719
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/834
This commit is contained in:
Beniamino Galvani 2021-04-30 22:35:20 +02:00
parent ad2226eacd
commit 23cc0bf335

View file

@ -1021,7 +1021,7 @@ active_connection_find(
NMSettingsConnection *ac_conn;
ac = async_op_data->ac_auth.active;
ac_conn = nm_active_connection_get_settings_connection(ac);
ac_conn = _nm_active_connection_get_settings_connection(ac);
if (sett_conn && sett_conn != ac_conn)
continue;
if (uuid && !nm_streq0(uuid, nm_settings_connection_get_uuid(ac_conn)))