public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bridge: don't flood multicast packets if no snooping entry
@ 2012-10-12  1:17 Lin Ming
  2012-10-12  1:48 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Lin Ming @ 2012-10-12  1:17 UTC (permalink / raw)
  To: Herbert Xu; +Cc: netdev

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

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...)	\
-- 
1.7.2.5

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

end of thread, other threads:[~2012-10-12  5:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-12  1:17 [PATCH] bridge: don't flood multicast packets if no snooping entry Lin Ming
2012-10-12  1:48 ` Herbert Xu
2012-10-12  2:14   ` Lin Ming
2012-10-12  2:27     ` Herbert Xu
2012-10-12  5:19       ` Lin Ming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox