aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Poirier <bpoirier@nvidia.com>2023-12-11 09:07:15 -0500
committerStephen Hemminger <stephen@networkplumber.org>2023-12-22 09:54:23 -0800
commit0b8c01b4058eff19e88da4dfa0f598a9c24a8d3b (patch)
treeef30c19edf9139504e49d34a5a1d51aac38ffd2c
parentba1e68f04be3b6f391e236ff8e034709c8acc278 (diff)
downloadiproute2-next-0b8c01b4058eff19e88da4dfa0f598a9c24a8d3b.tar.gz
bridge: vni: Fix duplicate group and remote error messages
Consider the following command with a duplicated "remote" argument: $ bridge vni add vni 150 remote 10.0.0.1 remote 10.0.0.2 dev vxlan2 Error: argument "remote" is wrong: duplicate group The error message is misleading because there is no "group" argument. Both of the "group" and "remote" options specify a destination address and are mutually exclusive so change the variable name and error messages accordingly. The result is: $ ./bridge/bridge vni add vni 150 remote 10.0.0.1 remote 10.0.0.2 dev vxlan2 Error: duplicate "destination": "10.0.0.2" is the second value. Fixes: 45cd32f9f7d5 ("bridge: vxlan device vnifilter support") Reviewed-by: Petr Machata <petrm@nvidia.com> Tested-by: Petr Machata <petrm@nvidia.com> Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--bridge/vni.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/bridge/vni.c b/bridge/vni.c
index 33e50d18c..56def2f79 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -92,7 +92,7 @@ static int vni_modify(int cmd, int argc, char **argv)
.n.nlmsg_type = cmd,
.tmsg.family = PF_BRIDGE,
};
- bool group_present = false;
+ bool daddr_present = false;
inet_prefix daddr;
char *vni = NULL;
char *d = NULL;
@@ -107,19 +107,19 @@ static int vni_modify(int cmd, int argc, char **argv)
invarg("duplicate vni", *argv);
vni = *argv;
} else if (strcmp(*argv, "group") == 0) {
- if (group_present)
- invarg("duplicate group", *argv);
NEXT_ARG();
+ if (daddr_present)
+ duparg("destination", *argv);
get_addr(&daddr, *argv, AF_UNSPEC);
if (!is_addrtype_inet_multi(&daddr))
invarg("invalid group address", *argv);
- group_present = true;
+ daddr_present = true;
} else if (strcmp(*argv, "remote") == 0) {
- if (group_present)
- invarg("duplicate group", *argv);
NEXT_ARG();
+ if (daddr_present)
+ duparg("destination", *argv);
get_addr(&daddr, *argv, AF_UNSPEC);
- group_present = true;
+ daddr_present = true;
} else {
if (strcmp(*argv, "help") == 0)
usage();
@@ -133,7 +133,7 @@ static int vni_modify(int cmd, int argc, char **argv)
}
parse_vni_filter(vni, &req.n, sizeof(req),
- (group_present ? &daddr : NULL));
+ (daddr_present ? &daddr : NULL));
req.tmsg.ifindex = ll_name_to_index(d);
if (req.tmsg.ifindex == 0) {