Skip to contentSkip to conversation

Set ssid when authenticating

PATCH Superseded Marc Bornand 1 participant 1 message Feb 10, 2023

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set ssid when authenticating

When a connexion was established without going through NL80211_CMD_CONNECT, the ssid was never set in the wireless_dev struct. Now we set it during when an NL80211_CMD_AUTHENTICATE is issued.

It may be needed to test this on some additional hardware (tested with iwlwifi and a AX201, and iwd on the userspace side), I could not test things like roaming and p2p.

This applies to v6.2-rc7,
but I think it may also be interesting to backport it from 5.19 to 6.1

---
 net/wireless/nl80211.c | 9 +++++++++
 1 file changed, 9 insertions(+)
net/wireless/nl80211.c +9 -0
index 33a82ecab9d5..f1627ea542b9 100644
@@ -10552,6 +10552,10 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
 		return -ENOENT;
 
 	wdev_lock(dev->ieee80211_ptr);
+
+	memcpy(dev->ieee80211_ptr->u.client.ssid, ssid, ssid_len);
+	dev->ieee80211_ptr->u.client.ssid_len = ssid_len;
+
 	err = cfg80211_mlme_auth(rdev, dev, &req);
 	wdev_unlock(dev->ieee80211_ptr);
 
@@ -11025,6 +11029,11 @@ static int nl80211_deauthenticate(struct sk_buff *skb, struct genl_info *info)
 	local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE];
 
 	wdev_lock(dev->ieee80211_ptr);
+
+	if (reason_code == WLAN_REASON_DEAUTH_LEAVING) {
+		dev->ieee80211_ptr->u.client.ssid_len = 0;
+	}
+
 	err = cfg80211_mlme_deauth(rdev, dev, bssid, ie, ie_len, reason_code,
 				   local_state_change);
 	wdev_unlock(dev->ieee80211_ptr);

--
2.39.1