Skip to contentSkip to conversation

mac80211: Fix queuing of scan containing a SSID

PATCH New Helmut Schaa 1 participant 3 messages Nov 9, 2007 mac80211

lore
Share & tools
lore
#0 lore raw

cover mac80211: Fix queuing of scan containing a SSID

The first patch fixes scanning for specific ssid's which is broken due to the scan being queued up without respecting the ssid to scan for.

The second patch removes all references to local->scan_flags as these are not used anymore since the removal of prism2 ioctls (see [1]). This is related to the first patch because of the scan flag IEEE80211_SCAN_MATCH_SSID getting removed too.

I'm not sure if it makes sense to only return ssid's matching the one scanned for as it was done when using IEEE80211_SCAN_MATCH_SSID (at least for wpa_supplicant it doesn't matter). Nevertheless the flag can be dropped as we could simply check for local->scan_ssid_len instead.

[1]
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-2.6.git;a=commit;h=51617f0b76389b29740aa9d7736df99b75d1d9ec

#1 lore raw

PATCH 1/2 mac80211: Fix queuing of scan containing a SSID

This patch fixes scanning for specific ssid's which is broken due to the scan being queued up without respecting the ssid to scan for.

---

net/mac80211/ieee80211_i.h +2 -0
index 4b4ed2a..d575ccd 100644
@@ -241,6 +241,8 @@ struct ieee80211_if_sta {
 	u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
 	u8 ssid[IEEE80211_MAX_SSID_LEN];
 	size_t ssid_len;
+	u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
+	size_t scan_ssid_len;
 	u16 aid;
 	u16 ap_capab, capab;
 	u8 *extra_ie; /* to be added to the end of AssocReq */
net/mac80211/ieee80211_ioctl.c +0 -0
net/mac80211/ieee80211_sta.c +4 -1
index f7ffeec..0b47328 100644
@@ -1998,7 +1998,10 @@ void ieee80211_sta_work(struct work_struct *work)
 	if (ifsta->state != IEEE80211_AUTHENTICATE &&
 	    ifsta->state != IEEE80211_ASSOCIATE &&
 	    test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
-		ieee80211_sta_start_scan(dev, NULL, 0);
+ 		if (ifsta->scan_ssid_len)
+ 			ieee80211_sta_start_scan(dev, ifsta->scan_ssid, ifsta->scan_ssid_len);
+ 		else
+ 			ieee80211_sta_start_scan(dev, NULL, 0);
 		return;
 	}
 
@@ -2867,6 +2870,9 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 

*ssid, size_t ssid_len)
return -EBUSY;
}

+ ifsta->scan_ssid_len = ssid_len;
+ if (ssid_len)
+ memcpy(ifsta->scan_ssid, ssid, ssid_len);
set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request); queue_work(local->hw.workqueue, &ifsta->work); return 0;

#2 lore raw

PATCH 2/2 mac80211: Remove local->scan_flags

This patch removes all references to local->scan_flags as these are not used anymore since the removal of prism2 ioctls.

---

net/mac80211/ieee80211_i.h +0 -4
index 4b4ed2a..31b634c 100644
@@ -481,10 +483,6 @@ struct ieee80211_local {
 	struct list_head sta_bss_list;
 	struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
 	spinlock_t sta_bss_lock;
-#define IEEE80211_SCAN_MATCH_SSID BIT(0)
-#define IEEE80211_SCAN_WPA_ONLY BIT(1)
-#define IEEE80211_SCAN_EXTRA_INFO BIT(2)
-	int scan_flags;
 
 	/* SNMP counters */
 	/* dot11CountersTable */
net/mac80211/ieee80211_ioctl.c +0 -1
index 6caa3ec..bd4804e 100644
@@ -513,7 +513,6 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
 				   struct iw_request_info *info,
 				   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;
@@ -522,21 +521,9 @@ static int ieee80211_ioctl_siwscan(struct net_device 

*dev,
if (!netif_running(dev))
return -ENETDOWN;

- switch (sdata->type) {
- case IEEE80211_IF_TYPE_STA:
- case IEEE80211_IF_TYPE_IBSS:
- if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
- ssid = sdata->u.sta.ssid;
- ssid_len = sdata->u.sta.ssid_len;
- }
- break;
- case IEEE80211_IF_TYPE_AP:
- if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
- ssid = sdata->u.ap.ssid;
- ssid_len = sdata->u.ap.ssid_len;
- }
- break;
- default:
+ if (sdata->type != IEEE80211_IF_TYPE_STA &&
+ sdata->type != IEEE80211_IF_TYPE_IBSS &&
+ sdata->type != IEEE80211_IF_TYPE_AP) {
return -EOPNOTSUPP;
}

net/mac80211/ieee80211_sta.c +0 -12
index f7ffeec..f4c76ea 100644
@@ -2887,15 +2893,6 @@ ieee80211_sta_scan_result(struct net_device *dev,
 	if (!(local->enabled_modes & (1 << bss->hw_mode)))
 		return current_ev;
 
-	if (local->scan_flags & IEEE80211_SCAN_WPA_ONLY &&
-	    !bss->wpa_ie && !bss->rsn_ie)
-		return current_ev;
-
-	if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID &&
-	    (local->scan_ssid_len != bss->ssid_len ||
-	     memcmp(local->scan_ssid, bss->ssid, bss->ssid_len) != 0))
-		return current_ev;
-
 	memset(&iwe, 0, sizeof(iwe));
 	iwe.cmd = SIOCGIWAP;
 	iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
@@ -3002,9 +2999,6 @@ ieee80211_sta_scan_result(struct net_device *dev,
 	do {
 		char *buf;
 
-		if (!(local->scan_flags & IEEE80211_SCAN_EXTRA_INFO))
-			break;
-
 		buf = kmalloc(100, GFP_ATOMIC);
 		if (!buf)
 			break;