[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231017070227.3560105-7-amcohen@nvidia.com>
Date: Tue, 17 Oct 2023 10:02:25 +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 6/8] bridge: fdb: support match on destination IP in flush command
Extend "fdb flush" command to match fdb entries with a specific destination
IP.
Example:
$ bridge fdb flush dev vx10 dst 192.1.1.1
This will flush all fdb entries pointing to vx10 with destination IP
192.1.1.1
Signed-off-by: Amit Cohen <amcohen@...dia.com>
---
bridge/fdb.c | 14 ++++++++++++--
man/man8/bridge.8 | 8 ++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/bridge/fdb.c b/bridge/fdb.c
index d9665bd5..35100e68 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -46,8 +46,8 @@ static void usage(void)
" 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 ] [ src_vni VNI ]\n"
- " [ nhid NHID ] [ vni VNI ] [ port PORT ] [ self ] [ master ]\n"
- " [ [no]permanent | [no]static | [no]dynamic ]\n"
+ " [ nhid NHID ] [ vni VNI ] [ port PORT ] [ dst IPADDR ] [ self ]\n"
+ " [ master ] [ [no]permanent | [no]static | [no]dynamic ]\n"
" [ [no]added_by_user ] [ [no]extern_learn ] [ [no]sticky ]\n"
" [ [no]offloaded ]\n");
exit(-1);
@@ -704,6 +704,8 @@ static int fdb_flush(int argc, char **argv)
unsigned long src_vni = ~0;
unsigned long vni = ~0;
unsigned long port = 0;
+ inet_prefix dst;
+ int dst_ok = 0;
__u32 nhid = 0;
char *endptr;
@@ -795,6 +797,12 @@ static int fdb_flush(int argc, char **argv)
port = ntohs(pse->s_port);
} else if (port > 0xffff)
invarg("invalid port\n", *argv);
+ } else if (strcmp(*argv, "dst") == 0) {
+ NEXT_ARG();
+ if (dst_ok)
+ duparg2("dst", *argv);
+ get_addr(&dst, *argv, preferred_family);
+ dst_ok = 1;
} else if (strcmp(*argv, "help") == 0) {
NEXT_ARG();
} else {
@@ -853,6 +861,8 @@ static int fdb_flush(int argc, char **argv)
dport = htons((unsigned short)port);
addattr16(&req.n, sizeof(req), NDA_PORT, dport);
}
+ if (dst_ok)
+ addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen);
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 4255364d..df440c33 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -136,6 +136,8 @@ bridge \- show / manipulate bridge addresses and devices
.IR VNI " ] [ "
.B port
.IR PORT " ] ["
+.B dst
+.IR IPADDR " ] [ "
.BR self " ] [ " master " ] [ "
.BR [no]permanent " | " [no]static " | " [no]dynamic " ] [ "
.BR [no]added_by_user " ] [ " [no]extern_learn " ] [ "
@@ -923,6 +925,12 @@ the UDP destination PORT number for the operation. Match forwarding table
entries only with the specified PORT. Valid if the referenced device is a VXLAN
type device.
+.TP
+.BI dst " IPADDR"
+the IP address of the destination VXLAN tunnel endpoint for the operation. Match
+forwarding table entries only with the specified IPADDR. 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