[PATCH] nl80211: Keep AUTH/ASSOC flags for NAN station add
Ouden Lin
ouden.lin at gmail.com
Mon Nov 30 23:25:07 PST 2026
From: Ouden Lin <ouden.lin at gmail.com>
cfg80211 rejects NL80211_CMD_NEW_STATION on a NAN or NAN data interface
unless the station is added with the authenticated or associated flag set
in both the set and mask fields.
The nl80211 driver interface filters those flags out of the mask whenever
the driver does not advertise full AP client state. That is needed for AP
mode where cfg80211 applies the flags itself, but it breaks NAN station
addition with drivers that do not set
NL80211_FEATURE_FULL_AP_CLIENT_STATE: sta_flags_set ends up as zero and
the kernel returns -EINVAL, which shows up as a failure to add the NMI or
NDI station.
Skip the filtering for NAN interfaces and keep the full AP client state
adjustment limited to the interface types it was intended for.
Signed-off-by: Ouden Lin <ouden.lin at gmail.com>
---
src/drivers/driver_nl80211.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 358676e35..8a9497398 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6560,14 +6560,21 @@ static int wpa_driver_nl80211_sta_add(void *priv,
* This is irrelevant for mesh mode where the station is added to the
* driver as authenticated already, and ASSOCIATED isn't part of the
* nl80211 API.
+ *
+ * NAN is also excluded here: cfg80211 requires a NAN station to be
+ * added with the authenticated or associated flag set in both the set
+ * and mask fields, so those flags must not be filtered out.
*/
if (!is_mesh_interface(drv->nlmode)) {
- if (!FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags)) {
+ if (!FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags) &&
+ drv->nlmode != NL80211_IFTYPE_NAN &&
+ drv->nlmode != NL80211_IFTYPE_NAN_DATA) {
wpa_printf(MSG_DEBUG,
"nl80211: Ignore ASSOC/AUTH flags since driver doesn't support full AP client state");
upd.mask &= ~(BIT(NL80211_STA_FLAG_ASSOCIATED) |
BIT(NL80211_STA_FLAG_AUTHENTICATED));
- } else if (!params->set &&
+ } else if (FULL_AP_CLIENT_STATE_SUPP(drv->capa.flags) &&
+ !params->set &&
!(params->flags & WPA_STA_TDLS_PEER)) {
if (!(params->flags & WPA_STA_AUTHENTICATED))
upd.mask |= BIT(NL80211_STA_FLAG_AUTHENTICATED);
--
2.54.0 (Apple Git-157)
More information about the Hostap
mailing list