2023-07-12 08:57:19

by Koen Vandeputte

[permalink] [raw]
Subject: [PATCH] wifi: nl80211: fix mbssid nesting

Executing command NL80211_CMD_GET_WIPHY and parsing it's output
natively without libnl shows following attributes as part of
the nl80211 generated netlink message (part 16):

GetWiphy: Type: 1
GetWiphy: Type: 2
GetWiphy: Type: 46
GetWiphy: Type: 33074 <-- wrong enum value, above MAX also ..
GetWiphy: Type: 316

Switching to nla_nest_start_noflag() which ommits the NLA_F_NESTED
flag (like most other similar functions do) fixes this:

GetWiphy: Type: 1
GetWiphy: Type: 2
GetWiphy: Type: 46
GetWiphy: Type: 306 <-- correct enum value
GetWiphy: Type: 316

Fixes: dc1e3cb8da8b ("nl80211: MBSSID and EMA support in AP mode")
Signed-off-by: Koen Vandeputte <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: John Crispin <[email protected]>
Cc: Aloka Dixit <[email protected]>
Cc: [email protected] # 5.16
---
net/wireless/nl80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0da2e6a2a7ea..4d4860f9428d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -2359,7 +2359,7 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg)
if (!wiphy->mbssid_max_interfaces)
return 0;

- config = nla_nest_start(msg, NL80211_ATTR_MBSSID_CONFIG);
+ config = nla_nest_start_noflag(msg, NL80211_ATTR_MBSSID_CONFIG);
if (!config)
return -ENOBUFS;

--
2.34.1