From 65c8c19fa7f4a5148dac1fa7043bd10524972e37 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 20 Mar 2019 12:26:15 +0100 Subject: [PATCH] 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') --- clients/common/nm-meta-setting-desc.c | 2 -- libnm-core/nm-utils.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index 4d2ed10ead..b8c2320c21 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 854bfec794..9f3b209ccf 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++; }