bridge br_multicast: Don't refer to BR_INPUT_SKB_CB(skb)->mrouters_only without IGMP...
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Mon, 15 Mar 2010 21:51:18 +0000 (21:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Mar 2010 21:34:23 +0000 (14:34 -0700)
Without CONFIG_BRIDGE_IGMP_SNOOPING,
BR_INPUT_SKB_CB(skb)->mrouters_only is not appropriately
initialized, so we can see garbage.

A clear option to fix this is to set it even without that
config, but we cannot optimize out the branch.

Let's introduce a macro that returns value of mrouters_only
and let it return 0 without CONFIG_BRIDGE_IGMP_SNOOPING.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_device.c
net/bridge/br_input.c
net/bridge/br_private.h

index eb7062d2e9e5d28168fe2dcbdc3ec2f44bc9f4c9..90a9024e5c1eaf30713258c4d32151a89cc87c06 100644 (file)
@@ -40,7 +40,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
                        goto out;
 
                mdst = br_mdb_get(br, skb);
-               if (mdst || BR_INPUT_SKB_CB(skb)->mrouters_only)
+               if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb))
                        br_multicast_deliver(mdst, skb);
                else
                        br_flood_deliver(br, skb);
index 08a72e63fb8e99cfaefc8c6b58c9809b62cfeba7..d74d570fc848537b437b24aa696285afef90543c 100644 (file)
@@ -70,7 +70,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
 
        if (is_multicast_ether_addr(dest)) {
                mdst = br_mdb_get(br, skb);
-               if (mdst || BR_INPUT_SKB_CB(skb)->mrouters_only) {
+               if (mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) {
                        if ((mdst && !hlist_unhashed(&mdst->mglist)) ||
                            br_multicast_is_router(br))
                                skb2 = skb;
index bfb8feb310a6e46a4cb146d54eefbfcabf5cb3cc..846d7d1e2075d1ffb7821c3244441203b0a8d726 100644 (file)
@@ -206,12 +206,20 @@ struct net_bridge
 
 struct br_input_skb_cb {
        struct net_device *brdev;
+#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
        int igmp;
        int mrouters_only;
+#endif
 };
 
 #define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb)
 
+#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
+# define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb)  (BR_INPUT_SKB_CB(__skb)->mrouters_only)
+#else
+# define BR_INPUT_SKB_CB_MROUTERS_ONLY(__skb)  (0)
+#endif
+
 extern struct notifier_block br_device_notifier;
 extern const u8 br_group_address[ETH_ALEN];