summaryrefslogtreecommitdiff
path: root/bridge
diff options
context:
space:
mode:
authorNikolay Aleksandrov <razor@blackwall.org>2022-06-08 15:29:16 +0300
committerDavid Ahern <dsahern@kernel.org>2022-06-10 09:01:37 -0600
commit0f6c81a63c501cc9f32a244782d02bcdf876eed9 (patch)
tree35ba4f73cf5173eca2754132efe976599738cfcb /bridge
parent988c319807508ba6de79f22e859edc50aaaad171 (diff)
downloadiproute2-0f6c81a63c501cc9f32a244782d02bcdf876eed9.tar.gz
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@blackwall.org> Signed-off-by: David Ahern <dsahern@kernel.org>
Diffstat (limited to 'bridge')
-rw-r--r--bridge/fdb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/bridge/fdb.c b/bridge/fdb.c
index b1c51614..93806d7d 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);