From: Felix Fietkau <nbd@xxxxxxxx> commit e26c0946a5c1aa4d27f8dfe78f2a72b4550df91f upstream. When forwarding is set to 0, frames are typically sent with ttl=1. Move the ttl decrement check below the check for local receive in order to fix packet drops. Reported-by: Thomas Hühn <thomas.huehn@xxxxxxxxxxxxxxxx> Reported-by: Nick Hainke <vincent@xxxxxxxxxxxx> Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") Signed-off-by: Felix Fietkau <nbd@xxxxxxxx> Link: https://lore.kernel.org/r/20230326151709.17743-1-nbd@xxxxxxxx Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/mac80211/rx.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2774,14 +2774,6 @@ ieee80211_rx_mesh_data(struct ieee80211_ if (sdata->crypto_tx_tailroom_needed_cnt) tailroom = IEEE80211_ENCRYPT_TAILROOM; - if (!--mesh_hdr->ttl) { - if (multicast) - goto rx_accept; - - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); - return RX_DROP_MONITOR; - } - if (mesh_hdr->flags & MESH_FLAGS_AE) { struct mesh_path *mppath; char *proxied_addr; @@ -2812,6 +2804,14 @@ ieee80211_rx_mesh_data(struct ieee80211_ if (ether_addr_equal(sdata->vif.addr, eth->h_dest)) goto rx_accept; + if (!--mesh_hdr->ttl) { + if (multicast) + goto rx_accept; + + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); + return RX_DROP_MONITOR; + } + if (!ifmsh->mshcfg.dot11MeshForwarding) { if (is_multicast_ether_addr(eth->h_dest)) goto rx_accept; Patches currently in stable-queue which might be from nbd@xxxxxxxx are queue-6.1/wifi-cfg80211-fix-receiving-mesh-packets-without-rfc1042-header.patch queue-6.1/wifi-mac80211-fix-potential-null-pointer-dereference.patch queue-6.1/udp-fix-receiving-fraglist-gso-packets.patch queue-6.1/wifi-mac80211-fix-mesh-path-discovery-based-on-unicast-packets.patch queue-6.1/wifi-mac80211-fix-mesh-forwarding.patch queue-6.1/wifi-mac80211-fix-receiving-a-msdu-frames-on-mesh-in.patch queue-6.1/wifi-mac80211-fix-flow-dissection-for-forwarded-packets.patch queue-6.1/wifi-mac80211-drop-bogus-static-keywords-in-a-msdu-rx.patch queue-6.1/wifi-cfg80211-factor-out-bridge-tunnel-rfc1042-heade.patch queue-6.1/wifi-mac80211-fix-receiving-mesh-packets-in-forwarding-0-networks.patch queue-6.1/wifi-mac80211-fix-and-simplify-unencrypted-drop-chec.patch queue-6.1/wifi-mac80211-remove-mesh-forwarding-congestion-chec.patch queue-6.1/wifi-cfg80211-move-a-msdu-check-in-ieee80211_data_to.patch queue-6.1/wifi-mac80211-add-a-workaround-for-receiving-non-sta.patch