1 --- a/net/bridge/br_private.h
2 +++ b/net/bridge/br_private.h
3 @@ -157,6 +157,7 @@ struct net_bridge_port
4 #define BR_ROOT_BLOCK 0x00000004
5 #define BR_MULTICAST_FAST_LEAVE 0x00000008
6 #define BR_ADMIN_COST 0x00000010
7 +#define BR_ISOLATE_MODE 0x00000020
9 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
10 u32 multicast_startup_queries_sent;
11 --- a/net/bridge/br_sysfs_if.c
12 +++ b/net/bridge/br_sysfs_if.c
13 @@ -159,6 +159,22 @@ BRPORT_ATTR_FLAG(hairpin_mode, BR_HAIRPI
14 BRPORT_ATTR_FLAG(bpdu_guard, BR_BPDU_GUARD);
15 BRPORT_ATTR_FLAG(root_block, BR_ROOT_BLOCK);
17 +static ssize_t show_isolate_mode(struct net_bridge_port *p, char *buf)
19 + int isolate_mode = (p->flags & BR_ISOLATE_MODE) ? 1 : 0;
20 + return sprintf(buf, "%d\n", isolate_mode);
22 +static ssize_t store_isolate_mode(struct net_bridge_port *p, unsigned long v)
25 + p->flags |= BR_ISOLATE_MODE;
27 + p->flags &= ~BR_ISOLATE_MODE;
30 +static BRPORT_ATTR(isolate_mode, S_IRUGO | S_IWUSR,
31 + show_isolate_mode, store_isolate_mode);
33 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
34 static ssize_t show_multicast_router(struct net_bridge_port *p, char *buf)
36 @@ -199,6 +215,7 @@ static const struct brport_attribute *br
37 &brport_attr_multicast_router,
38 &brport_attr_multicast_fast_leave,
40 + &brport_attr_isolate_mode,
44 --- a/net/bridge/br_input.c
45 +++ b/net/bridge/br_input.c
46 @@ -114,8 +114,8 @@ int br_handle_frame_finish(struct sk_buf
49 br->dev->stats.multicast++;
50 - } else if ((dst = __br_fdb_get(br, dest, vid)) &&
52 + } else if ((p->flags & BR_ISOLATE_MODE) ||
53 + ((dst = __br_fdb_get(br, dest, vid)) && dst->is_local)) {
55 /* Do not forward the packet since it's local. */
57 --- a/net/bridge/br_forward.c
58 +++ b/net/bridge/br_forward.c
59 @@ -119,7 +119,7 @@ void br_deliver(const struct net_bridge_
60 /* called with rcu_read_lock */
61 void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0)
63 - if (should_deliver(to, skb)) {
64 + if (should_deliver(to, skb) && !(to->flags & BR_ISOLATE_MODE)) {
66 deliver_clone(to, skb, __br_forward);
68 @@ -174,7 +174,8 @@ out:
69 static void br_flood(struct net_bridge *br, struct sk_buff *skb,
71 void (*__packet_hook)(const struct net_bridge_port *p,
72 - struct sk_buff *skb))
73 + struct sk_buff *skb),
76 struct net_bridge_port *p;
77 struct net_bridge_port *prev;
78 @@ -182,6 +183,9 @@ static void br_flood(struct net_bridge *
81 list_for_each_entry_rcu(p, &br->port_list, list) {
82 + if (forward && (p->flags & BR_ISOLATE_MODE))
85 prev = maybe_deliver(prev, p, skb, __packet_hook);
88 @@ -205,14 +209,14 @@ out:
89 /* called with rcu_read_lock */
90 void br_flood_deliver(struct net_bridge *br, struct sk_buff *skb)
92 - br_flood(br, skb, NULL, __br_deliver);
93 + br_flood(br, skb, NULL, __br_deliver, false);
96 /* called under bridge lock */
97 void br_flood_forward(struct net_bridge *br, struct sk_buff *skb,
100 - br_flood(br, skb, skb2, __br_forward);
101 + br_flood(br, skb, skb2, __br_forward, true);
104 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING