From: Felix Fietkau Date: Wed, 2 Sep 2015 09:23:59 +0000 (+0000) Subject: kernel: bridge, multicast-to-unicast: fix echoes on STA X-Git-Tag: v19.07.0-rc1~12809 X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=2416e506f5fd4a58bb25a6e24cb7fde56e281711;p=openwrt%2Fstaging%2Fhauke.git kernel: bridge, multicast-to-unicast: fix echoes on STA Currently, multicast packets from an STA are sent to any according multicast listener directly through the bridge multicast-to-unicast feature. Unfortunately, so far this includes the originating STA, too, resulting in multicast packets being echo'ed back to the originating STA if it itself is a multicast listener for that group. This behaviour breaks IPv6 duplicate address detection: An IPv6 Neighbor Solicitation for IPv6 Duplicate Address Detection is being echo'ed back, resulting in the host falsely detecting an address collision, which makes the node unable to claim an IPv6 address and use IPv6 in general. Mac80211 unfortunately only prevents the echoes for us for multicast frames. For the multicast frames cast to a unicast destination we'll need to take care of excluding the originator ourselves. Signed-off-by: Linus Lüssing SVN-Revision: 46765 --- diff --git a/target/linux/generic/patches-3.18/645-bridge_multicast_to_unicast.patch b/target/linux/generic/patches-3.18/645-bridge_multicast_to_unicast.patch index 1e070d9d9c..a40abb5c68 100644 --- a/target/linux/generic/patches-3.18/645-bridge_multicast_to_unicast.patch +++ b/target/linux/generic/patches-3.18/645-bridge_multicast_to_unicast.patch @@ -133,7 +133,7 @@ if (err) break; } -@@ -1407,7 +1433,8 @@ br_multicast_leave_group(struct net_brid +@@ -1406,7 +1432,8 @@ br_multicast_leave_group(struct net_brid struct net_bridge_port *port, struct br_ip *group, struct bridge_mcast_other_query *other_query, @@ -143,7 +143,7 @@ { struct net_bridge_mdb_htable *mdb; struct net_bridge_mdb_entry *mp; -@@ -1457,7 +1484,7 @@ br_multicast_leave_group(struct net_brid +@@ -1456,7 +1483,7 @@ br_multicast_leave_group(struct net_brid for (pp = &mp->ports; (p = mlock_dereference(*pp, br)) != NULL; pp = &p->next) { @@ -152,7 +152,7 @@ continue; rcu_assign_pointer(*pp, p->next); -@@ -1491,7 +1518,7 @@ br_multicast_leave_group(struct net_brid +@@ -1490,7 +1517,7 @@ br_multicast_leave_group(struct net_brid for (p = mlock_dereference(mp->ports, br); p != NULL; p = mlock_dereference(p->next, br)) { @@ -161,7 +161,7 @@ continue; if (!hlist_unhashed(&p->mglist) && -@@ -1509,8 +1536,8 @@ out: +@@ -1508,8 +1535,8 @@ out: static void br_ip4_multicast_leave_group(struct net_bridge *br, struct net_bridge_port *port, @@ -172,7 +172,7 @@ { struct br_ip br_group; struct bridge_mcast_own_query *own_query; -@@ -1525,14 +1552,14 @@ static void br_ip4_multicast_leave_group +@@ -1524,14 +1551,14 @@ static void br_ip4_multicast_leave_group br_group.vid = vid; br_multicast_leave_group(br, port, &br_group, &br->ip4_other_query, @@ -189,7 +189,7 @@ { struct br_ip br_group; struct bridge_mcast_own_query *own_query; -@@ -1547,7 +1574,7 @@ static void br_ip6_multicast_leave_group +@@ -1546,7 +1573,7 @@ static void br_ip6_multicast_leave_group br_group.vid = vid; br_multicast_leave_group(br, port, &br_group, &br->ip6_other_query, @@ -198,7 +198,7 @@ } #endif -@@ -1556,6 +1583,7 @@ static int br_multicast_ipv4_rcv(struct +@@ -1555,6 +1582,7 @@ static int br_multicast_ipv4_rcv(struct struct sk_buff *skb, u16 vid) { @@ -206,7 +206,7 @@ struct sk_buff *skb2 = skb; const struct iphdr *iph; struct igmphdr *ih; -@@ -1629,7 +1657,8 @@ static int br_multicast_ipv4_rcv(struct +@@ -1628,7 +1656,8 @@ static int br_multicast_ipv4_rcv(struct case IGMP_HOST_MEMBERSHIP_REPORT: case IGMPV2_HOST_MEMBERSHIP_REPORT: BR_INPUT_SKB_CB(skb)->mrouters_only = 1; @@ -216,7 +216,7 @@ break; case IGMPV3_HOST_MEMBERSHIP_REPORT: err = br_ip4_multicast_igmp3_report(br, port, skb2, vid); -@@ -1638,7 +1667,8 @@ static int br_multicast_ipv4_rcv(struct +@@ -1637,7 +1666,8 @@ static int br_multicast_ipv4_rcv(struct err = br_ip4_multicast_query(br, port, skb2, vid); break; case IGMP_HOST_LEAVE_MESSAGE: @@ -226,7 +226,7 @@ break; } -@@ -1656,6 +1686,7 @@ static int br_multicast_ipv6_rcv(struct +@@ -1655,6 +1685,7 @@ static int br_multicast_ipv6_rcv(struct struct sk_buff *skb, u16 vid) { @@ -234,7 +234,7 @@ struct sk_buff *skb2; const struct ipv6hdr *ip6h; u8 icmp6_type; -@@ -1765,7 +1796,9 @@ static int br_multicast_ipv6_rcv(struct +@@ -1764,7 +1795,9 @@ static int br_multicast_ipv6_rcv(struct } mld = (struct mld_msg *)skb_transport_header(skb2); BR_INPUT_SKB_CB(skb)->mrouters_only = 1; @@ -245,7 +245,7 @@ break; } case ICMPV6_MLD2_REPORT: -@@ -1782,7 +1815,8 @@ static int br_multicast_ipv6_rcv(struct +@@ -1781,7 +1814,8 @@ static int br_multicast_ipv6_rcv(struct goto out; } mld = (struct mld_msg *)skb_transport_header(skb2); @@ -298,7 +298,7 @@ rcu_assign_pointer(*pp, p); --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c -@@ -168,6 +168,29 @@ out: +@@ -168,6 +168,34 @@ out: return p; } @@ -309,10 +309,15 @@ + struct sk_buff *skb)) +{ + struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; ++ const unsigned char *src = eth_hdr(skb)->h_source; + + if (!should_deliver(p, skb)) + return prev; + ++ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ ++ if (skb->dev == p->dev && ether_addr_equal(src, addr)) ++ return prev; ++ + skb = skb_copy(skb, GFP_ATOMIC); + if (!skb) { + dev->stats.tx_dropped++; @@ -328,7 +333,7 @@ /* called under bridge lock */ static void br_flood(struct net_bridge *br, struct sk_buff *skb, struct sk_buff *skb0, -@@ -232,6 +255,7 @@ static void br_multicast_flood(struct ne +@@ -232,6 +260,7 @@ static void br_multicast_flood(struct ne struct net_bridge_port *prev = NULL; struct net_bridge_port_group *p; struct hlist_node *rp; @@ -336,7 +341,7 @@ rp = rcu_dereference(hlist_first_rcu(&br->router_list)); p = mdst ? rcu_dereference(mdst->ports) : NULL; -@@ -242,10 +266,19 @@ static void br_multicast_flood(struct ne +@@ -242,10 +271,19 @@ static void br_multicast_flood(struct ne rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : NULL; diff --git a/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch b/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch index 6915599c6c..bbd8e25447 100644 --- a/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch +++ b/target/linux/generic/patches-4.1/645-bridge_multicast_to_unicast.patch @@ -305,7 +305,7 @@ rcu_assign_pointer(*pp, p); --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c -@@ -169,6 +169,29 @@ out: +@@ -169,6 +169,34 @@ out: return p; } @@ -316,10 +316,15 @@ + struct sk_buff *skb)) +{ + struct net_device *dev = BR_INPUT_SKB_CB(skb)->brdev; ++ const unsigned char *src = eth_hdr(skb)->h_source; + + if (!should_deliver(p, skb)) + return prev; + ++ /* Even with hairpin, no soliloquies - prevent breaking IPv6 DAD */ ++ if (skb->dev == p->dev && ether_addr_equal(src, addr)) ++ return prev; ++ + skb = skb_copy(skb, GFP_ATOMIC); + if (!skb) { + dev->stats.tx_dropped++; @@ -335,7 +340,7 @@ /* called under bridge lock */ static void br_flood(struct net_bridge *br, struct sk_buff *skb, struct sk_buff *skb0, -@@ -241,6 +264,7 @@ static void br_multicast_flood(struct ne +@@ -241,6 +269,7 @@ static void br_multicast_flood(struct ne struct net_bridge_port *prev = NULL; struct net_bridge_port_group *p; struct hlist_node *rp; @@ -343,7 +348,7 @@ rp = rcu_dereference(hlist_first_rcu(&br->router_list)); p = mdst ? rcu_dereference(mdst->ports) : NULL; -@@ -251,10 +275,19 @@ static void br_multicast_flood(struct ne +@@ -251,10 +280,19 @@ static void br_multicast_flood(struct ne rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) : NULL;