net: bridge: add per-port multicast flood flag
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Wed, 31 Aug 2016 13:36:52 +0000 (15:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Sep 2016 05:48:33 +0000 (22:48 -0700)
Add a per-port flag to control the unknown multicast flood, similar to the
unknown unicast flood flag and break a few long lines in the netlink flag
exports.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/if_bridge.h
include/uapi/linux/if_link.h
net/bridge/br_forward.c
net/bridge/br_if.c
net/bridge/br_netlink.c
net/bridge/br_sysfs_if.c

index dcb89e3515db93d0359b726d60eccca918a0a707..c6587c01d9514b0074e3a63e40ce951f93178d4b 100644 (file)
@@ -45,6 +45,7 @@ struct br_ip_list {
 #define BR_PROXYARP            BIT(8)
 #define BR_LEARNING_SYNC       BIT(9)
 #define BR_PROXYARP_WIFI       BIT(10)
+#define BR_MCAST_FLOOD         BIT(11)
 
 #define BR_DEFAULT_AGEING_TIME (300 * HZ)
 
index a1b5202c5f6b69e81f8321af46cc3e536bf5770d..9bf3aecfe05b6f154bda36df1ad7443420d559b4 100644 (file)
@@ -318,6 +318,7 @@ enum {
        IFLA_BRPORT_FLUSH,
        IFLA_BRPORT_MULTICAST_ROUTER,
        IFLA_BRPORT_PAD,
+       IFLA_BRPORT_MCAST_FLOOD,
        __IFLA_BRPORT_MAX
 };
 #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
index 5de854ed334036a34cf0ffc5b7db0a03bf676719..7cb41aee4c82e63b4f278e64564c3ab7e8db3e10 100644 (file)
@@ -186,6 +186,9 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb,
                /* Do not flood unicast traffic to ports that turn it off */
                if (pkt_type == BR_PKT_UNICAST && !(p->flags & BR_FLOOD))
                        continue;
+               if (pkt_type == BR_PKT_MULTICAST &&
+                   !(p->flags & BR_MCAST_FLOOD))
+                       continue;
 
                /* Do not flood to ports that enable proxy ARP */
                if (p->flags & BR_PROXYARP)
index 1da3221845f1f0f316fc9b65950475686aaf5720..ed0dd334008439b2283b9247fbda86b5bf6b64c4 100644 (file)
@@ -362,7 +362,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
        p->path_cost = port_cost(dev);
        p->priority = 0x8000 >> BR_PORT_BITS;
        p->port_no = index;
-       p->flags = BR_LEARNING | BR_FLOOD;
+       p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD;
        br_init_port(p);
        br_set_state(p, BR_STATE_DISABLED);
        br_stp_port_timer_init(p);
index 190a5bc00f4a3896e449a91b2b0e66d7adc5f35c..e99037c6f7b7b7e1073375d320f4fb186c4e8b38 100644 (file)
@@ -169,10 +169,15 @@ static int br_port_fill_attrs(struct sk_buff *skb,
            nla_put_u32(skb, IFLA_BRPORT_COST, p->path_cost) ||
            nla_put_u8(skb, IFLA_BRPORT_MODE, mode) ||
            nla_put_u8(skb, IFLA_BRPORT_GUARD, !!(p->flags & BR_BPDU_GUARD)) ||
-           nla_put_u8(skb, IFLA_BRPORT_PROTECT, !!(p->flags & BR_ROOT_BLOCK)) ||
-           nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE, !!(p->flags & BR_MULTICAST_FAST_LEAVE)) ||
+           nla_put_u8(skb, IFLA_BRPORT_PROTECT,
+                      !!(p->flags & BR_ROOT_BLOCK)) ||
+           nla_put_u8(skb, IFLA_BRPORT_FAST_LEAVE,
+                      !!(p->flags & BR_MULTICAST_FAST_LEAVE)) ||
            nla_put_u8(skb, IFLA_BRPORT_LEARNING, !!(p->flags & BR_LEARNING)) ||
-           nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD, !!(p->flags & BR_FLOOD)) ||
+           nla_put_u8(skb, IFLA_BRPORT_UNICAST_FLOOD,
+                      !!(p->flags & BR_FLOOD)) ||
+           nla_put_u8(skb, IFLA_BRPORT_MCAST_FLOOD,
+                      !!(p->flags & BR_MCAST_FLOOD)) ||
            nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)) ||
            nla_put_u8(skb, IFLA_BRPORT_PROXYARP_WIFI,
                       !!(p->flags & BR_PROXYARP_WIFI)) ||
@@ -630,6 +635,7 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[])
        br_set_port_flag(p, tb, IFLA_BRPORT_PROTECT, BR_ROOT_BLOCK);
        br_set_port_flag(p, tb, IFLA_BRPORT_LEARNING, BR_LEARNING);
        br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD);
+       br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD);
        br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP);
        br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI);
 
index 1e04d4d44273f50e60c4eee4b3d40d63a1f03500..e657258e1f2cd0f6d43084cc447e384a6850f290 100644 (file)
@@ -171,6 +171,7 @@ BRPORT_ATTR_FLAG(learning, BR_LEARNING);
 BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD);
 BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP);
 BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI);
+BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD);
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)