lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  8 Jun 2022 15:29:16 +0300
From:   Nikolay Aleksandrov <razor@...ckwall.org>
To:     netdev@...r.kernel.org
Cc:     dsahern@...il.com, stephen@...workplumber.org, roopa@...dia.com,
        Nikolay Aleksandrov <razor@...ckwall.org>
Subject: [PATCH iproute2-next 05/10] bridge: fdb: add flush [no]static entry matching

Add flush support to match static or non-static entries if "no" is
prepended respectively. Note that static entries are only NUD_NOARP ones
without NUD_PERMANENT, also when matching non-static entries exclude
permanent entries as well (permanent entries by definition are also
static).

Examples:
$ bridge fdb flush dev br0 static
This will delete all static entries in br0's fdb table.

$ bridge fdb flush dev br0 nostatic
This will delete all entries except the static ones in br0's fdb
table.

Signed-off-by: Nikolay Aleksandrov <razor@...ckwall.org>
---
 bridge/fdb.c      | 8 +++++++-
 man/man8/bridge.8 | 7 ++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/bridge/fdb.c b/bridge/fdb.c
index b1c516141750..93806d7d35b5 100644
--- a/bridge/fdb.c
+++ b/bridge/fdb.c
@@ -46,7 +46,7 @@ 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 ]\n"
-		"              [ self ] [ master ] [ [no]permanent ]\n");
+		"              [ self ] [ master ] [ [no]permanent | [no]static ]\n");
 	exit(-1);
 }
 
@@ -700,6 +700,12 @@ static int fdb_flush(int argc, char **argv)
 		} else if (strcmp(*argv, "nopermanent") == 0) {
 			ndm_state &= ~NUD_PERMANENT;
 			ndm_state_mask |= NUD_PERMANENT;
+		} else if (strcmp(*argv, "static") == 0) {
+			ndm_state |= NUD_NOARP;
+			ndm_state_mask |= NUD_NOARP | NUD_PERMANENT;
+		} else if (strcmp(*argv, "nostatic") == 0) {
+			ndm_state &= ~NUD_NOARP;
+			ndm_state_mask |= NUD_NOARP;
 		} else if (strcmp(*argv, "brport") == 0) {
 			if (port)
 				duparg2("brport", *argv);
diff --git a/man/man8/bridge.8 b/man/man8/bridge.8
index 9dcd1f0a613f..9e2952b8c6d6 100644
--- a/man/man8/bridge.8
+++ b/man/man8/bridge.8
@@ -121,7 +121,7 @@ bridge \- show / manipulate bridge addresses and devices
 .B vlan
 .IR VID " ] [ "
 .BR self " ] [ " master " ] [ "
-.BR [no]permanent " ]"
+.BR [no]permanent " | " [no]static " ]"
 
 .ti -8
 .BR "bridge mdb" " { " add " | " del " } "
@@ -833,6 +833,11 @@ such as a bridge, the operation is fulfilled by the master device's driver.
 .B [no]permanent
 if specified then only permanent entries will be deleted or respectively if "no"
 is prepended then only non-permanent entries will be deleted.
+
+.TP
+.B [no]static
+if specified then only static entries will be deleted or respectively if "no"
+is prepended then only non-static entries will be deleted.
 .sp
 
 .SH bridge mdb - multicast group database management
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