All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
@ 2015-07-22 10:28 ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-22 10:28 UTC (permalink / raw)
  To: netdev; +Cc: bridge, Nikolay Aleksandrov, davem

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(-)

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;
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
@ 2015-07-22 10:28 ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-22 10:28 UTC (permalink / raw)
  To: netdev; +Cc: bridge, Nikolay Aleksandrov, davem

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(-)

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;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Bridge] [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
  2015-07-22 10:28 ` Nikolay Aleksandrov
@ 2015-07-22 17:03   ` Cong Wang
  -1 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2015-07-22 17:03 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: netdev, bridge@lists.linux-foundation.org, David Miller

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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
@ 2015-07-22 17:03   ` Cong Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Cong Wang @ 2015-07-22 17:03 UTC (permalink / raw)
  To: Nikolay Aleksandrov
  Cc: netdev, bridge@lists.linux-foundation.org, David Miller,
	Stephen Hemminger, Satish Ashok

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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Bridge] [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
  2015-07-22 17:03   ` Cong Wang
@ 2015-07-22 18:01     ` Nikolay Aleksandrov
  -1 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-22 18:01 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, bridge@lists.linux-foundation.org, David Miller

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups
@ 2015-07-22 18:01     ` Nikolay Aleksandrov
  0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-07-22 18:01 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, bridge@lists.linux-foundation.org, David Miller

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-22 18:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 10:28 [Bridge] [PATCH net-next] bridge: mcast: when multicast is disabled flush the groups Nikolay Aleksandrov
2015-07-22 10:28 ` Nikolay Aleksandrov
2015-07-22 17:03 ` [Bridge] " Cong Wang
2015-07-22 17:03   ` Cong Wang
2015-07-22 18:01   ` [Bridge] " Nikolay Aleksandrov
2015-07-22 18:01     ` Nikolay Aleksandrov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.