Skip to contentSkip to conversation

mac80211: probe for hidden SSIDs in pre-auth scan

PATCH In review John W. Linville 3 participants 5 messages Aug 7, 2007 – Aug 9, 2007 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: probe for hidden SSIDs in pre-auth scan

From: John W. Linville <[email protected]>

Probe for hidden SSIDs if initiating pre-authentication scan and SSID is set for STA interface.

---
The ternary conditionals are a bit ugly. I guess I could recode it with temp vars initialized before calling ieee80211_sta_start_scan.

Any other complaints?

 net/mac80211/ieee80211_sta.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
net/mac80211/ieee80211_sta.c +4 -1
index 007dd08..9f467cc 100644
@@ -3217,7 +3217,10 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
 		return 0;
 	} else {
 		if (ifsta->state != IEEE80211_AUTHENTICATE) {
-			ieee80211_sta_start_scan(dev, NULL, 0);
+			ieee80211_sta_start_scan(dev, ifsta->auto_ssid_sel ?
+							NULL : ifsta->ssid,
+						 ifsta->auto_ssid_sel ?
+							0 : ifsta->ssid_len);
 			ifsta->state = IEEE80211_AUTHENTICATE;
 			set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
 		} else
Signature · 2 lines
John W. Linville
[email protected]
#1 lore raw
Quoted 3 lines · John W. Linville

The ternary conditionals are a bit ugly. I guess I could recode it with temp vars initialized before calling ieee80211_sta_start_scan.

Something more like:

if (ifsta->auto_ssid_sel && ifsta->ssid_len)
ieee80211_sta_start_scan(dev, NULL, 0);
else
ieee80211_sta_start_scan(dev, ifsta->ssid, ifsta->ssid_len);

would be better.

-Michael Wu

maintainer
#2 lore raw
Quoted 10 lines · Michael Wu
Quoted 3 lines · John W. Linville

The ternary conditionals are a bit ugly. I guess I could recode it with temp vars initialized before calling ieee80211_sta_start_scan.

Something more like:

if (ifsta->auto_ssid_sel && ifsta->ssid_len)
ieee80211_sta_start_scan(dev, NULL, 0);
else
ieee80211_sta_start_scan(dev, ifsta->ssid, ifsta->ssid_len);

Except you got the condition inverted.

johannes

maintainer
#3 lore raw
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Michael Wu
Quoted 3 lines · John W. Linville

The ternary conditionals are a bit ugly. I guess I could recode it with temp vars initialized before calling ieee80211_sta_start_scan.

Quoted 8 lines
Quoted 6 lines

Something more like:

if (ifsta->auto_ssid_sel && ifsta->ssid_len)
ieee80211_sta_start_scan(dev, NULL, 0);
else
ieee80211_sta_start_scan(dev, ifsta->ssid, ifsta->ssid_len);

Except you got the condition inverted.

Well, not fully inverted. Shouldn't it be

if (!ifsta->auto_ssid_sel && ifsta->ssid_len)

	...(dev, ifsta->ssid, ifsta->ssid_len)
else
	...(dev, NULL, 0)

On the other hand, calling with a "anything, 0" probably has the same effect as calling with "NULL, 0" so the "ifsta->ssid_len" condition can go away just as linville had it.

johannes

#4 lore raw
Quoted 4 lines · Johannes Berg

On the other hand, calling with a "anything, 0" probably has the same effect as calling with "NULL, 0" so the "ifsta->ssid_len" condition can go away just as linville had it.

Yep.

-Michael Wu