summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-20 12:26:15 +0100
committerThomas Haller <thaller@redhat.com>2019-03-25 09:12:33 +0100
commit65c8c19fa7f4a5148dac1fa7043bd10524972e37 (patch)
tree54d596206157c3a89a9aa18c7471e355ead3e05a
parentda5895951a372e896e4acb5a3241eaee0ad8c723 (diff)
cli: don't support removing sriov vfs by index
The VFs already can be parsed as plain number (to indicate the ifindex). We should not also support accepting the plain number as index to be removed. Fixes: a2f12994b7cd ('cli: add support for configuring SR-IOV')
-rw-r--r--clients/common/nm-meta-setting-desc.c2
-rw-r--r--libnm-core/nm-utils.c3
2 files changed, 1 insertions, 4 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 4d2ed10ea..b8c2320c2 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -6112,8 +6112,6 @@ static const NMMetaPropertyInfo *const property_infos_SRIOV[] = {
.clear_all_fcn = OBJLIST_CLEAR_ALL_FCN (NMSettingSriov, nm_setting_sriov_clear_vfs),
.obj_to_str_fcn = _objlist_obj_to_str_fcn_sriov_vfs,
.set_fcn = _objlist_set_fcn_sriov_vfs,
- /* FIXME: removing by index is ambigous and should maybe be prevented. */
- .remove_by_idx_fcn_u = OBJLIST_REMOVE_BY_IDX_FCN_U (NMSettingSriov, nm_setting_sriov_remove_vf),
),
),
),
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 854bfec79..9f3b209cc 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -2962,8 +2962,7 @@ nm_utils_sriov_vf_from_str (const char *str, GError **error)
detail = strchr (str, ' ');
if (detail) {
- index_free = g_strndup (str, detail - str);
- str = index_free;
+ str = nm_strndup_a (200, str, detail - str, &index_free);
detail++;
}