forked from mirrors/linux
		
	net: bridge: add per-port multicast flood flag
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>
This commit is contained in:
		
							parent
							
								
									8addd5e7d3
								
							
						
					
					
						commit
						b6cb5ac833
					
				
					 6 changed files with 16 additions and 4 deletions
				
			
		|  | @ -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) | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -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); | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Nikolay Aleksandrov
						Nikolay Aleksandrov