Skip to contentSkip to conversation

cfg80211: clear SSID on disconnect

PATCH Superseded Johannes Berg 2 participants 7 messages Aug 3, 2009 – Aug 4, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 cfg80211: clear SSID on disconnect

The SME state machine in cfg80211 uses the SSID stored in struct wireless_dev internally, but fails to clear it when disconnecting. This doesn't matter to the SME state machine, but does matter for IBSS. Thus, when disconnecting, clear the SSID to avoid messing up the IBSS state machine.

---
 net/wireless/sme.c |    1 +
 1 file changed, 1 insertion(+)
net/wireless/sme.c +1 -0
@@ -550,6 +550,7 @@ void __cfg80211_disconnected(struct net_
 
 	wdev->current_bss = NULL;
 	wdev->sme_state = CFG80211_SME_IDLE;
+	wdev->ssid_len = 0;
 
 	if (wdev->conn) {
 		kfree(wdev->conn->ie);
#1 lore raw

net/wireless/sme.c void __cfg80211_disconnected(struct net_ · line 556

Quoted 6 lines · Johannes Berg
net/wireless/sme.c +1 -0
 	wdev->current_bss = NULL;
 	wdev->sme_state = CFG80211_SME_IDLE;
+	wdev->ssid_len = 0;
 
 	if (wdev->conn) {
 		kfree(wdev->conn->ie);

Sorry, but this didn't help with the ar9170 problem. I still get a call to ar9170_op_bss_info_changed() after ifconfig wlan1 down. I put a printk at your change in sme.c and it's not called.

Please be aware that in managed mode my adapter stays in state SCANNING, 'cause there is not AP around with essid huhu_m:

ifconfig wlan1 up
iwconfig wlan1 essid huhu_m
ifconfig wlan1 down
iwconfig wlan1 mode ad-hoc essid huhu_a channel 1
/* ar9170_op_bss_info_changed() is called with ar->vif == NULL */

Regards,
Jörg.

author maintainer
#2 lore raw
Quoted 6 lines · Joerg Albert

Sorry, but this didn't help with the ar9170 problem. I still get a call to ar9170_op_bss_info_changed() after ifconfig wlan1 down. I put a printk at your change in sme.c and it's not called.

Please be aware that in managed mode my adapter stays in state SCANNING, 'cause there is not AP around with essid huhu_m:

Aha. yes, the same assignment is _also_ missing in __cfg80211_connect_result(), can you add it there manually (in the status != WLAN_STATUS_SUCCESS block at the end) and see what happens?

johannes

author maintainer
#6 lore raw

PATCH v2 1/1 cfg80211: clear SSID on disconnect/no connection

In reply to Johannes Berg

The SME state machine in cfg80211 uses the SSID stored in struct wireless_dev internally, but fails to clear it in multiple places (when giving up on a connection attempt and when disconnecting). This doesn't matter to the SME state machine, but does matter for IBSS. Thus, in those cases, clear the SSID to avoid messing up the IBSS state machine.

---
 net/wireless/sme.c |    4 ++++
 1 file changed, 4 insertions(+)
net/wireless/sme.c +4 -0
@@ -383,6 +383,7 @@ void __cfg80211_connect_result(struct ne
 		wdev->conn = NULL;
 		kfree(wdev->connect_keys);
 		wdev->connect_keys = NULL;
+		wdev->ssid_len = 0;
 		return;
 	}
 
@@ -550,6 +551,7 @@ void __cfg80211_disconnected(struct net_
 
 	wdev->current_bss = NULL;
 	wdev->sme_state = CFG80211_SME_IDLE;
+	wdev->ssid_len = 0;
 
 	if (wdev->conn) {
 		kfree(wdev->conn->ie);
@@ -705,6 +707,7 @@ int __cfg80211_connect(struct cfg80211_r
 			wdev->conn = NULL;
 			wdev->sme_state = CFG80211_SME_IDLE;
 			wdev->connect_keys = NULL;
+			wdev->ssid_len = 0;
 		}
 
 		return err;
@@ -769,6 +772,7 @@ int __cfg80211_disconnect(struct cfg8021
 			wdev->sme_state = CFG80211_SME_IDLE;
 			kfree(wdev->conn);
 			wdev->conn = NULL;
+			wdev->ssid_len = 0;
 			return 0;
 		}
 
#3 lore raw
In reply to Johannes Berg
Quoted 3 lines · Johannes Berg

Aha. yes, the same assignment is _also_ missing in __cfg80211_connect_result(), can you add it there manually (in the status != WLAN_STATUS_SUCCESS block at the end) and see what happens?

Yes, that helped in my case.

Thanks,
Jörg.

author maintainer
#4 lore raw
Quoted 9 lines · Joerg Albert
Quoted 3 lines · Johannes Berg

Aha. yes, the same assignment is _also_ missing in __cfg80211_connect_result(), can you add it there manually (in the status != WLAN_STATUS_SUCCESS block at the end) and see what happens?

Yes, that helped in my case.

The v2 patch I posted to this thread should fix the issue then, and also fix two more places where it could occur.

johannes

#5 lore raw
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Joerg Albert

Johannes Berg <johannes@...> writes:

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Aha. yes, the same assignment is _also_ missing in __cfg80211_connect_result(), can you add it there manually (in the status != WLAN_STATUS_SUCCESS block at the end) and see what happens?

Yes, that helped in my case.

The v2 patch I posted to this thread should fix the issue then, and also fix two more places where it could occur.

Yes, the v2 patch worked well, too.