diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-24 00:30:04 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2022-06-24 00:30:04 +0200 |
commit | 69e65a9b0eec02ee41a3b6f0f6605eed57890106 (patch) | |
tree | 32abcd2857a95ead282408bd7d2b93d8aee62a4e | |
parent | cf62f0e3a15c71cb036f272c6b1d3793e6acd5c1 (diff) | |
download | NetworkManager-69e65a9b0eec02ee41a3b6f0f6605eed57890106.tar.gz |
nmcli/connections: make sure the connection has a type
We use it before we validate the connection, thus need to check if it's
actually there.
-rw-r--r-- | src/nmcli/connections.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 4d646798de..92613739bb 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -5615,7 +5615,9 @@ connection_get_base_meta_setting_type(NMConnection *connection) const NMMetaSettingInfoEditor *editor; connection_type = nm_connection_get_connection_type(connection); - nm_assert(connection_type); + if (!connection_type) + return NM_META_SETTING_TYPE_UNKNOWN; + base_setting = nm_connection_get_setting_by_name(connection, connection_type); nm_assert(base_setting); editor = nm_meta_setting_info_editor_find_by_setting(base_setting); @@ -5671,10 +5673,15 @@ questionnaire_mandatory(NmCli *nmc, NMConnection *connection) NMMetaSettingType s, base; /* First ask connection properties */ - questionnaire_mandatory_ask_setting(nmc, connection, NM_META_SETTING_TYPE_CONNECTION); + while (1) { + base = connection_get_base_meta_setting_type(connection); + if (base != NM_META_SETTING_TYPE_UNKNOWN) + break; + enable_options(NM_SETTING_CONNECTION_SETTING_NAME, NM_SETTING_CONNECTION_TYPE, NULL); + questionnaire_mandatory_ask_setting(nmc, connection, NM_META_SETTING_TYPE_CONNECTION); + } /* Ask properties of the base setting */ - base = connection_get_base_meta_setting_type(connection); questionnaire_mandatory_ask_setting(nmc, connection, base); /* Remaining settings */ |