wifi: mac80211: fix and simplify unencrypted drop check for mesh
authorFelix Fietkau <nbd@nbd.name>
Thu, 1 Dec 2022 13:57:30 +0000 (14:57 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 1 Dec 2022 14:11:11 +0000 (15:11 +0100)
commit94b9b9de05b62ac54d8766caa9865fb4d82cc47e
treef883f6676a5383f33f338aefb6665cdc3f4128ca
parent7d360f6061db01830adfdb1eaa3977b19db0c30b
wifi: mac80211: fix and simplify unencrypted drop check for mesh

ieee80211_drop_unencrypted is called from ieee80211_rx_h_mesh_fwding and
ieee80211_frame_allowed.

Since ieee80211_rx_h_mesh_fwding can forward packets for other mesh nodes
and is called earlier, it needs to check the decryptions status and if the
packet is using the control protocol on its own, instead of deferring to
the later call from ieee80211_frame_allowed.

Because of that, ieee80211_drop_unencrypted has a mesh specific check
that skips over the mesh header in order to check the payload protocol.
This code is invalid when called from ieee80211_frame_allowed, since that
happens after the 802.11->802.3 conversion.

Fix this by moving the mesh specific check directly into
ieee80211_rx_h_mesh_fwding.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20221201135730.19723-1-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rx.c