bridge: fdb: support match on [no]router flag in flush command

Extend "fdb flush" command to match entries with or without (if "no" is
prepended) router flag.

Examples:
$ bridge fdb flush dev vx10 router
This will delete all fdb entries pointing to vx10 with router flag.

$ bridge fdb flush dev vx10 norouter
This will delete all fdb entries pointing to vx10, except the ones with
router flag.

Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Amit Cohen 2023-10-17 13:55:31 +03:00 committed by David Ahern
parent 994bf05ee2
commit 958eecd2d0
2 changed files with 15 additions and 2 deletions

View File

@ -49,7 +49,7 @@ static void usage(void)
" [ 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");
" [ [no]offloaded ] [ [no]router ]\n");
exit(-1);
}
@ -759,6 +759,12 @@ static int fdb_flush(int argc, char **argv)
} else if (strcmp(*argv, "nooffloaded") == 0) {
ndm_flags &= ~NTF_OFFLOADED;
ndm_flags_mask |= NTF_OFFLOADED;
} else if (strcmp(*argv, "router") == 0) {
ndm_flags |= NTF_ROUTER;
ndm_flags_mask |= NTF_ROUTER;
} else if (strcmp(*argv, "norouter") == 0) {
ndm_flags &= ~NTF_ROUTER;
ndm_flags_mask |= NTF_ROUTER;
} else if (strcmp(*argv, "brport") == 0) {
if (brport)
duparg2("brport", *argv);

View File

@ -141,7 +141,7 @@ bridge \- show / manipulate bridge addresses and devices
.BR self " ] [ " master " ] [ "
.BR [no]permanent " | " [no]static " | " [no]dynamic " ] [ "
.BR [no]added_by_user " ] [ " [no]extern_learn " ] [ "
.BR [no]sticky " ] [ " [no]offloaded " ]"
.BR [no]sticky " ] [ " [no]offloaded " ] [ " [no]router " ]"
.ti -8
.BR "bridge mdb" " { " add " | " del " | " replace " } "
@ -980,6 +980,13 @@ if specified then only entries with offloaded flag will be deleted or respective
if "no" is prepended then only entries without offloaded flag will be deleted.
.sp
.TP
.B [no]router
if specified then only entries with router flag will be deleted or respectively
if "no" is prepended then only entries without router flag will be deleted. Valid
if the referenced device is a VXLAN type device.
.sp
.SH bridge mdb - multicast group database management
.B mdb