Skip to contentSkip to conversation

wpa_supplicant didn't work w/ wpa_secured hidden AP

PATCH In review John W. Linville 5 participants 7 messages Oct 10, 2007 – Oct 15, 2007 1 message not in the archive mac80211

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1192040814.12399.4.camel@abhi-desktop

#1 lore raw
Quoted 6 lines · Abhijeet Kolekar

This patch fixes the problem of associating with wpa_secured hidden ap.Please try out.

The original author of this patch is Bill Moss<[email protected]>

Wow...that is one busted patch... Please avoid using editors that convert tabs to whitespace. Probably also need to account for existing IEEE80211_SCAN_MATCH_SSID behavior...?

Still, the general idea looks fine and I'd really like to make wpa_supplicant and mac80211 work together with hidden APs. I'll fix-up the patch and post it as a follow-up to this message...

John

P.S. Is limiting this to STA mode correct? Would wpa_supplicant ever set that flag for an IBSS?

Signature · 2 lines
John W. Linville
[email protected]
#2 lore raw

PATCH 1/1 mac80211: honor IW_SCAN_THIS_ESSID in siwscan ioctl

From: Bill Moss <[email protected]>

This patch fixes the problem of associating with wpa_secured hidden AP. Please try out.

The original author of this patch is Bill Moss <[email protected]>

---
 net/mac80211/ieee80211_ioctl.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
