summary refs log tree commit diff
path: root/src/nmcli/connections.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-09-01 22:38:35 +0200
committerMichael Biebl <biebl@debian.org>2024-09-01 22:38:35 +0200
commitf9bfd1158b8d08d6a5ed3bb7cc1ba7a6455e5201 (patch)
tree10267dcf5b842b7c638a79bd6851549cd849b81d /src/nmcli/connections.c
parent681dfc70ef98f6ed0c05bcb0fbff00e3fc0799ea (diff)
New upstream version 1.49.90 upstream/1.49.90
Diffstat (limited to 'src/nmcli/connections.c')
-rw-r--r--src/nmcli/connections.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c
index 7e192388..002dd402 100644
--- a/src/nmcli/connections.c
+++ b/src/nmcli/connections.c
@@ -3799,6 +3799,7 @@ check_valid_name_toplevel(const char *val, const char **port_type, GError **erro
     gs_unref_ptrarray GPtrArray   *tmp_arr = NULL;
     const NMMetaSettingInfoEditor *setting_info;
     gs_free_error GError          *tmp_err = NULL;
+    GType                          gtype   = G_TYPE_INVALID;
     const char                    *str;
     int                            i;
 
@@ -3808,6 +3809,13 @@ check_valid_name_toplevel(const char *val, const char **port_type, GError **erro
     tmp_arr = g_ptr_array_sized_new(32);
     for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) {
         setting_info = &nm_meta_setting_infos_editor[i];
+
+        /* skip "non-base" settings (that means, not valid for a connection's "type") */
+        gtype = setting_info->general->get_setting_gtype();
+        if (nm_meta_setting_info_get_base_type_priority(setting_info->general, gtype)
+            == NM_SETTING_PRIORITY_INVALID)
+            continue;
+
         g_ptr_array_add(tmp_arr, (gpointer) setting_info->general->setting_name);
         if (setting_info->alias)
             g_ptr_array_add(tmp_arr, (gpointer) setting_info->alias);
@@ -6629,9 +6637,11 @@ get_setting_and_property(const char *prompt,
         valid_settings_port = nm_meta_setting_info_valid_parts_for_port_type(s_type, NULL);
 
         setting_name = check_valid_name(sett, valid_settings_main, valid_settings_port, NULL);
-        setting      = nm_meta_setting_info_editor_new_setting(
-            nm_meta_setting_info_editor_find_by_name(setting_name, FALSE),
-            NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT);
+        if (setting_name) {
+            setting = nm_meta_setting_info_editor_new_setting(
+                nm_meta_setting_info_editor_find_by_name(setting_name, FALSE),
+                NM_META_ACCESSOR_SETTING_INIT_TYPE_DEFAULT);
+        }
     } else
         setting = nm_g_object_ref(nmc_tab_completion.setting);