Commit 32dec5dd authored by YOSHIFUJI Hideaki / 吉藤英明's avatar YOSHIFUJI Hideaki / 吉藤英明 Committed by David S. Miller

bridge br_multicast: Don't refer to BR_INPUT_SKB_CB(skb)->mrouters_only without IGMP snooping.

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: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 858a18a6
...@@ -40,7 +40,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -40,7 +40,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
goto out; goto out;
mdst = br_mdb_get(br, skb); 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); br_multicast_deliver(mdst, skb);
else else
br_flood_deliver(br, skb); br_flood_deliver(br, skb);
......
...@@ -70,7 +70,7 @@ int br_handle_frame_finish(struct sk_buff *skb) ...@@ -70,7 +70,7 @@ int br_handle_frame_finish(struct sk_buff *skb)
if (is_multicast_ether_addr(dest)) { if (is_multicast_ether_addr(dest)) {
mdst = br_mdb_get(br, skb); 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)) || if ((mdst && !hlist_unhashed(&mdst->mglist)) ||
br_multicast_is_router(br)) br_multicast_is_router(br))
skb2 = skb; skb2 = skb;
......
...@@ -206,12 +206,20 @@ struct net_bridge ...@@ -206,12 +206,20 @@ struct net_bridge
struct br_input_skb_cb { struct br_input_skb_cb {
struct net_device *brdev; struct net_device *brdev;
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
int igmp; int igmp;
int mrouters_only; int mrouters_only;
#endif
}; };
#define BR_INPUT_SKB_CB(__skb) ((struct br_input_skb_cb *)(__skb)->cb) #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 struct notifier_block br_device_notifier;
extern const u8 br_group_address[ETH_ALEN]; extern const u8 br_group_address[ETH_ALEN];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment