nmcli: do not assume active connection has a settings connection

The reproducer for another problem tripped an assertion failure:

  $ nmcli con del act-conn
  Connection 'act-conn' (...) successfully deleted.
  $ nmcli con down another-conn

  (process:94552): nm-CRITICAL **: 17:07:21.170: ((src/libnm-client-impl/nm-remote-connection.c:593)): assertion '<dropped>' failed
  Connection 'another-conn' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)
  $

What happens is that the second invocation, when resolving the
connection name into a NMRemoteConnection object, assumes an active
connection has a settings connection.

This assumption is likely to be wrong immediately after deleting a
connection was active, before giving the active connection enough time
to fully deactivate.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1317
This commit is contained in:
Lubomir Rintel
2022-07-29 00:03:20 +02:00
parent 2b4b4193be
commit a3ce5aa50e

View File

@@ -572,7 +572,7 @@ nmc_find_active_connection(const GPtrArray *active_cons,
}
if (NM_IN_STRSET(filter_type, NULL, "filename")) {
v = nm_remote_connection_get_filename(con);
v = con ? nm_remote_connection_get_filename(con) : NULL;
if (complete && (filter_type || *filter_val))
nmc_complete_strings(filter_val, v);
if (nm_streq0(filter_val, v))