cli: support removing multiple vlan ingress/egress priority mappings

$ nmcli connection add type vlan autoconnect no con-name v dev vlan.1 id 1
    $ nmcli connection modify v +vlan.ingress-priority-map 1:2,2:3
    $ nmcli connection modify v +vlan.ingress-priority-map 2:3,4:5
    $ nmcli connection modify v -vlan.ingress-priority-map 1:2,4:5
    Warning: only one mapping at a time is supported; taking the first one (1:2)
This commit is contained in:
Thomas Haller 2019-03-16 13:15:14 +01:00
parent 626aed64e7
commit d3cfe20598

View file

@ -4166,19 +4166,17 @@ _remove_vlan_xgress_priority_map (const NMMetaEnvironment *environment,
if (value) {
gs_strfreev char **prio_map = NULL;
gsize i;
prio_map = _parse_vlan_priority_maps (value, map_type, TRUE, error);
if (!prio_map)
return FALSE;
if (prio_map[1]) {
_env_warn_fcn (environment, environment_user_data,
NM_META_ENV_WARN_LEVEL_WARN,
N_("only one mapping at a time is supported; taking the first one (%s)"),
prio_map[0]);
for (i = 0; prio_map[i]; i++) {
nm_setting_vlan_remove_priority_str_by_value (NM_SETTING_VLAN (setting),
map_type,
prio_map[i]);
}
nm_setting_vlan_remove_priority_str_by_value (NM_SETTING_VLAN (setting),
map_type,
prio_map[0]);
return TRUE;
}