diff mbox series

[iproute2-next,04/20] bridge: vni: Report duplicate vni argument using duparg()

Message ID 20231211140732.11475-5-bpoirier@nvidia.com (mailing list archive)
State Accepted
Commit aeb7ee297361fa9af0b3931d799180b2ec595617
Delegated to: Stephen Hemminger
Headers show
Series bridge: vni: UI fixes | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Benjamin Poirier Dec. 11, 2023, 2:07 p.m. UTC
When there is a duplicate 'vni' option, report the error using duparg()
instead of the generic invarg().

Before:
$ bridge vni add vni 100 vni 101 dev vxlan2
Error: argument "101" is wrong: duplicate vni

After:
$ ./bridge/bridge vni add vni 100 vni 101 dev vxlan2
Error: duplicate "vni": "101" 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>
---
 bridge/vni.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Hemminger Dec. 21, 2023, 3:59 a.m. UTC | #1
On Mon, 11 Dec 2023 09:07:16 -0500
Benjamin Poirier <bpoirier@nvidia.com> wrote:

> When there is a duplicate 'vni' option, report the error using duparg()
> instead of the generic invarg().
> 
> Before:
> $ bridge vni add vni 100 vni 101 dev vxlan2
> Error: argument "101" is wrong: duplicate vni
> 
> After:
> $ ./bridge/bridge vni add vni 100 vni 101 dev vxlan2
> Error: duplicate "vni": "101" 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>
diff mbox series

Patch

diff --git a/bridge/vni.c b/bridge/vni.c
index 56def2f7..ecd4c2b5 100644
--- a/bridge/vni.c
+++ b/bridge/vni.c
@@ -104,7 +104,7 @@  static int vni_modify(int cmd, int argc, char **argv)
 		} else if (strcmp(*argv, "vni") == 0) {
 			NEXT_ARG();
 			if (vni)
-				invarg("duplicate vni", *argv);
+				duparg("vni", *argv);
 			vni = *argv;
 		} else if (strcmp(*argv, "group") == 0) {
 			NEXT_ARG();