[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231211140732.11475-4-bpoirier@nvidia.com>
Date: Mon, 11 Dec 2023 09:07:15 -0500
From: Benjamin Poirier <bpoirier@...dia.com>
To: netdev@...r.kernel.org
Cc: Petr Machata <petrm@...dia.com>,
Roopa Prabhu <roopa@...dia.com>
Subject: [PATCH iproute2-next 03/20] 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@...dia.com>
Tested-by: Petr Machata <petrm@...dia.com>
Signed-off-by: Benjamin Poirier <bpoirier@...dia.com>
---
bridge/vni.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/bridge/vni.c b/bridge/vni.c
index 33e50d18..56def2f7 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) {
--
2.43.0
Powered by blists - more mailing lists