diff options
author | Dan Williams <dcbw@redhat.com> | 2007-05-25 16:25:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2007-06-11 14:28:41 -0400 |
commit | eb8f7330e7edf655176c51a62cd2e34de91a1eba (patch) | |
tree | 383f19fd3741a2f240c976ee7dc89368581ac1f0 /drivers/net/wireless/libertas/debugfs.c | |
parent | fcdb53dbc743f288bf72e485fefb3a967b733686 (diff) |
[PATCH] libertas: fix 'keep previous scan' behavior
Do not clear the scan list except under specific conditions, such as
when (a) user-requested, or (b) joining/starting an adhoc network.
Furthermore, only clear entries which match the SSID or BSSID of the
request, not the whole scan list.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index c26227adf897..1545935f7a99 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -193,7 +193,7 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf, | |||
193 | memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1); | 193 | memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1); |
194 | extscan_ssid.ssidlength = strlen(buf)-1; | 194 | extscan_ssid.ssidlength = strlen(buf)-1; |
195 | 195 | ||
196 | libertas_send_specific_SSID_scan(priv, &extscan_ssid, 1); | 196 | libertas_send_specific_SSID_scan(priv, &extscan_ssid, 0); |
197 | 197 | ||
198 | memset(&wrqu, 0, sizeof(union iwreq_data)); | 198 | memset(&wrqu, 0, sizeof(union iwreq_data)); |
199 | wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); | 199 | wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); |
@@ -245,16 +245,13 @@ static void libertas_parse_bssid(char *buf, size_t count, | |||
245 | { | 245 | { |
246 | char *hold; | 246 | char *hold; |
247 | unsigned int mac[ETH_ALEN]; | 247 | unsigned int mac[ETH_ALEN]; |
248 | int i; | ||
249 | 248 | ||
250 | hold = strstr(buf, "bssid="); | 249 | hold = strstr(buf, "bssid="); |
251 | if (!hold) | 250 | if (!hold) |
252 | return; | 251 | return; |
253 | hold += 6; | 252 | hold += 6; |
254 | sscanf(hold, "%2x:%2x:%2x:%2x:%2x:%2x", mac, mac+1, mac+2, mac+3, | 253 | sscanf(hold, MAC_FMT, mac, mac+1, mac+2, mac+3, mac+4, mac+5); |
255 | mac+4, mac+5); | 254 | memcpy(scan_cfg->bssid, mac, ETH_ALEN); |
256 | for(i=0;i<ETH_ALEN;i++) | ||
257 | scan_cfg->specificBSSID[i] = mac[i]; | ||
258 | } | 255 | } |
259 | 256 | ||
260 | static void libertas_parse_ssid(char *buf, size_t count, | 257 | static void libertas_parse_ssid(char *buf, size_t count, |
@@ -272,28 +269,26 @@ static void libertas_parse_ssid(char *buf, size_t count, | |||
272 | end = buf + count - 1; | 269 | end = buf + count - 1; |
273 | 270 | ||
274 | size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); | 271 | size = min((size_t)IW_ESSID_MAX_SIZE, (size_t) (end - hold)); |
275 | strncpy(scan_cfg->specificSSID, hold, size); | 272 | strncpy(scan_cfg->ssid, hold, size); |
276 | 273 | ||
277 | return; | 274 | return; |
278 | } | 275 | } |
279 | 276 | ||
280 | static void libertas_parse_keep(char *buf, size_t count, | 277 | static int libertas_parse_clear(char *buf, size_t count, const char *tag) |
281 | struct wlan_ioctl_user_scan_cfg *scan_cfg) | ||
282 | { | 278 | { |
283 | char *hold; | 279 | char *hold; |
284 | int val; | 280 | int val; |
285 | 281 | ||
286 | hold = strstr(buf, "keep="); | 282 | hold = strstr(buf, tag); |
287 | if (!hold) | 283 | if (!hold) |
288 | return; | 284 | return 0; |
289 | hold += 5; | 285 | hold += strlen(tag); |
290 | sscanf(hold, "%d", &val); | 286 | sscanf(hold, "%d", &val); |
291 | 287 | ||
292 | if (val != 0) | 288 | if (val != 0) |
293 | val = 1; | 289 | val = 1; |
294 | 290 | ||
295 | scan_cfg->keeppreviousscan = val; | 291 | return val; |
296 | return; | ||
297 | } | 292 | } |
298 | 293 | ||
299 | static int libertas_parse_dur(char *buf, size_t count, | 294 | static int libertas_parse_dur(char *buf, size_t count, |
@@ -376,8 +371,9 @@ static ssize_t libertas_setuserscan(struct file *file, | |||
376 | dur = libertas_parse_dur(buf, count, scan_cfg); | 371 | dur = libertas_parse_dur(buf, count, scan_cfg); |
377 | libertas_parse_chan(buf, count, scan_cfg, dur); | 372 | libertas_parse_chan(buf, count, scan_cfg, dur); |
378 | libertas_parse_bssid(buf, count, scan_cfg); | 373 | libertas_parse_bssid(buf, count, scan_cfg); |
374 | scan_cfg->clear_bssid = libertas_parse_clear(buf, count, "clear_bssid="); | ||
379 | libertas_parse_ssid(buf, count, scan_cfg); | 375 | libertas_parse_ssid(buf, count, scan_cfg); |
380 | libertas_parse_keep(buf, count, scan_cfg); | 376 | scan_cfg->clear_ssid = libertas_parse_clear(buf, count, "clear_ssid="); |
381 | libertas_parse_probes(buf, count, scan_cfg); | 377 | libertas_parse_probes(buf, count, scan_cfg); |
382 | libertas_parse_type(buf, count, scan_cfg); | 378 | libertas_parse_type(buf, count, scan_cfg); |
383 | 379 | ||