bridge: fdb: add support for sticky flag

Add support for the new sticky flag that can be set on fdbs and update the
man page.

CC: David Ahern <dsahern@gmail.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
This commit is contained in:
Nikolay Aleksandrov 2018-09-27 16:35:12 +03:00 committed by David Ahern
parent d9c0be4e97
commit c3ded6e4a0
2 changed files with 12 additions and 3 deletions

View File

@ -37,8 +37,8 @@ static void usage(void)
fprintf(stderr, fprintf(stderr,
"Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n" "Usage: bridge fdb { add | append | del | replace } ADDR dev DEV\n"
" [ self ] [ master ] [ use ] [ router ] [ extern_learn ]\n" " [ self ] [ master ] [ use ] [ router ] [ extern_learn ]\n"
" [ local | static | dynamic ] [ dst IPADDR ] [ vlan VID ]\n" " [ sticky ] [ local | static | dynamic ] [ dst IPADDR ]\n"
" [ port PORT] [ vni VNI ] [ via DEV ]\n" " [ vlan VID ] [ port PORT] [ vni VNI ] [ via DEV ]\n"
" bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n"); " bridge fdb [ show [ br BRDEV ] [ brport DEV ] [ vlan VID ] [ state STATE ] ]\n");
exit(-1); exit(-1);
} }
@ -101,6 +101,9 @@ static void fdb_print_flags(FILE *fp, unsigned int flags)
if (flags & NTF_MASTER) if (flags & NTF_MASTER)
print_string(PRINT_ANY, NULL, "%s ", "master"); print_string(PRINT_ANY, NULL, "%s ", "master");
if (flags & NTF_STICKY)
print_string(PRINT_ANY, NULL, "%s ", "sticky");
close_json_array(PRINT_JSON, NULL); close_json_array(PRINT_JSON, NULL);
} }
@ -414,6 +417,8 @@ static int fdb_modify(int cmd, int flags, int argc, char **argv)
req.ndm.ndm_flags |= NTF_USE; req.ndm.ndm_flags |= NTF_USE;
} else if (matches(*argv, "extern_learn") == 0) { } else if (matches(*argv, "extern_learn") == 0) {
req.ndm.ndm_flags |= NTF_EXT_LEARNED; req.ndm.ndm_flags |= NTF_EXT_LEARNED;
} else if (matches(*argv, "sticky") == 0) {
req.ndm.ndm_flags |= NTF_STICKY;
} else { } else {
if (strcmp(*argv, "to") == 0) if (strcmp(*argv, "to") == 0)
NEXT_ARG(); NEXT_ARG();

View File

@ -63,7 +63,7 @@ bridge \- show / manipulate bridge addresses and devices
.B dev .B dev
.IR DEV " { " .IR DEV " { "
.BR local " | " static " | " dynamic " } [ " .BR local " | " static " | " dynamic " } [ "
.BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " extern_learn " ] [ " .BR self " ] [ " master " ] [ " router " ] [ " use " ] [ " extern_learn " ] [ " sticky " ] [ "
.B dst .B dst
.IR IPADDR " ] [ " .IR IPADDR " ] [ "
.B vni .B vni
@ -448,6 +448,10 @@ indicate to the kernel that an entry was hardware or user-space
controller learnt dynamic entry. Kernel will not age such an entry. controller learnt dynamic entry. Kernel will not age such an entry.
.sp .sp
.B sticky
- this entry will not change its port due to learning.
.sp
.in -8 .in -8
The next command line parameters apply only The next command line parameters apply only
when the specified device when the specified device