diff mbox

bridge: don't flood multicast packets if no snooping entry

Message ID 1350004643-3786-1-git-send-email-minggr@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Lin Ming Oct. 12, 2012, 1:17 a.m. UTC
From: Lin Ming <mlin@ss.pku.edu.cn>

Currently, multicast packets will be flood even if there is no
mutlicast snooping entry attached to port.

With IGMP snooping enabled, we should stop sending multicast packets
if there is no member joined.

Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
---
 net/bridge/br_input.c   |    2 ++
 net/bridge/br_private.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

Comments

Herbert Xu Oct. 12, 2012, 1:48 a.m. UTC | #1
On Fri, Oct 12, 2012 at 09:17:23AM +0800, Lin Ming wrote:
> From: Lin Ming <mlin@ss.pku.edu.cn>
> 
> Currently, multicast packets will be flood even if there is no
> mutlicast snooping entry attached to port.
> 
> With IGMP snooping enabled, we should stop sending multicast packets
> if there is no member joined.

Hmm, the default is deliberately this way so that we don't disrupt
traffic when we boot up.  If you want to stop flooding unknown groups
by default you have to make it an option.

Cheers,
Lin Ming Oct. 12, 2012, 2:14 a.m. UTC | #2
On Fri, Oct 12, 2012 at 9:48 AM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> On Fri, Oct 12, 2012 at 09:17:23AM +0800, Lin Ming wrote:
>> From: Lin Ming <mlin@ss.pku.edu.cn>
>>
>> Currently, multicast packets will be flood even if there is no
>> mutlicast snooping entry attached to port.
>>
>> With IGMP snooping enabled, we should stop sending multicast packets
>> if there is no member joined.
>
> Hmm, the default is deliberately this way so that we don't disrupt
> traffic when we boot up.  If you want to stop flooding unknown groups
> by default you have to make it an option.

Do you mean adding a sysfs entry, for example
/sys/class/net/br0/bridge/multicast_no_flood ?

Thanks.

>
> Cheers,
--
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
Herbert Xu Oct. 12, 2012, 2:27 a.m. UTC | #3
On Fri, Oct 12, 2012 at 10:14:00AM +0800, Lin Ming wrote:
>
> Do you mean adding a sysfs entry, for example
> /sys/class/net/br0/bridge/multicast_no_flood ?

Yes something like that.

Cheers,
Lin Ming Oct. 12, 2012, 5:19 a.m. UTC | #4
On Fri, Oct 12, 2012 at 10:27 AM, Herbert Xu
<herbert@gondor.apana.org.au> wrote:
> On Fri, Oct 12, 2012 at 10:14:00AM +0800, Lin Ming wrote:
>>
>> Do you mean adding a sysfs entry, for example
>> /sys/class/net/br0/bridge/multicast_no_flood ?
>
> Yes something like that.

Or a better name: multicast_fast_leave

Quote from Internet:
"
IGMP Fast Leave enhances your control over router or switch bandwidth.
Enabling Fast Leave tells IGMP snooping to stop the transmission of a
group multicast stream to a port as soon as it receives a Leave message
on that port. No timeouts are observed.

Ordinarily, when IGMP snooping sees a Leave message, it waits for a
Membership Query message before setting the entry timeout to 2 seconds.
Fast Leave tells IGMP to drop the entry from the port as soon as the
Leave message is seen. For this reason, Fast Leave should only be
configured on interfaces that have one client per port.
"

I'm going to add fast leave support. It would need other changes in
addition to this patch.

Thanks.

>
> Cheers,
--
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_input.c b/net/bridge/br_input.c
index 76f15fd..2821085 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -90,6 +90,8 @@  int br_handle_frame_finish(struct sk_buff *skb)
 			skb = NULL;
 			if (!skb2)
 				goto out;
+		} else if (!mdst && BR_INPUT_SKB_CB_NOT_IGMP(skb)) {
+			skb = NULL;
 		} else
 			skb2 = skb;
 
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 9b278c4..e2c894d 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -268,8 +268,10 @@  struct br_input_skb_cb {
 
 #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
 # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb)	(BR_INPUT_SKB_CB(__skb)->mrouters_only)
+# define BR_INPUT_SKB_CB_NOT_IGMP(__skb)	(!BR_INPUT_SKB_CB(__skb)->igmp)
 #else
 # define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb)	(0)
+# define BR_INPUT_SKB_CB_NOT_IGMP(__skb)	(0)
 #endif
 
 #define br_printk(level, br, format, args...)	\