mac80211: fix mesh path discovery based on unicast packets
[openwrt/staging/noltari.git] / package / kernel / mac80211 / patches / subsys / 322-wifi-mac80211-fix-mesh-path-discovery-based-on-unica.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 26 Feb 2023 20:30:20 +0100
3 Subject: [PATCH] wifi: mac80211: fix mesh path discovery based on unicast
4 packets
5
6 If a packet has reached its intended destination, it was bumped to the code
7 that accepts it, without first checking if a mesh_path needs to be created
8 based on the discovered source.
9 Fix this by moving the destination address check further down
10
11 Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
12 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 ---
14
15 --- a/net/mac80211/rx.c
16 +++ b/net/mac80211/rx.c
17 @@ -2824,17 +2824,6 @@ ieee80211_rx_mesh_data(struct ieee80211_
18 mesh_rmc_check(sdata, eth->h_source, mesh_hdr))
19 return RX_DROP_MONITOR;
20
21 - /* Frame has reached destination. Don't forward */
22 - if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
23 - goto rx_accept;
24 -
25 - if (!ifmsh->mshcfg.dot11MeshForwarding) {
26 - if (is_multicast_ether_addr(eth->h_dest))
27 - goto rx_accept;
28 -
29 - return RX_DROP_MONITOR;
30 - }
31 -
32 /* forward packet */
33 if (sdata->crypto_tx_tailroom_needed_cnt)
34 tailroom = IEEE80211_ENCRYPT_TAILROOM;
35 @@ -2881,6 +2870,17 @@ ieee80211_rx_mesh_data(struct ieee80211_
36 rcu_read_unlock();
37 }
38
39 + /* Frame has reached destination. Don't forward */
40 + if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
41 + goto rx_accept;
42 +
43 + if (!ifmsh->mshcfg.dot11MeshForwarding) {
44 + if (is_multicast_ether_addr(eth->h_dest))
45 + goto rx_accept;
46 +
47 + return RX_DROP_MONITOR;
48 + }
49 +
50 skb_set_queue_mapping(skb, ieee802_1d_to_ac[skb->priority]);
51
52 if (!multicast &&