bridge: vlan: add global mcast_mld_version option

Add control and dump support for the global mcast_mld_version option
which controls the MLD version on the vlan (default 1).
Syntax: $ bridge vlan global set dev bridge vid 1 mcast_mld_version 2

Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
Nikolay Aleksandrov 2021-08-28 14:07:55 +03:00 committed by David Ahern
parent 29fada0f41
commit a8d7212a4f
2 changed files with 19 additions and 1 deletions

View File

@ -41,6 +41,7 @@ static void usage(void)
" bridge vlan global { set } vid VLAN_ID dev DEV\n" " bridge vlan global { set } vid VLAN_ID dev DEV\n"
" [ mcast_snooping MULTICAST_SNOOPING ]\n" " [ mcast_snooping MULTICAST_SNOOPING ]\n"
" [ mcast_igmp_version IGMP_VERSION ]\n" " [ mcast_igmp_version IGMP_VERSION ]\n"
" [ mcast_mld_version MLD_VERSION ]\n"
" bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n"); " bridge vlan global { show } [ dev DEV ] [ vid VLAN_ID ]\n");
exit(-1); exit(-1);
} }
@ -413,6 +414,12 @@ static int vlan_global_option_set(int argc, char **argv)
invarg("invalid mcast_igmp_version", *argv); invarg("invalid mcast_igmp_version", *argv);
addattr8(&req.n, 1024, addattr8(&req.n, 1024,
BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION, val8); BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION, val8);
} else if (strcmp(*argv, "mcast_mld_version") == 0) {
NEXT_ARG();
if (get_u8(&val8, *argv, 0))
invarg("invalid mcast_mld_version", *argv);
addattr8(&req.n, 1024,
BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION, val8);
} else { } else {
if (strcmp(*argv, "help") == 0) if (strcmp(*argv, "help") == 0)
NEXT_ARG(); NEXT_ARG();
@ -756,6 +763,11 @@ static void print_vlan_global_opts(struct rtattr *a, int ifindex)
print_uint(PRINT_ANY, "mcast_igmp_version", print_uint(PRINT_ANY, "mcast_igmp_version",
"mcast_igmp_version %u ", rta_getattr_u8(vattr)); "mcast_igmp_version %u ", rta_getattr_u8(vattr));
} }
if (vtb[BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION]) {
vattr = vtb[BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION];
print_uint(PRINT_ANY, "mcast_mld_version",
"mcast_mld_version %u ", rta_getattr_u8(vattr));
}
print_nl(); print_nl();
close_json_object(); close_json_object();
} }

View File

@ -161,7 +161,9 @@ bridge \- show / manipulate bridge addresses and devices
.B mcast_snooping .B mcast_snooping
.IR MULTICAST_SNOOPING " ] [ " .IR MULTICAST_SNOOPING " ] [ "
.B mcast_igmp_version .B mcast_igmp_version
.IR IGMP_VERSION " ]" .IR IGMP_VERSION " ] [ "
.B mcast_mld_version
.IR MLD_VERSION " ]"
.ti -8 .ti -8
.BR "bridge vlan global" " [ " show " ] [ " .BR "bridge vlan global" " [ " show " ] [ "
@ -937,6 +939,10 @@ or off
.BI mcast_igmp_version " IGMP_VERSION " .BI mcast_igmp_version " IGMP_VERSION "
set the IGMP version. Default is 2. set the IGMP version. Default is 2.
.TP
.BI mcast_mld_version " MLD_VERSION "
set the MLD version. Default is 1.
.SS bridge vlan global show - list global vlan options. .SS bridge vlan global show - list global vlan options.
This command displays the global VLAN options for each VLAN entry. This command displays the global VLAN options for each VLAN entry.