6882694da8e56915db6bb1807de6dc3615e836e6
[librecmc/librecmc.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 26 Mar 2023 17:11:34 +0200
3 Subject: [PATCH] wifi: mac80211: fix receiving mesh packets in forwarding=0
4  networks
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 When forwarding is set to 0, frames are typically sent with ttl=1.
10 Move the ttl decrement check below the check for local receive in order to
11 fix packet drops.
12
13 Reported-by: Thomas Hühn <thomas.huehn@hs-nordhausen.de>
14 Reported-by: Nick Hainke <vincent@systemli.org>
15 Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
16 Signed-off-by: Felix Fietkau <nbd@nbd.name>
17 ---
18
19 --- a/net/mac80211/rx.c
20 +++ b/net/mac80211/rx.c
21 @@ -2828,14 +2828,6 @@ ieee80211_rx_mesh_data(struct ieee80211_
22         if (sdata->crypto_tx_tailroom_needed_cnt)
23                 tailroom = IEEE80211_ENCRYPT_TAILROOM;
24  
25 -       if (!--mesh_hdr->ttl) {
26 -               if (multicast)
27 -                       goto rx_accept;
28 -
29 -               IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
30 -               return RX_DROP_MONITOR;
31 -       }
32 -
33         if (mesh_hdr->flags & MESH_FLAGS_AE) {
34                 struct mesh_path *mppath;
35                 char *proxied_addr;
36 @@ -2874,6 +2866,14 @@ ieee80211_rx_mesh_data(struct ieee80211_
37         if (ether_addr_equal(sdata->vif.addr, eth->h_dest))
38                 goto rx_accept;
39  
40 +       if (!--mesh_hdr->ttl) {
41 +               if (multicast)
42 +                       goto rx_accept;
43 +
44 +               IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
45 +               return RX_DROP_MONITOR;
46 +       }
47 +
48         if (!ifmsh->mshcfg.dot11MeshForwarding) {
49                 if (is_multicast_ether_addr(eth->h_dest))
50                         goto rx_accept;