diff mbox

[net-next] bridge: mcast: when multicast is disabled flush the groups

Message ID 1437560929-25827-1-git-send-email-nikolay@cumulusnetworks.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Nikolay Aleksandrov July 22, 2015, 10:28 a.m. UTC
From: Satish Ashok <sashok@cumulusnetworks.com>

Once multicast gets disabled we should flush the groups.
Example:
# bridge mdb add dev br0 port eth3 grp 239.0.0.1
# bridge mdb
dev br0 port eth3 grp 239.0.0.1 temp
# echo 0 > multicast_snooping
# bridge mdb

Signed-off-by: Satish Ashok <sashok@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
---
 net/bridge/br_multicast.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Cong Wang July 22, 2015, 5:03 p.m. UTC | #1
On Wed, Jul 22, 2015 at 3:28 AM, Nikolay Aleksandrov
<nikolay@cumulusnetworks.com> wrote:
> From: Satish Ashok <sashok@cumulusnetworks.com>
>
> Once multicast gets disabled we should flush the groups.
> Example:
> # bridge mdb add dev br0 port eth3 grp 239.0.0.1
> # bridge mdb
> dev br0 port eth3 grp 239.0.0.1 temp
> # echo 0 > multicast_snooping
> # bridge mdb

Why? Why we can't save the mdb config for a mcast snooping flip?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nikolay Aleksandrov July 22, 2015, 6:01 p.m. UTC | #2
On 07/22/2015 07:03 PM, Cong Wang wrote:
> On Wed, Jul 22, 2015 at 3:28 AM, Nikolay Aleksandrov
> <nikolay@cumulusnetworks.com> wrote:
>> From: Satish Ashok <sashok@cumulusnetworks.com>
>>
>> Once multicast gets disabled we should flush the groups.
>> Example:
>> # bridge mdb add dev br0 port eth3 grp 239.0.0.1
>> # bridge mdb
>> dev br0 port eth3 grp 239.0.0.1 temp
>> # echo 0 > multicast_snooping
>> # bridge mdb
> 
> Why? Why we can't save the mdb config for a mcast snooping flip?
> 

Right, I've discussed this with my colleagues and we think this doesn't have any
value for upstream and shouldn't have been sent which is bad judgment on my side.
It actually makes things worse because it removes the user's permanent entries on
snooping disable and it may happen automatically by hash exhaustion.

Anyway, please drop this patch and sorry for the noise, I should've given this
change more thought.

Thanks,
 Nik
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 0dd3cd90962c..cf79bfc16e30 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -39,6 +39,7 @@  static void br_multicast_start_querier(struct net_bridge *br,
 				       struct bridge_mcast_own_query *query);
 static void br_multicast_add_router(struct net_bridge *br,
 				    struct net_bridge_port *port);
+static void br_multicast_del_grps(struct net_bridge *br);
 unsigned int br_mdb_rehash_seq;
 
 static inline int br_ip_equal(const struct br_ip *a, const struct br_ip *b)
@@ -553,6 +554,7 @@  static struct net_bridge_mdb_entry *br_multicast_get_group(
 			err = -E2BIG;
 disable:
 			br->multicast_disabled = 1;
+			br_multicast_del_grps(br);
 			goto err;
 		}
 	}
@@ -1866,6 +1868,17 @@  static void br_multicast_start_querier(struct net_bridge *br,
 	}
 }
 
+static void br_multicast_del_grps(struct net_bridge *br)
+{
+	struct net_bridge_port *port, *bn;
+	struct net_bridge_port_group *pg;
+	struct hlist_node *n;
+
+	list_for_each_entry_safe(port, bn, &br->port_list, list)
+		hlist_for_each_entry_safe(pg, n, &port->mglist, mglist)
+			br_multicast_del_pg(br, pg);
+}
+
 int br_multicast_toggle(struct net_bridge *br, unsigned long val)
 {
 	int err = 0;
@@ -1876,8 +1889,10 @@  int br_multicast_toggle(struct net_bridge *br, unsigned long val)
 		goto unlock;
 
 	br->multicast_disabled = !val;
-	if (br->multicast_disabled)
+	if (br->multicast_disabled) {
+		br_multicast_del_grps(br);
 		goto unlock;
+	}
 
 	if (!netif_running(br->dev))
 		goto unlock;