diff options
Diffstat (limited to 'drivers/net/wireless/libertas/scan.c')
-rw-r--r-- | drivers/net/wireless/libertas/scan.c | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index 9799d87aaa3b..5790e8bc1aec 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -232,6 +232,7 @@ static void wlan_scan_process_results(wlan_private * priv) | |||
232 | { | 232 | { |
233 | wlan_adapter *adapter = priv->adapter; | 233 | wlan_adapter *adapter = priv->adapter; |
234 | struct bss_descriptor * iter_bss; | 234 | struct bss_descriptor * iter_bss; |
235 | int i = 0; | ||
235 | 236 | ||
236 | if (adapter->connect_status == libertas_connected) | 237 | if (adapter->connect_status == libertas_connected) |
237 | return; | 238 | return; |
@@ -240,7 +241,7 @@ static void wlan_scan_process_results(wlan_private * priv) | |||
240 | list_for_each_entry (iter_bss, &adapter->network_list, list) { | 241 | list_for_each_entry (iter_bss, &adapter->network_list, list) { |
241 | lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n", | 242 | lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n", |
242 | i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi, | 243 | i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi, |
243 | iter_bss->ssid.ssid); | 244 | escape_essid(iter_bss->ssid, iter_bss->ssid_len)); |
244 | } | 245 | } |
245 | mutex_unlock(&adapter->lock); | 246 | mutex_unlock(&adapter->lock); |
246 | } | 247 | } |
@@ -747,8 +748,8 @@ clear_selected_scan_list_entries(wlan_adapter * adapter, | |||
747 | 748 | ||
748 | /* Check for an SSID match */ | 749 | /* Check for an SSID match */ |
749 | if ( clear_ssid_flag | 750 | if ( clear_ssid_flag |
750 | && (bss->ssid.ssidlength == scan_cfg->ssid_len) | 751 | && (bss->ssid_len == scan_cfg->ssid_len) |
751 | && !memcmp(bss->ssid.ssid, scan_cfg->ssid, bss->ssid.ssidlength)) | 752 | && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len)) |
752 | clear = 1; | 753 | clear = 1; |
753 | 754 | ||
754 | /* Check for a BSSID match */ | 755 | /* Check for a BSSID match */ |
@@ -1048,9 +1049,11 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
1048 | 1049 | ||
1049 | switch (elemID) { | 1050 | switch (elemID) { |
1050 | case SSID: | 1051 | case SSID: |
1051 | bss->ssid.ssidlength = elemlen; | 1052 | bss->ssid_len = elemlen; |
1052 | memcpy(bss->ssid.ssid, (pcurrentptr + 2), elemlen); | 1053 | memcpy(bss->ssid, (pcurrentptr + 2), elemlen); |
1053 | lbs_deb_scan("ssid '%s'\n", bss->ssid.ssid); | 1054 | lbs_deb_scan("ssid '%s', ssid length %u\n", |
1055 | escape_essid(bss->ssid, bss->ssid_len), | ||
1056 | bss->ssid_len); | ||
1054 | break; | 1057 | break; |
1055 | 1058 | ||
1056 | case SUPPORTED_RATES: | 1059 | case SUPPORTED_RATES: |
@@ -1194,15 +1197,12 @@ done: | |||
1194 | * | 1197 | * |
1195 | * @return 0--ssid is same, otherwise is different | 1198 | * @return 0--ssid is same, otherwise is different |
1196 | */ | 1199 | */ |
1197 | int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2) | 1200 | int libertas_SSID_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len) |
1198 | { | 1201 | { |
1199 | if (!ssid1 || !ssid2) | 1202 | if (ssid1_len != ssid2_len) |
1200 | return -1; | 1203 | return -1; |
1201 | 1204 | ||
1202 | if (ssid1->ssidlength != ssid2->ssidlength) | 1205 | return memcmp(ssid1, ssid2, ssid1_len); |
1203 | return -1; | ||
1204 | |||
1205 | return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssidlength); | ||
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | /** | 1208 | /** |
@@ -1262,7 +1262,7 @@ struct bss_descriptor * libertas_find_BSSID_in_list(wlan_adapter * adapter, | |||
1262 | * @return index in BSSID list | 1262 | * @return index in BSSID list |
1263 | */ | 1263 | */ |
1264 | struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter, | 1264 | struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter, |
1265 | struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode, | 1265 | u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode, |
1266 | int channel) | 1266 | int channel) |
1267 | { | 1267 | { |
1268 | u8 bestrssi = 0; | 1268 | u8 bestrssi = 0; |
@@ -1277,7 +1277,8 @@ struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter, | |||
1277 | || (iter_bss->last_scanned < tmp_oldest->last_scanned)) | 1277 | || (iter_bss->last_scanned < tmp_oldest->last_scanned)) |
1278 | tmp_oldest = iter_bss; | 1278 | tmp_oldest = iter_bss; |
1279 | 1279 | ||
1280 | if (libertas_SSID_cmp(&iter_bss->ssid, ssid) != 0) | 1280 | if (libertas_SSID_cmp(iter_bss->ssid, iter_bss->ssid_len, |
1281 | ssid, ssid_len) != 0) | ||
1281 | continue; /* ssid doesn't match */ | 1282 | continue; /* ssid doesn't match */ |
1282 | if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0) | 1283 | if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0) |
1283 | continue; /* bssid doesn't match */ | 1284 | continue; /* bssid doesn't match */ |
@@ -1369,8 +1370,7 @@ struct bss_descriptor * libertas_find_best_SSID_in_list(wlan_adapter * adapter, | |||
1369 | * @return 0--success, otherwise--fail | 1370 | * @return 0--success, otherwise--fail |
1370 | */ | 1371 | */ |
1371 | int libertas_find_best_network_SSID(wlan_private * priv, | 1372 | int libertas_find_best_network_SSID(wlan_private * priv, |
1372 | struct WLAN_802_11_SSID *ssid, | 1373 | u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode) |
1373 | u8 preferred_mode, u8 *out_mode) | ||
1374 | { | 1374 | { |
1375 | wlan_adapter *adapter = priv->adapter; | 1375 | wlan_adapter *adapter = priv->adapter; |
1376 | int ret = -1; | 1376 | int ret = -1; |
@@ -1378,8 +1378,6 @@ int libertas_find_best_network_SSID(wlan_private * priv, | |||
1378 | 1378 | ||
1379 | lbs_deb_enter(LBS_DEB_ASSOC); | 1379 | lbs_deb_enter(LBS_DEB_ASSOC); |
1380 | 1380 | ||
1381 | memset(ssid, 0, sizeof(struct WLAN_802_11_SSID)); | ||
1382 | |||
1383 | wlan_scan_networks(priv, NULL, 1); | 1381 | wlan_scan_networks(priv, NULL, 1); |
1384 | if (adapter->surpriseremoved) | 1382 | if (adapter->surpriseremoved) |
1385 | return -1; | 1383 | return -1; |
@@ -1387,8 +1385,9 @@ int libertas_find_best_network_SSID(wlan_private * priv, | |||
1387 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); | 1385 | wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); |
1388 | 1386 | ||
1389 | found = libertas_find_best_SSID_in_list(adapter, preferred_mode); | 1387 | found = libertas_find_best_SSID_in_list(adapter, preferred_mode); |
1390 | if (found && (found->ssid.ssidlength > 0)) { | 1388 | if (found && (found->ssid_len > 0)) { |
1391 | memcpy(ssid, &found->ssid, sizeof(struct WLAN_802_11_SSID)); | 1389 | memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE); |
1390 | *out_ssid_len = found->ssid_len; | ||
1392 | *out_mode = found->mode; | 1391 | *out_mode = found->mode; |
1393 | ret = 0; | 1392 | ret = 0; |
1394 | } | 1393 | } |
@@ -1434,8 +1433,7 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info, | |||
1434 | * @return 0-success, otherwise fail | 1433 | * @return 0-success, otherwise fail |
1435 | */ | 1434 | */ |
1436 | int libertas_send_specific_SSID_scan(wlan_private * priv, | 1435 | int libertas_send_specific_SSID_scan(wlan_private * priv, |
1437 | struct WLAN_802_11_SSID *prequestedssid, | 1436 | u8 *ssid, u8 ssid_len, u8 clear_ssid) |
1438 | u8 clear_ssid) | ||
1439 | { | 1437 | { |
1440 | wlan_adapter *adapter = priv->adapter; | 1438 | wlan_adapter *adapter = priv->adapter; |
1441 | struct wlan_ioctl_user_scan_cfg scancfg; | 1439 | struct wlan_ioctl_user_scan_cfg scancfg; |
@@ -1443,12 +1441,12 @@ int libertas_send_specific_SSID_scan(wlan_private * priv, | |||
1443 | 1441 | ||
1444 | lbs_deb_enter(LBS_DEB_ASSOC); | 1442 | lbs_deb_enter(LBS_DEB_ASSOC); |
1445 | 1443 | ||
1446 | if (prequestedssid == NULL) | 1444 | if (!ssid_len) |
1447 | goto out; | 1445 | goto out; |
1448 | 1446 | ||
1449 | memset(&scancfg, 0x00, sizeof(scancfg)); | 1447 | memset(&scancfg, 0x00, sizeof(scancfg)); |
1450 | memcpy(scancfg.ssid, prequestedssid->ssid, prequestedssid->ssidlength); | 1448 | memcpy(scancfg.ssid, ssid, ssid_len); |
1451 | scancfg.ssid_len = prequestedssid->ssidlength; | 1449 | scancfg.ssid_len = ssid_len; |
1452 | scancfg.clear_ssid = clear_ssid; | 1450 | scancfg.clear_ssid = clear_ssid; |
1453 | 1451 | ||
1454 | wlan_scan_networks(priv, &scancfg, 1); | 1452 | wlan_scan_networks(priv, &scancfg, 1); |
@@ -1523,8 +1521,8 @@ static inline char *libertas_translate_scan(wlan_private *priv, | |||
1523 | /* SSID */ | 1521 | /* SSID */ |
1524 | iwe.cmd = SIOCGIWESSID; | 1522 | iwe.cmd = SIOCGIWESSID; |
1525 | iwe.u.data.flags = 1; | 1523 | iwe.u.data.flags = 1; |
1526 | iwe.u.data.length = min(bss->ssid.ssidlength, (u32) IW_ESSID_MAX_SIZE); | 1524 | iwe.u.data.length = min((u32) bss->ssid_len, (u32) IW_ESSID_MAX_SIZE); |
1527 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid.ssid); | 1525 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); |
1528 | 1526 | ||
1529 | /* Mode */ | 1527 | /* Mode */ |
1530 | iwe.cmd = SIOCGIWMODE; | 1528 | iwe.cmd = SIOCGIWMODE; |
@@ -1563,7 +1561,9 @@ static inline char *libertas_translate_scan(wlan_private *priv, | |||
1563 | */ | 1561 | */ |
1564 | if ((adapter->mode == IW_MODE_ADHOC) | 1562 | if ((adapter->mode == IW_MODE_ADHOC) |
1565 | && adapter->adhoccreate | 1563 | && adapter->adhoccreate |
1566 | && !libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid)) { | 1564 | && !libertas_SSID_cmp(adapter->curbssparams.ssid, |
1565 | adapter->curbssparams.ssid_len, | ||
1566 | bss->ssid, bss->ssid_len)) { | ||
1567 | int snr, nf; | 1567 | int snr, nf; |
1568 | snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; | 1568 | snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; |
1569 | nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; | 1569 | nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; |
@@ -1579,7 +1579,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, | |||
1579 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 1579 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
1580 | } | 1580 | } |
1581 | iwe.u.data.length = 0; | 1581 | iwe.u.data.length = 0; |
1582 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid.ssid); | 1582 | start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); |
1583 | 1583 | ||
1584 | current_val = start + IW_EV_LCP_LEN; | 1584 | current_val = start + IW_EV_LCP_LEN; |
1585 | 1585 | ||
@@ -1598,7 +1598,9 @@ static inline char *libertas_translate_scan(wlan_private *priv, | |||
1598 | stop, &iwe, IW_EV_PARAM_LEN); | 1598 | stop, &iwe, IW_EV_PARAM_LEN); |
1599 | } | 1599 | } |
1600 | if ((bss->mode == IW_MODE_ADHOC) | 1600 | if ((bss->mode == IW_MODE_ADHOC) |
1601 | && !libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid) | 1601 | && !libertas_SSID_cmp(adapter->curbssparams.ssid, |
1602 | adapter->curbssparams.ssid_len, | ||
1603 | bss->ssid, bss->ssid_len) | ||
1602 | && adapter->adhoccreate) { | 1604 | && adapter->adhoccreate) { |
1603 | iwe.u.bitrate.value = 22 * 500000; | 1605 | iwe.u.bitrate.value = 22 * 500000; |
1604 | current_val = iwe_stream_add_value(start, current_val, | 1606 | current_val = iwe_stream_add_value(start, current_val, |
@@ -1753,10 +1755,10 @@ static inline int is_same_network(struct bss_descriptor *src, | |||
1753 | /* A network is only a duplicate if the channel, BSSID, and ESSID | 1755 | /* A network is only a duplicate if the channel, BSSID, and ESSID |
1754 | * all match. We treat all <hidden> with the same BSSID and channel | 1756 | * all match. We treat all <hidden> with the same BSSID and channel |
1755 | * as one network */ | 1757 | * as one network */ |
1756 | return ((src->ssid.ssidlength == dst->ssid.ssidlength) && | 1758 | return ((src->ssid_len == dst->ssid_len) && |
1757 | (src->channel == dst->channel) && | 1759 | (src->channel == dst->channel) && |
1758 | !compare_ether_addr(src->bssid, dst->bssid) && | 1760 | !compare_ether_addr(src->bssid, dst->bssid) && |
1759 | !memcmp(src->ssid.ssid, dst->ssid.ssid, src->ssid.ssidlength)); | 1761 | !memcmp(src->ssid, dst->ssid, src->ssid_len)); |
1760 | } | 1762 | } |
1761 | 1763 | ||
1762 | /** | 1764 | /** |