]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
bridge: fdb: add flush [no]sticky entry matching
authorNikolay Aleksandrov <razor@blackwall.org>
Wed, 8 Jun 2022 12:29:20 +0000 (15:29 +0300)
committerDavid Ahern <dsahern@kernel.org>
Fri, 10 Jun 2022 15:01:52 +0000 (09:01 -0600)
Add flush support to match entries with or without (if "no" is
prepended) sticky flag.

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

$ bridge fdb flush dev br0 nosticky
This will delete all entries except the ones with sticky flag in
br0's fdb table.

Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
bridge/fdb.c
man/man8/bridge.8

index e64e21cb0cbaeaa8bb300b706480c8a69cf574f8..d268e702d257622278bb615531b309d7b27fd2b0 100644 (file)
@@ -47,7 +47,7 @@ static void usage(void)
                "              [ vlan VID ] [ vni VNI ] [ self ] [ master ] [ dynamic ]\n"
                "       bridge fdb flush dev DEV [ brport DEV ] [ vlan VID ]\n"
                "              [ self ] [ master ] [ [no]permanent | [no]static | [no]dynamic ]\n"
-               "              [ [no]added_by_user ] [ [no]extern_learn ]\n");
+               "              [ [no]added_by_user ] [ [no]extern_learn ] [ [no]sticky ]\n");
        exit(-1);
 }
 
@@ -726,6 +726,12 @@ static int fdb_flush(int argc, char **argv)
                } else if (strcmp(*argv, "noextern_learn") == 0) {
                        ndm_flags &= ~NTF_EXT_LEARNED;
                        ndm_flags_mask |= NTF_EXT_LEARNED;
+               } else if (strcmp(*argv, "sticky") == 0) {
+                       ndm_flags |= NTF_STICKY;
+                       ndm_flags_mask |= NTF_STICKY;
+               } else if (strcmp(*argv, "nosticky") == 0) {
+                       ndm_flags &= ~NTF_STICKY;
+                       ndm_flags_mask |= NTF_STICKY;
                } else if (strcmp(*argv, "brport") == 0) {
                        if (port)
                                duparg2("brport", *argv);
index af343cc1a719e1ef4c51d09812f4540b1defe1c7..ad16b4fe094022881c1950cac3104cc1be8f804e 100644 (file)
@@ -122,7 +122,8 @@ bridge \- show / manipulate bridge addresses and devices
 .IR VID " ] [ "
 .BR self " ] [ " master " ] [ "
 .BR [no]permanent " | " [no]static " | " [no]dynamic " ] [ "
-.BR [no]added_by_user " ] [ " [no]extern_learn " ]"
+.BR [no]added_by_user " ] [ " [no]extern_learn " ] [ "
+.BR [no]sticky " ]"
 
 .ti -8
 .BR "bridge mdb" " { " add " | " del " } "
@@ -854,6 +855,11 @@ if "no" is prepended then only entries without added_by_user flag will be delete
 .B [no]extern_learn
 if specified then only entries with extern_learn flag will be deleted or respectively
 if "no" is prepended then only entries without extern_learn flag will be deleted.
+
+.TP
+.B [no]sticky
+if specified then only entries with sticky flag will be deleted or respectively
+if "no" is prepended then only entries without sticky flag will be deleted.
 .sp
 
 .SH bridge mdb - multicast group database management