Merge pull request #624 from ecsv/batadv-for-18.06
[feed/routing.git] / batman-adv / patches / 0047-batman-adv-Fix-own-OGM-check-in-aggregated-OGMs.patch
1 From: Linus Lüssing <linus.luessing@c0d3.blue>
2 Date: Fri, 31 Jul 2020 00:22:55 +0200
3 Subject: batman-adv: Fix own OGM check in aggregated OGMs
4
5 The own OGM check is currently misplaced and can lead to the following
6 issues:
7
8 For one thing we might receive an aggregated OGM from a neighbor node
9 which has our own OGM in the first place. We would then not only skip
10 our own OGM but erroneously also any other, following OGM in the
11 aggregate.
12
13 For another, we might receive an OGM aggregate which has our own OGM in
14 a place other then the first one. Then we would wrongly not skip this
15 OGM, leading to populating the orginator and gateway table with ourself.
16
17 The latter seems to not only be a cosmetic issue, but there were reports
18 that this causes issues with various subsystems of batman-adv, too. For
19 instance there were reports about issues with DAT and either disabling
20 DAT or aggregation seemed to solve it.
21
22 Fixing these issues by applying the own OGM check not on the first OGM
23 in an aggregate but for each OGM in an aggregate instead.
24
25 Fixes: 667996ebeab ("batman-adv: OGMv2 - implement originators logic")
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/d41cc7cb62c184b2fb8ab97fda45815918200001
30
31 diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
32 index 0458de53cb64b2da51de492ffa27f33068351cc8..04a620fd13014463ed0c7c047f3a61a05d862e39 100644
33 --- a/net/batman-adv/bat_v_ogm.c
34 +++ b/net/batman-adv/bat_v_ogm.c
35 @@ -716,6 +716,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
36 ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl,
37 ogm_packet->version, ntohs(ogm_packet->tvlv_len));
38
39 + if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) {
40 + batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
41 + "Drop packet: originator packet from ourself\n");
42 + return;
43 + }
44 +
45 /* If the throughput metric is 0, immediately drop the packet. No need
46 * to create orig_node / neigh_node for an unusable route.
47 */
48 @@ -843,11 +849,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
49 if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
50 goto free_skb;
51
52 - ogm_packet = (struct batadv_ogm2_packet *)skb->data;
53 -
54 - if (batadv_is_my_mac(bat_priv, ogm_packet->orig))
55 - goto free_skb;
56 -
57 batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
58 batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
59 skb->len + ETH_HLEN);