Skip to content

Commit d8bf0c0

Browse files
T-Xsimonwunderlich
authored andcommitted
batman-adv: Fix own OGM check in aggregated OGMs
The own OGM check is currently misplaced and can lead to the following issues: For one thing we might receive an aggregated OGM from a neighbor node which has our own OGM in the first place. We would then not only skip our own OGM but erroneously also any other, following OGM in the aggregate. For another, we might receive an OGM aggregate which has our own OGM in a place other then the first one. Then we would wrongly not skip this OGM, leading to populating the orginator and gateway table with ourself. Fixes: 9323158 ("batman-adv: OGMv2 - implement originators logic") Signed-off-by: Linus Lüssing <[email protected]> Signed-off-by: Sven Eckelmann <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent 303216e commit d8bf0c0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/batman-adv/bat_v_ogm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,12 @@ static void batadv_v_ogm_process(const struct sk_buff *skb, int ogm_offset,
881881
ntohl(ogm_packet->seqno), ogm_throughput, ogm_packet->ttl,
882882
ogm_packet->version, ntohs(ogm_packet->tvlv_len));
883883

884+
if (batadv_is_my_mac(bat_priv, ogm_packet->orig)) {
885+
batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
886+
"Drop packet: originator packet from ourself\n");
887+
return;
888+
}
889+
884890
/* If the throughput metric is 0, immediately drop the packet. No need
885891
* to create orig_node / neigh_node for an unusable route.
886892
*/
@@ -1008,11 +1014,6 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
10081014
if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
10091015
goto free_skb;
10101016

1011-
ogm_packet = (struct batadv_ogm2_packet *)skb->data;
1012-
1013-
if (batadv_is_my_mac(bat_priv, ogm_packet->orig))
1014-
goto free_skb;
1015-
10161017
batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_RX);
10171018
batadv_add_counter(bat_priv, BATADV_CNT_MGMT_RX_BYTES,
10181019
skb->len + ETH_HLEN);

0 commit comments

Comments
 (0)