[RFC PATCH 02/12] wifi: mac80211: clarify per-STA GTK handling code/docs
Johannes Berg <[email protected]> Sat, 1 Aug 2026 09:58:18 +0200
| Newsgroups | org.kernel.vger.linux-wireless |
|---|---|
| Message-ID | <20260801095822.17bcbe0f7df8.Ib3a58f33a932b57be8a3e01b913b06f137f5c793@changeid> |
From: Johannes Berg <[email protected]> The FT case in the documentation cannot happen, because the way mac80211 handles FT (now) doesn't add a station entry before the actual BSS transition. In addition, the documentation doesn't mention mesh, which also uses this flag. NAN was always allowing it, out of necessity. Also clarify that other interface types aren't supported (for now) at all, which is already rejected by cfg80211 but checking here is easy and makes the code clearer. Signed-off-by: Johannes Berg <[email protected]> --- include/net/mac80211.h | 12 +++++++----- net/mac80211/key.c | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index aae140fdc2bb..e9006e3a0c32 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -2918,11 +2918,13 @@ struct ieee80211_txq { * dtim_period). * * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports - * per-station GTKs as used by IBSS RSN or during fast transition. If - * the device doesn't support per-station GTKs, but can be asked not - * to decrypt group addressed frames, then IBSS RSN support is still - * possible but software crypto will be used. Advertise the wiphy flag - * only in that case. + * per-station GTKs as used by IBSS RSN and mesh. If the device doesn't + * support per-station GTKs, but can be asked not to decrypt group + * addressed frames, then IBSS RSN support is still possible but + * software crypto must be used. Drivers advertise the wiphy flag + * (%WIPHY_FLAG_IBSS_RSN) instead in that case. + * For mesh, it's assumed that either this flag is set or SW crypto + * can be used, regardless of additional wiphy flags. * * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device * autonomously manages the PS status of connected stations. When diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 4c9788ec0b74..ed08e011c1f2 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c @@ -155,10 +155,20 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) * per-station GTKs are required to be supported if secure NAN is * supported). */ - if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE) && - !(ieee80211_hw_check(&key->local->hw, SUPPORTS_PER_STA_GTK) || - sdata->vif.type == NL80211_IFTYPE_NAN_DATA)) - goto out_unsupported; + if (sta && !(key->conf.flags & IEEE80211_KEY_FLAG_PAIRWISE)) { + switch (sdata->vif.type) { + case NL80211_IFTYPE_NAN_DATA: + break; + case NL80211_IFTYPE_ADHOC: + case NL80211_IFTYPE_MESH_POINT: + if (!(ieee80211_hw_check(&key->local->hw, + SUPPORTS_PER_STA_GTK))) + goto out_unsupported; + break; + default: + goto out_unsupported; + } + } if (sta && !sta->uploaded) goto out_unsupported; -- 2.55.0