From a3ce5aa50ee0c64ff1488a56c8dbb8affdb1fc48 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 29 Jul 2022 00:03:20 +0200 Subject: [PATCH] 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 '' 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 --- src/nmcli/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nmcli/common.c b/src/nmcli/common.c index 509cdc7a5..e6c5c9a0b 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -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))