ip: bridge: add support for mcast_vlan_snooping
Add support for mcast_vlan_snooping option which controls per-vlan multicast snooping, also update the man page. Syntax: $ ip link set dev bridge type bridge mcast_vlan_snooping 0/1 Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com> Signed-off-by: David Ahern <dsahern@kernel.org>
This commit is contained in:
parent
ebaa603b30
commit
d2eecb9d1d
|
|
@ -43,6 +43,7 @@ static void print_explain(FILE *f)
|
||||||
" [ vlan_stats_enabled VLAN_STATS_ENABLED ]\n"
|
" [ vlan_stats_enabled VLAN_STATS_ENABLED ]\n"
|
||||||
" [ vlan_stats_per_port VLAN_STATS_PER_PORT ]\n"
|
" [ vlan_stats_per_port VLAN_STATS_PER_PORT ]\n"
|
||||||
" [ mcast_snooping MULTICAST_SNOOPING ]\n"
|
" [ mcast_snooping MULTICAST_SNOOPING ]\n"
|
||||||
|
" [ mcast_vlan_snooping MULTICAST_VLAN_SNOOPING ]\n"
|
||||||
" [ mcast_router MULTICAST_ROUTER ]\n"
|
" [ mcast_router MULTICAST_ROUTER ]\n"
|
||||||
" [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n"
|
" [ mcast_query_use_ifaddr MCAST_QUERY_USE_IFADDR ]\n"
|
||||||
" [ mcast_querier MULTICAST_QUERIER ]\n"
|
" [ mcast_querier MULTICAST_QUERIER ]\n"
|
||||||
|
|
@ -83,6 +84,7 @@ void br_dump_bridge_id(const struct ifla_bridge_id *id, char *buf, size_t len)
|
||||||
static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
struct nlmsghdr *n)
|
struct nlmsghdr *n)
|
||||||
{
|
{
|
||||||
|
struct br_boolopt_multi bm = {};
|
||||||
__u32 val;
|
__u32 val;
|
||||||
|
|
||||||
while (argc > 0) {
|
while (argc > 0) {
|
||||||
|
|
@ -200,6 +202,18 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
invarg("invalid mcast_snooping", *argv);
|
invarg("invalid mcast_snooping", *argv);
|
||||||
|
|
||||||
addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop);
|
addattr8(n, 1024, IFLA_BR_MCAST_SNOOPING, mcast_snoop);
|
||||||
|
} else if (strcmp(*argv, "mcast_vlan_snooping") == 0) {
|
||||||
|
__u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
|
||||||
|
__u8 mcast_vlan_snooping;
|
||||||
|
|
||||||
|
NEXT_ARG();
|
||||||
|
if (get_u8(&mcast_vlan_snooping, *argv, 0))
|
||||||
|
invarg("invalid mcast_vlan_snooping", *argv);
|
||||||
|
bm.optmask |= 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
|
||||||
|
if (mcast_vlan_snooping)
|
||||||
|
bm.optval |= mcvl_bit;
|
||||||
|
else
|
||||||
|
bm.optval &= ~mcvl_bit;
|
||||||
} else if (matches(*argv, "mcast_query_use_ifaddr") == 0) {
|
} else if (matches(*argv, "mcast_query_use_ifaddr") == 0) {
|
||||||
__u8 mcast_qui;
|
__u8 mcast_qui;
|
||||||
|
|
||||||
|
|
@ -379,6 +393,9 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bm.optmask)
|
||||||
|
addattr_l(n, 1024, IFLA_BR_MULTI_BOOLOPT,
|
||||||
|
&bm, sizeof(bm));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -559,6 +576,18 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
|
||||||
"mcast_snooping %u ",
|
"mcast_snooping %u ",
|
||||||
rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING]));
|
rta_getattr_u8(tb[IFLA_BR_MCAST_SNOOPING]));
|
||||||
|
|
||||||
|
if (tb[IFLA_BR_MULTI_BOOLOPT]) {
|
||||||
|
__u32 mcvl_bit = 1 << BR_BOOLOPT_MCAST_VLAN_SNOOPING;
|
||||||
|
struct br_boolopt_multi *bm;
|
||||||
|
|
||||||
|
bm = RTA_DATA(tb[IFLA_BR_MULTI_BOOLOPT]);
|
||||||
|
if (bm->optmask & mcvl_bit)
|
||||||
|
print_uint(PRINT_ANY,
|
||||||
|
"mcast_vlan_snooping",
|
||||||
|
"mcast_vlan_snooping %u ",
|
||||||
|
!!(bm->optval & mcvl_bit));
|
||||||
|
}
|
||||||
|
|
||||||
if (tb[IFLA_BR_MCAST_ROUTER])
|
if (tb[IFLA_BR_MCAST_ROUTER])
|
||||||
print_uint(PRINT_ANY,
|
print_uint(PRINT_ANY,
|
||||||
"mcast_router",
|
"mcast_router",
|
||||||
|
|
|
||||||
|
|
@ -1492,6 +1492,8 @@ the following additional arguments are supported:
|
||||||
] [
|
] [
|
||||||
.BI mcast_snooping " MULTICAST_SNOOPING "
|
.BI mcast_snooping " MULTICAST_SNOOPING "
|
||||||
] [
|
] [
|
||||||
|
.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING "
|
||||||
|
] [
|
||||||
.BI mcast_router " MULTICAST_ROUTER "
|
.BI mcast_router " MULTICAST_ROUTER "
|
||||||
] [
|
] [
|
||||||
.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR "
|
.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR "
|
||||||
|
|
@ -1614,6 +1616,12 @@ per-VLAN per-port stats accounting. Can be changed only when there are no port V
|
||||||
or off
|
or off
|
||||||
.RI ( MULTICAST_SNOOPING " == 0). "
|
.RI ( MULTICAST_SNOOPING " == 0). "
|
||||||
|
|
||||||
|
.BI mcast_vlan_snooping " MULTICAST_VLAN_SNOOPING "
|
||||||
|
- turn multicast VLAN snooping on
|
||||||
|
.RI ( MULTICAST_VLAN_SNOOPING " > 0) "
|
||||||
|
or off
|
||||||
|
.RI ( MULTICAST_VLAN_SNOOPING " == 0). "
|
||||||
|
|
||||||
.BI mcast_router " MULTICAST_ROUTER "
|
.BI mcast_router " MULTICAST_ROUTER "
|
||||||
- set bridge's multicast router if IGMP snooping is enabled.
|
- set bridge's multicast router if IGMP snooping is enabled.
|
||||||
.I MULTICAST_ROUTER
|
.I MULTICAST_ROUTER
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue