Skip to contentSkip to conversation

Set ssid when authenticating

PATCH In review Marc Bornand 4 participants 7 messages Feb 14, 2023 – Feb 15, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 Set ssid when authenticating

changes since v3:
- add missing NULL check
- add missing break

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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
net/wireless/sme.c +17 -0
index 4b5b6ee0fe01..b552d6c20a26 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,22 @@ 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 || ssid->datalen == 0)
+				continue;
+
+			memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen);
+			wdev->u.client.ssid_len = ssid->datalen;
+			break;
+		}
+		rcu_read_unlock();
+	}
+
 	return;
 out:
 	for_each_valid_link(cr, link)

--
2.39.1

#1 lore raw
Quoted 12 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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()

Quoted 3 lines

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.

A couple of small nits

Quoted 3 lines
Fixes 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1

Please add a test description to the fixes tag

Quoted 13 lines
---
 net/wireless/sme.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
net/wireless/sme.c +0 -0
index 4b5b6ee0fe01..b552d6c20a26 100644

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

Quoted 4 lines
net/wireless/sme.c +1 -0
@@ -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;

Please use reverse xmas tree

Quoted 30 lines
net/wireless/sme.c +16 -1
 	const struct element *country_elem = NULL;
 	const u8 *country_data;
 	u8 country_datalen;
@@ -883,6 +884,22 @@ 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 || ssid->datalen == 0)
+				continue;
+
+			memcpy(wdev->u.client.ssid, ssid->data, ssid->datalen);
+			wdev->u.client.ssid_len = ssid->datalen;
+			break;
+		}
+		rcu_read_unlock();
+	}
+
 	return;
 out:
 	for_each_valid_link(cr, link)
--

2.39.1

#2 lore raw
Quoted 19 lines · Denis Kirjanov
Quoted 12 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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()

Quoted 3 lines

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.

Quoted 6 lines

A couple of small nits

Quoted 3 lines
Fixes 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1

Please add a test description to the fixes tag

What do you mean by "test description" ?

Marc

#3 lore raw
Quoted 19 lines · Marc Bornand
Quoted 17 lines · Denis Kirjanov
Quoted 15 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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.

Quoted 8 lines
Quoted 6 lines

A couple of small nits

Quoted 3 lines
Fixes 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1

Please add a test description to the fixes tag

What do you mean by "test description" ?

s/s/x/ ;)

Fixes 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs")

Cheers,
Conor.

#4 lore raw
In reply to Marc Bornand
Quoted 22 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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.

Quoted 3 lines
---
 net/wireless/sme.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

The change log ("changes since v3" etc) should be after "---" line and the title should start with "wifi: cfg80211:". Please read the wiki link below.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#5 lore raw
Quoted 28 lines · Kalle Valo
Quoted 22 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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.

Quoted 3 lines
---
 net/wireless/sme.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Quoted 1 line

The change log ("changes since v3" etc) should be after "---" line and

Does it need another "---" after the change log?
something like:

"---"
"changes since v3:"
"(CHANGES)"
"---"

Quoted 2 lines

the title should start with "wifi: cfg80211:". Please read the wiki link below.

Should i start with the version 1 with the new title?
and since i am already changing the title, the following might better discribe the patch, or should i keep the old title after the ":" ?

[PATCH wireless] wifi: cfg80211: Set SSID if it is not already set

Quoted 5 lines

--
https://patchwork.kernel.org/project/linux-wireless/list/

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

#6 lore raw
Quoted 31 lines · Marc Bornand
Quoted 28 lines · Kalle Valo
Quoted 22 lines · Marc Bornand

changes since v3:
- add missing NULL check
- add missing break

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.

Quoted 3 lines
---
 net/wireless/sme.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Quoted 1 line

The change log ("changes since v3" etc) should be after "---" line and

Quoted 7 lines

Does it need another "---" after the change log?
something like:

"---"
"changes since v3:"
"(CHANGES)"
"---"

No need to add a second "---" line.

Quoted 4 lines
Quoted 2 lines

the title should start with "wifi: cfg80211:". Please read the wiki link below.

Should i start with the version 1 with the new title?

If you reset the version number that might confuse the reviewers, so my recommendation is to use v5 in the next version. That makes it more obvious that there are earlier versions available.

Quoted 4 lines

and since i am already changing the title, the following might better discribe the patch, or should i keep the old title after the ":" ?

[PATCH wireless] wifi: cfg80211: Set SSID if it is not already set

Changing the title is fine.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

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