summary refs log tree commit diff
path: root/clients/cli/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'clients/cli/common.c')
-rw-r--r--clients/cli/common.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c
index e566de47..09c86334 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -49,6 +49,9 @@ _ip_config_get_routes (NMIPConfig *cfg)
 	if (!ptr_array)
 		return NULL;
 
+	if (ptr_array->len == 0)
+		return NULL;
+
 	arr = g_new (char *, ptr_array->len + 1);
 	for (i = 0; i < ptr_array->len; i++) {
 		NMIPRoute *route = g_ptr_array_index (ptr_array, i);
@@ -384,7 +387,7 @@ print_dhcp_config (NMDhcpConfig *dhcp,
 /*
  * nmc_find_connection:
  * @connections: array of NMConnections to search in
- * @filter_type: "id", "uuid", "path" or %NULL
+ * @filter_type: "id", "uuid", "path", "filename", or %NULL
  * @filter_val: connection to find (connection name, UUID or path)
  * @out_result: if not NULL, attach all matching connection to this
  *   list. If necessary, a new array will be allocated. If the array
@@ -452,6 +455,14 @@ nmc_find_connection (const GPtrArray *connections,
 				goto found;
 		}
 
+		if (NM_IN_STRSET (filter_type, NULL, "filename")) {
+			v = nm_remote_connection_get_filename (NM_REMOTE_CONNECTION (connections->pdata[i]));
+			if (complete && (filter_type || *filter_val))
+				nmc_complete_strings (filter_val, v, NULL);
+			if (nm_streq0 (filter_val, v))
+				goto found;
+		}
+
 		continue;
 found:
 		if (!out_result)
@@ -523,6 +534,14 @@ nmc_find_active_connection (const GPtrArray *active_cons,
 				goto found;
 		}
 
+		if (NM_IN_STRSET (filter_type, NULL, "filename")) {
+			v = nm_remote_connection_get_filename (con);
+			if (complete && (filter_type || *filter_val))
+				nmc_complete_strings (filter_val, v, NULL);
+			if (nm_streq0 (filter_val, v))
+				goto found;
+		}
+
 		if (NM_IN_STRSET (filter_type, NULL, "apath")) {
 			v = nm_object_get_path (NM_OBJECT (candidate));
 			v_num = nm_utils_dbus_path_get_last_component (v);