Merge pull request #624 from ecsv/batadv-for-18.06
[feed/routing.git] / batman-adv / patches / 0050-batman-adv-mcast-TT-fix-wrongly-dropped-or-rerouted-.patch
1 From: Linus Lüssing <linus.luessing@c0d3.blue>
2 Date: Fri, 4 Sep 2020 20:28:00 +0200
3 Subject: batman-adv: mcast/TT: fix wrongly dropped or rerouted packets
4
5 The unicast packet rerouting code makes several assumptions. For
6 instance it assumes that there is always exactly one destination in the
7 TT. This breaks for multicast frames in a unicast packets in several ways:
8
9 For one thing if there is actually no TT entry and the destination node
10 was selected due to the multicast tvlv flags it announced. Then an
11 intermediate node will wrongly drop the packet.
12
13 For another thing if there is a TT entry but the TTVN of this entry is
14 newer than the originally addressed destination node: Then the
15 intermediate node will wrongly redirect the packet, leading to
16 duplicated multicast packets at a multicast listener and missing
17 packets at other multicast listeners or multicast routers.
18
19 Fixing this by not applying the unicast packet rerouting to batman-adv
20 unicast packets with a multicast payload. We are not able to detect a
21 roaming multicast listener at the moment and will just continue to send
22 the multicast frame to both the new and old destination for a while in
23 case of such a roaming multicast listener.
24
25 Fixes: cea194d90b11 ("batman-adv: improved client announcement mechanism")
26 Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
27 Signed-off-by: Sven Eckelmann <sven@narfation.org>
28
29 Origin: upstream, https://git.open-mesh.org/batman-adv.git/commit/22e740c5e6c9342e0f5028beb3d14b84a018d113
30
31 diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
32 index cc3ed93a6d513dffd4711cac50545d65ef7d640e..98af41e3810dcdf96edad8dff89d4d2b624c5d7f 100644
33 --- a/net/batman-adv/routing.c
34 +++ b/net/batman-adv/routing.c
35 @@ -838,6 +838,10 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
36 vid = batadv_get_vid(skb, hdr_len);
37 ethhdr = (struct ethhdr *)(skb->data + hdr_len);
38
39 + /* do not reroute multicast frames in a unicast header */
40 + if (is_multicast_ether_addr(ethhdr->h_dest))
41 + return true;
42 +
43 /* check if the destination client was served by this node and it is now
44 * roaming. In this case, it means that the node has got a ROAM_ADV
45 * message and that it knows the new destination in the mesh to re-route