Skip to contentSkip to conversation

Set ssid when authenticating

PATCH Superseded Marc Bornand 2 participants 2 messages Feb 13, 2023 – Feb 14, 2023

Subsystems (4)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Set ssid when authenticating

changes since v2:
- The code was tottaly rewritten based on the disscution of the v2 patch.
- the ssid is set in __cfg80211_connect_result() and only if the ssid is not already set.
- Do not add an other ssid reset path since it is already done in __cfg80211_disconnected()

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 in __cfg80211_connect_result() when it is not already set.

---
 net/wireless/sme.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
net/wireless/sme.c +16 -0
index 4b5b6ee0fe01..629d7b5f65c1 100644
@@ -723,6 +723,7 @@ void __cfg80211_connect_result(struct net_device *dev,
 			       bool wextev)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	const struct element *ssid;
 	const struct element *country_elem = NULL;
 	const u8 *country_data;
 	u8 country_datalen;
@@ -883,6 +884,21 @@ void __cfg80211_connect_result(struct net_device *dev,
 				   country_data, country_datalen);
 	kfree(country_data);
 
+	if (wdev->u.client.ssid_len == 0) {
+		rcu_read_lock();
+		for_each_valid_link(cr, link) {
+			ssid = ieee80211_bss_get_elem(cr->links[link].bss,
+						      WLAN_EID_SSID);
+
+			if (ssid->datalen == 0)
+				continue;
+
+			memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen);
+			wdev->u.client.ssid_len = ssid->datalen;
+		}
+		rcu_read_unlock();
+	}
+
 	return;
 out:
 	for_each_valid_link(cr, link)

--
2.39.1

maintainer
#1 lore raw

Hi,

Please provide a proper subject/commit message for this. The "authenticating" is no longer true anyway.

See
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#commit_messages

Quoted 9 lines · Marc Bornand

changes since v2:
- The code was tottaly rewritten based on the disscution of the v2 patch.
- the ssid is set in __cfg80211_connect_result() and only if the ssid is not already set.
- Do not add an other ssid reset path since it is already done in __cfg80211_disconnected()

When a connexion was established without going through

connection

Quoted 27 lines

NL80211_CMD_CONNECT, the ssid was never set in the wireless_dev struct. Now we set it in __cfg80211_connect_result() when it is not already set.

---
 net/wireless/sme.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
net/wireless/sme.c +1 -0
index 4b5b6ee0fe01..629d7b5f65c1 100644
@@ -723,6 +723,7 @@ void __cfg80211_connect_result(struct net_device *dev,
 			       bool wextev)
 {
 	struct wireless_dev *wdev = dev->ieee80211_ptr;
+	const struct element *ssid;
 	const struct element *country_elem = NULL;
 	const u8 *country_data;
 	u8 country_datalen;

net/wireless/sme.c void __cfg80211_connect_result(struct net_device *dev, · line 893

Quoted 10 lines
net/wireless/sme.c +7 -0
@@ -883,6 +884,21 @@ void __cfg80211_connect_result(struct net_device *dev,
 				   country_data, country_datalen);
 	kfree(country_data);
 
+	if (wdev->u.client.ssid_len == 0) {
+		rcu_read_lock();
+		for_each_valid_link(cr, link) {
+			ssid = ieee80211_bss_get_elem(cr->links[link].bss,
+						      WLAN_EID_SSID);
+
+			if (ssid->datalen == 0)

need to check also that it exists

net/wireless/sme.c void __cfg80211_connect_result(struct net_device *dev, · line 897

Quoted 4 lines
net/wireless/sme.c +4 -0
+				continue;
+
+			memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen);
+			wdev->u.client.ssid_len = ssid->datalen;

you can break here.

johannes