net/mac80211/ieee80211_ioctl.c +10 -1
index f95d488..331048f 100644
@@ -507,10 +507,11 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
 
 static int ieee80211_ioctl_siwscan(struct net_device *dev,
 				   struct iw_request_info *info,
-				   struct iw_point *data, char *extra)
+				   union iwreq_data *wrqu, char *extra)
 {
 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	struct iw_scan_req *req = NULL;
 	u8 *ssid = NULL;
 	size_t ssid_len = 0;
 
@@ -519,6 +520,14 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
 
 	switch (sdata->type) {
 	case IEEE80211_IF_TYPE_STA:
+		if (wrqu->data.length == sizeof(struct iw_scan_req) &&
+		    wrqu->data.flags & IW_SCAN_THIS_ESSID) {
+			req = (struct iw_scan_req *)extra;
+			ssid = req->essid;
+			ssid_len = req->essid_len;
+			break;
+		}
+		/* else fall-through */
 	case IEEE80211_IF_TYPE_IBSS:
 		if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
 			ssid = sdata->u.sta.ssid;
Signature · 1 line
1.5.2.4
#3 lore raw

Re: [PATCH] [PATCH] mac80211: honor IW_SCAN_THIS_ESSID in siwscan ioctl

Hi,

Am Mittwoch, 10. Oktober 2007 22:34:56 schrieb John W. Linville:

Quoted 2 lines

This patch fixes the problem of associating with wpa_secured hidden AP. Please try out.

The patch did not fix the issue for _some_ APs I have here but it is apparently correct.

I was able to track the issue further down to the probe-request iwlwifi sends to connect to a hidden AP (hw_scan is enabled). Attached is a quick hack against iwlwifi-1.1.0 which made hidden AP working for me (using hw_scan).

The patch is only ment as a hint, not as a real fix!

The problem seemed to be in the info element "supported rates". The probe-request mac80211 would generate does only attach eight supported rates to this info element, the rest goes to "extended supported rates".

Instead iwlwifi puts _all_ (more then eight) rates into "supported rates" and omits "extended supported rates". As "supported rates" is specified in 802.11b there should only be 802.11b rates (this is an assumption as I do not have the 802.11 specs here). This is exactly what my patch does: limit the number of supported rates to eight.

Can somebody please verify if I'm right?

Btw iwlwifi generates the probe-request itself _only_ if hw_scan is enabled. If hw_scan is disabled mac80211 generates the probe-request (which then should be correct) but the request gets somehow corrupted.

Thanks,
Helmut

iwl-base.c +7 -1
diff -ur iwlwifi-1.1.0/origin/iwl-base.c iwlwifi-1.1.0_1/origin/iwl-base.c
@@ -1877,6 +1877,7 @@
 	int len = 0;
 	u8 *pos = NULL;
 	u16 ret_rates;
+	int rate_count = 0;
 
 	/* Make sure there is enough space for the probe request,
 	 * two mandatory IEs and the data */
@@ -1924,11 +1925,16 @@
 	/* ... fill it in... */
 	*pos++ = WLAN_EID_SUPP_RATES;
 	*pos = 0;
+
+	rate_count = 8;
+	if (left < 8)
+		rate_count = left;
+
 	ret_rates = priv->active_rate = priv->rates_mask;
 	priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
 
 	iwl_supported_rate_to_ie(pos, priv->active_rate,
-				 priv->active_rate_basic, left);
+				 priv->active_rate_basic, rate_count);
 	len += 2 + *pos;
 	pos += (*pos) + 1;
 	ret_rates = ~ret_rates & priv->active_rate;

Nur in iwlwifi-1.1.0_1/origin: iwl-base.c.orig.

#4 lore raw

RE: [ipw3945-devel] [PATCH] [PATCH] mac80211: honorIW_SCAN_THIS_ESSID in siwscan ioctl

You are, we will provide a patch to fix that.
Thanks.
Tomas

Quoted 2 lines

-----Original Message-----
From: [email protected]

[mailto:ipw3945-devel-

Quoted 14 lines

[email protected]] On Behalf Of Helmut Schaa
Sent: Friday, October 12, 2007 3:25 PM
To: John W. Linville
Cc: [email protected]; [email protected]; ipw3945- [email protected]; Bill Moss
Subject: Re: [ipw3945-devel] [PATCH] [PATCH] mac80211:
honorIW_SCAN_THIS_ESSID in siwscan ioctl

Hi,

Am Mittwoch, 10. Oktober 2007 22:34:56 schrieb John W. Linville:

Quoted 2 lines

This patch fixes the problem of associating with wpa_secured hidden AP. Please try out.

Quoted 6 lines

The patch did not fix the issue for _some_ APs I have here but it is apparently correct.

I was able to track the issue further down to the probe-request iwlwifi sends
to connect to a hidden AP (hw_scan is enabled). Attached is a quick

hack

Quoted 1 line

against iwlwifi-1.1.0 which made hidden AP working for me (using

hw_scan).

Quoted 9 lines

The patch is only ment as a hint, not as a real fix!

The problem seemed to be in the info element "supported rates". The probe-request mac80211 would generate does only attach eight supported rates
to this info element, the rest goes to "extended supported rates".

Instead iwlwifi puts _all_ (more then eight) rates into "supported

rates"

Quoted 3 lines

and
omits "extended supported rates". As "supported rates" is specified in 802.11b there should only be 802.11b rates (this is an assumption as I

do

Quoted 2 lines

not
have the 802.11 specs here). This is exactly what my patch does: limit

the

Quoted 11 lines

number of supported rates to eight.

Can somebody please verify if I'm right?

Btw iwlwifi generates the probe-request itself _only_ if hw_scan is enabled.
If hw_scan is disabled mac80211 generates the probe-request (which then should be correct) but the request gets somehow corrupted.

Thanks,
Helmut

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

maintainer
#5 lore raw
In reply to John W. Linville
Quoted 2 lines · John W. Linville

P.S. Is limiting this to STA mode correct? Would wpa_supplicant ever set that flag for an IBSS?

Regardless of whether wpa_supplicant does, the user can always do that with iwlist. I think it should be done regardless of mode.

johannes

#6 lore raw
In reply to John W. Linville

The patch seems not to work for me, I tested with 2.6.23-6.fc8 (where the patch is included)... played with ap_scan ... disabled hw_scan but I was unable to acciotate.

#7 lore raw
Quoted 3 lines · dragoran

The patch seems not to work for me, I tested with 2.6.23-6.fc8 (where the patch is included)... played with ap_scan ... disabled hw_scan but I was unable to acciotate.

Yeah, it seems like a no-op to me as well. Does it actually help anyone?

Signature · 2 lines
John W. Linville
[email protected]