[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231017070227.3560105-3-amcohen@nvidia.com>
Date: Tue, 17 Oct 2023 10:02:21 +0300
From: Amit Cohen <amcohen@...dia.com>
To: <netdev@...r.kernel.org>
CC: <dsahern@...il.com>, <stephen@...workplumber.org>, <razor@...ckwall.org>,
<mlxsw@...dia.com>, <roopa@...dia.com>, Amit Cohen <amcohen@...dia.com>
Subject: [PATCH iproute2-next 2/8] bridge: fdb: support match on source VNI in flush command
Extend "fdb flush" command to match fdb entries with a specific source VNI.
Example:
$ bridge fdb flush dev vx10 src_vni 1000
This will flush all fdb entries pointing to vx10 with source VNI 1000.
Signed-off-by: Amit Cohen <amcohen@...dia.com>
---
bridge/fdb.c | 12 +++++++++++-
man/man8/bridge.8 | 8 ++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/bridge/fdb.c b/bridge/fdb.c
index e01e14f1..12d19f08 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -45,7 +45,7 @@ static void usage(void)
" [ state STATE ] [ dynamic ] ]\n"
" bridge fdb get [ to ] LLADDR [ br BRDEV ] { brport | dev } DEV\n"
" [ vlan VID ] [ vni VNI ] [ self ] [ master ] [ dynamic ]\n"
- " bridge fdb flush dev DEV [ brport DEV ] [ vlan VID ]\n"
+ " bridge fdb flush dev DEV [ brport DEV ] [ vlan VID ] [ src_vni VNI ]\n"
" [ self ] [ master ] [ [no]permanent | [no]static | [no]dynamic ]\n"
" [ [no]added_by_user ] [ [no]extern_learn ] [ [no]sticky ]\n"
" [ [no]offloaded ]\n");
@@ -700,6 +700,8 @@ static int fdb_flush(int argc, char **argv)
char *d = NULL, *brport = NULL;
unsigned short ndm_flags = 0;
unsigned short ndm_state = 0;
+ unsigned long src_vni = ~0;
+ char *endptr;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
@@ -761,6 +763,12 @@ static int fdb_flush(int argc, char **argv)
duparg2("vlan", *argv);
NEXT_ARG();
vid = atoi(*argv);
+ } else if (strcmp(*argv, "src_vni") == 0) {
+ NEXT_ARG();
+ src_vni = strtoul(*argv, &endptr, 0);
+ if ((endptr && *endptr) ||
+ (src_vni >> 24) || src_vni == ULONG_MAX)
+ invarg("invalid src VNI\n", *argv);
} else if (strcmp(*argv, "help") == 0) {
NEXT_ARG();
} else {
@@ -807,6 +815,8 @@ static int fdb_flush(int argc, char **argv)
addattr32(&req.n, sizeof(req), NDA_IFINDEX, brport_ifidx);
if (vid > -1)
addattr16(&req.n, sizeof(req), NDA_VLAN, vid);
+ if (src_vni != ~0)
+ addattr32(&req.n, sizeof(req), NDA_SRC_VNI, src_vni);
if (ndm_flags_mask)
addattr8(&req.n, sizeof(req), NDA_NDM_FLAGS_MASK,
ndm_flags_mask);
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index c52c9331..b1e96327 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -128,6 +128,8 @@ bridge \- show / manipulate bridge addresses and devices
.IR DEV " ] [ "
.B vlan
.IR VID " ] [ "
+.B src_vni
+.IR VNI " ] [ "
.BR self " ] [ " master " ] [ "
.BR [no]permanent " | " [no]static " | " [no]dynamic " ] [ "
.BR [no]added_by_user " ] [ " [no]extern_learn " ] [ "
@@ -892,6 +894,12 @@ specified by this option will override the one specified by dev above.
the target VLAN ID for the operation. Match forwarding table entries only with the
specified VLAN ID.
+.TP
+.BI src_vni " VNI"
+the src VNI Network Identifier (or VXLAN Segment ID) for the operation. Match
+forwarding table entries only with the specified VNI. Valid if the referenced
+device is a VXLAN type device.
+
.TP
.B self
the operation is fulfilled directly by the driver for the specified network
--
2.41.0
Powered by blists - more mailing lists