diff options
-rw-r--r-- | include/linux/if_bridge.h | 1 | ||||
-rw-r--r-- | include/uapi/linux/if_link.h | 1 | ||||
-rw-r--r-- | net/bridge/br_forward.c | 24 | ||||
-rw-r--r-- | net/bridge/br_if.c | 2 | ||||
-rw-r--r-- | net/bridge/br_netlink.c | 3 | ||||
-rw-r--r-- | net/bridge/br_sysfs_if.c | 2 |
6 files changed, 25 insertions, 8 deletions
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index c5847dc75a93..0c16866a7aac 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h | |||
@@ -48,6 +48,7 @@ struct br_ip_list { | |||
48 | #define BR_MCAST_FLOOD BIT(11) | 48 | #define BR_MCAST_FLOOD BIT(11) |
49 | #define BR_MULTICAST_TO_UNICAST BIT(12) | 49 | #define BR_MULTICAST_TO_UNICAST BIT(12) |
50 | #define BR_VLAN_TUNNEL BIT(13) | 50 | #define BR_VLAN_TUNNEL BIT(13) |
51 | #define BR_BCAST_FLOOD BIT(14) | ||
51 | 52 | ||
52 | #define BR_DEFAULT_AGEING_TIME (300 * HZ) | 53 | #define BR_DEFAULT_AGEING_TIME (300 * HZ) |
53 | 54 | ||
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 633aa0276d32..8e56ac70e0d1 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
@@ -323,6 +323,7 @@ enum { | |||
323 | IFLA_BRPORT_MCAST_FLOOD, | 323 | IFLA_BRPORT_MCAST_FLOOD, |
324 | IFLA_BRPORT_MCAST_TO_UCAST, | 324 | IFLA_BRPORT_MCAST_TO_UCAST, |
325 | IFLA_BRPORT_VLAN_TUNNEL, | 325 | IFLA_BRPORT_VLAN_TUNNEL, |
326 | IFLA_BRPORT_BCAST_FLOOD, | ||
326 | __IFLA_BRPORT_MAX | 327 | __IFLA_BRPORT_MAX |
327 | }; | 328 | }; |
328 | #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) | 329 | #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 902af6ba481c..48fb17417fac 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -183,13 +183,23 @@ void br_flood(struct net_bridge *br, struct sk_buff *skb, | |||
183 | struct net_bridge_port *p; | 183 | struct net_bridge_port *p; |
184 | 184 | ||
185 | list_for_each_entry_rcu(p, &br->port_list, list) { | 185 | list_for_each_entry_rcu(p, &br->port_list, list) { |
186 | /* Do not flood unicast traffic to ports that turn it off */ | 186 | /* Do not flood unicast traffic to ports that turn it off, nor |
187 | if (pkt_type == BR_PKT_UNICAST && !(p->flags & BR_FLOOD)) | 187 | * other traffic if flood off, except for traffic we originate |
188 | continue; | 188 | */ |
189 | /* Do not flood if mc off, except for traffic we originate */ | 189 | switch (pkt_type) { |
190 | if (pkt_type == BR_PKT_MULTICAST && | 190 | case BR_PKT_UNICAST: |
191 | !(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev) | 191 | if (!(p->flags & BR_FLOOD)) |
192 | continue; | 192 | continue; |
193 | break; | ||
194 | case BR_PKT_MULTICAST: | ||
195 | if (!(p->flags & BR_MCAST_FLOOD) && skb->dev != br->dev) | ||
196 | continue; | ||
197 | break; | ||
198 | case BR_PKT_BROADCAST: | ||
199 | if (!(p->flags & BR_BCAST_FLOOD) && skb->dev != br->dev) | ||
200 | continue; | ||
201 | break; | ||
202 | } | ||
193 | 203 | ||
194 | /* Do not flood to ports that enable proxy ARP */ | 204 | /* Do not flood to ports that enable proxy ARP */ |
195 | if (p->flags & BR_PROXYARP) | 205 | if (p->flags & BR_PROXYARP) |
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index f3544d96155c..7f8d05cf9065 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c | |||
@@ -361,7 +361,7 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br, | |||
361 | p->path_cost = port_cost(dev); | 361 | p->path_cost = port_cost(dev); |
362 | p->priority = 0x8000 >> BR_PORT_BITS; | 362 | p->priority = 0x8000 >> BR_PORT_BITS; |
363 | p->port_no = index; | 363 | p->port_no = index; |
364 | p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD; | 364 | p->flags = BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD | BR_BCAST_FLOOD; |
365 | br_init_port(p); | 365 | br_init_port(p); |
366 | br_set_state(p, BR_STATE_DISABLED); | 366 | br_set_state(p, BR_STATE_DISABLED); |
367 | br_stp_port_timer_init(p); | 367 | br_stp_port_timer_init(p); |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index 650986473577..a572db710d4e 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -189,6 +189,8 @@ static int br_port_fill_attrs(struct sk_buff *skb, | |||
189 | !!(p->flags & BR_FLOOD)) || | 189 | !!(p->flags & BR_FLOOD)) || |
190 | nla_put_u8(skb, IFLA_BRPORT_MCAST_FLOOD, | 190 | nla_put_u8(skb, IFLA_BRPORT_MCAST_FLOOD, |
191 | !!(p->flags & BR_MCAST_FLOOD)) || | 191 | !!(p->flags & BR_MCAST_FLOOD)) || |
192 | nla_put_u8(skb, IFLA_BRPORT_BCAST_FLOOD, | ||
193 | !!(p->flags & BR_BCAST_FLOOD)) || | ||
192 | nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)) || | 194 | nla_put_u8(skb, IFLA_BRPORT_PROXYARP, !!(p->flags & BR_PROXYARP)) || |
193 | nla_put_u8(skb, IFLA_BRPORT_PROXYARP_WIFI, | 195 | nla_put_u8(skb, IFLA_BRPORT_PROXYARP_WIFI, |
194 | !!(p->flags & BR_PROXYARP_WIFI)) || | 196 | !!(p->flags & BR_PROXYARP_WIFI)) || |
@@ -683,6 +685,7 @@ static int br_setport(struct net_bridge_port *p, struct nlattr *tb[]) | |||
683 | br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD); | 685 | br_set_port_flag(p, tb, IFLA_BRPORT_UNICAST_FLOOD, BR_FLOOD); |
684 | br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD); | 686 | br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_FLOOD, BR_MCAST_FLOOD); |
685 | br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_TO_UCAST, BR_MULTICAST_TO_UNICAST); | 687 | br_set_port_flag(p, tb, IFLA_BRPORT_MCAST_TO_UCAST, BR_MULTICAST_TO_UNICAST); |
688 | br_set_port_flag(p, tb, IFLA_BRPORT_BCAST_FLOOD, BR_BCAST_FLOOD); | ||
686 | br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP); | 689 | br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP, BR_PROXYARP); |
687 | br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI); | 690 | br_set_port_flag(p, tb, IFLA_BRPORT_PROXYARP_WIFI, BR_PROXYARP_WIFI); |
688 | 691 | ||
diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index 79aee759aba5..5d5d413a6cf8 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c | |||
@@ -173,6 +173,7 @@ BRPORT_ATTR_FLAG(unicast_flood, BR_FLOOD); | |||
173 | BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); | 173 | BRPORT_ATTR_FLAG(proxyarp, BR_PROXYARP); |
174 | BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); | 174 | BRPORT_ATTR_FLAG(proxyarp_wifi, BR_PROXYARP_WIFI); |
175 | BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); | 175 | BRPORT_ATTR_FLAG(multicast_flood, BR_MCAST_FLOOD); |
176 | BRPORT_ATTR_FLAG(broadcast_flood, BR_BCAST_FLOOD); | ||
176 | 177 | ||
177 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING | 178 | #ifdef CONFIG_BRIDGE_IGMP_SNOOPING |
178 | static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) | 179 | static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf) |
@@ -221,6 +222,7 @@ static const struct brport_attribute *brport_attrs[] = { | |||
221 | &brport_attr_proxyarp, | 222 | &brport_attr_proxyarp, |
222 | &brport_attr_proxyarp_wifi, | 223 | &brport_attr_proxyarp_wifi, |
223 | &brport_attr_multicast_flood, | 224 | &brport_attr_multicast_flood, |
225 | &brport_attr_broadcast_flood, | ||
224 | NULL | 226 | NULL |
225 | }; | 227 | }; |
226 | 228 | ||