aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-28 23:54:55 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:46 -0400
commitd8efea254887128d710cc1475505514da004932c (patch)
tree450ce4f6bbc1fca6468de784c1ce7b6d34b2059e
parent785e8f2679ce9ae703f1c737aa4d48b315d511ca (diff)
[PATCH] libertas: remove structure WLAN_802_11_SSID and libertas_escape_essid
Replace WLAN_802_11_SSID with direct 'ssid' and 'ssid_len' members like ieee80211. In the process, remove private libertas_escape_essid and depend on the ieee80211 implementation of escape_essid instead. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/Kconfig1
-rw-r--r--drivers/net/wireless/libertas/assoc.c74
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c23
-rw-r--r--drivers/net/wireless/libertas/debugfs.c9
-rw-r--r--drivers/net/wireless/libertas/dev.h11
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h8
-rw-r--r--drivers/net/wireless/libertas/join.c48
-rw-r--r--drivers/net/wireless/libertas/join.h3
-rw-r--r--drivers/net/wireless/libertas/scan.c66
-rw-r--r--drivers/net/wireless/libertas/scan.h18
-rw-r--r--drivers/net/wireless/libertas/wext.c42
11 files changed, 143 insertions, 160 deletions
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 89514f3e06c8..fa2399cbd5ca 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -269,6 +269,7 @@ config IPW2200_DEBUG
269config LIBERTAS 269config LIBERTAS
270 tristate "Marvell 8xxx Libertas WLAN driver support" 270 tristate "Marvell 8xxx Libertas WLAN driver support"
271 depends on WLAN_80211 271 depends on WLAN_80211
272 select IEEE80211
272 select FW_LOADER 273 select FW_LOADER
273 ---help--- 274 ---help---
274 A library for Marvell Libertas 8xxx devices. 275 A library for Marvell Libertas 8xxx devices.
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index bf804d311422..c2029b397503 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -14,30 +14,6 @@
14static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 14static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
15static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 15static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
16 16
17/* From ieee80211_module.c */
18static const char *libertas_escape_essid(const char *essid, u8 essid_len)
19{
20 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
21 const char *s = essid;
22 char *d = escaped;
23
24 if (ieee80211_is_empty_essid(essid, essid_len))
25 return "";
26
27 essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
28 while (essid_len--) {
29 if (*s == '\0') {
30 *d++ = '\\';
31 *d++ = '0';
32 s++;
33 } else {
34 *d++ = *s++;
35 }
36 }
37 *d = '\0';
38 return escaped;
39}
40
41static void print_assoc_req(const char * extra, struct assoc_request * assoc_req) 17static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
42{ 18{
43 lbs_deb_assoc( 19 lbs_deb_assoc(
@@ -51,7 +27,7 @@ static void print_assoc_req(const char * extra, struct assoc_request * assoc_req
51 " Encryption:%s%s%s\n" 27 " Encryption:%s%s%s\n"
52 " auth: %d\n", 28 " auth: %d\n",
53 extra, assoc_req->flags, 29 extra, assoc_req->flags,
54 libertas_escape_essid(assoc_req->ssid.ssid, assoc_req->ssid.ssidlength), 30 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
55 assoc_req->channel, assoc_req->band, assoc_req->mode, 31 assoc_req->channel, assoc_req->band, assoc_req->mode,
56 MAC_ARG(assoc_req->bssid), 32 MAC_ARG(assoc_req->bssid),
57 assoc_req->secinfo.WPAenabled ? " WPA" : "", 33 assoc_req->secinfo.WPAenabled ? " WPA" : "",
@@ -78,41 +54,43 @@ static int assoc_helper_essid(wlan_private *priv,
78 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) 54 if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
79 channel = assoc_req->channel; 55 channel = assoc_req->channel;
80 56
81 lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid); 57 lbs_deb_assoc("New SSID requested: '%s'\n",
58 escape_essid(assoc_req->ssid, assoc_req->ssid_len));
82 if (assoc_req->mode == IW_MODE_INFRA) { 59 if (assoc_req->mode == IW_MODE_INFRA) {
83 if (adapter->prescan) { 60 if (adapter->prescan) {
84 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0); 61 libertas_send_specific_SSID_scan(priv, assoc_req->ssid,
62 assoc_req->ssid_len, 0);
85 } 63 }
86 64
87 bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 65 bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid,
88 NULL, IW_MODE_INFRA, channel); 66 assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
89 if (bss != NULL) { 67 if (bss != NULL) {
90 lbs_deb_assoc("SSID found in scan list, associating\n"); 68 lbs_deb_assoc("SSID found in scan list, associating\n");
91 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); 69 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
92 ret = wlan_associate(priv, assoc_req); 70 ret = wlan_associate(priv, assoc_req);
93 } else { 71 } else {
94 lbs_deb_assoc("SSID '%s' not found; cannot associate\n", 72 lbs_deb_assoc("SSID not found; cannot associate\n");
95 assoc_req->ssid.ssid);
96 } 73 }
97 } else if (assoc_req->mode == IW_MODE_ADHOC) { 74 } else if (assoc_req->mode == IW_MODE_ADHOC) {
98 /* Scan for the network, do not save previous results. Stale 75 /* Scan for the network, do not save previous results. Stale
99 * scan data will cause us to join a non-existant adhoc network 76 * scan data will cause us to join a non-existant adhoc network
100 */ 77 */
101 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 78 libertas_send_specific_SSID_scan(priv, assoc_req->ssid,
79 assoc_req->ssid_len, 1);
102 80
103 /* Search for the requested SSID in the scan table */ 81 /* Search for the requested SSID in the scan table */
104 bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 82 bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid,
105 IW_MODE_ADHOC, channel); 83 assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
106 if (bss != NULL) { 84 if (bss != NULL) {
107 lbs_deb_assoc("SSID found joining\n"); 85 lbs_deb_assoc("SSID found, will join\n");
108 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor)); 86 memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
109 libertas_join_adhoc_network(priv, assoc_req); 87 libertas_join_adhoc_network(priv, assoc_req);
110 } else { 88 } else {
111 /* else send START command */ 89 /* else send START command */
112 lbs_deb_assoc("SSID not found in list, so creating adhoc" 90 lbs_deb_assoc("SSID not found, creating adhoc network\n");
113 " with SSID '%s'\n", assoc_req->ssid.ssid);
114 memcpy(&assoc_req->bss.ssid, &assoc_req->ssid, 91 memcpy(&assoc_req->bss.ssid, &assoc_req->ssid,
115 sizeof(struct WLAN_802_11_SSID)); 92 IW_ESSID_MAX_SIZE);
93 assoc_req->bss.ssid_len = assoc_req->ssid_len;
116 libertas_start_adhoc_network(priv, assoc_req); 94 libertas_start_adhoc_network(priv, assoc_req);
117 } 95 }
118 } 96 }
@@ -441,10 +419,9 @@ static int should_stop_adhoc(wlan_adapter *adapter,
441 if (adapter->connect_status != libertas_connected) 419 if (adapter->connect_status != libertas_connected)
442 return 0; 420 return 0;
443 421
444 if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength) 422 if (libertas_SSID_cmp(adapter->curbssparams.ssid,
445 return 1; 423 adapter->curbssparams.ssid_len,
446 if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid, 424 assoc_req->ssid, assoc_req->ssid_len) != 0)
447 adapter->curbssparams.ssid.ssidlength))
448 return 1; 425 return 1;
449 426
450 /* FIXME: deal with 'auto' mode somehow */ 427 /* FIXME: deal with 'auto' mode somehow */
@@ -485,7 +462,7 @@ void libertas_association_worker(struct work_struct *work)
485 462
486 /* If 'any' SSID was specified, find an SSID to associate with */ 463 /* If 'any' SSID was specified, find an SSID to associate with */
487 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags) 464 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
488 && !assoc_req->ssid.ssidlength) 465 && !assoc_req->ssid_len)
489 find_any_ssid = 1; 466 find_any_ssid = 1;
490 467
491 /* But don't use 'any' SSID if there's a valid locked BSSID to use */ 468 /* But don't use 'any' SSID if there's a valid locked BSSID to use */
@@ -498,8 +475,8 @@ void libertas_association_worker(struct work_struct *work)
498 if (find_any_ssid) { 475 if (find_any_ssid) {
499 u8 new_mode; 476 u8 new_mode;
500 477
501 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 478 ret = libertas_find_best_network_SSID(priv, assoc_req->ssid,
502 assoc_req->mode, &new_mode); 479 &assoc_req->ssid_len, assoc_req->mode, &new_mode);
503 if (ret) { 480 if (ret) {
504 lbs_deb_assoc("Could not find best network\n"); 481 lbs_deb_assoc("Could not find best network\n");
505 ret = -ENETUNREACH; 482 ret = -ENETUNREACH;
@@ -613,8 +590,8 @@ lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
613 if (success) { 590 if (success) {
614 lbs_deb_assoc("ASSOC: association attempt successful. " 591 lbs_deb_assoc("ASSOC: association attempt successful. "
615 "Associated to '%s' (" MAC_FMT ")\n", 592 "Associated to '%s' (" MAC_FMT ")\n",
616 libertas_escape_essid(adapter->curbssparams.ssid.ssid, 593 escape_essid(adapter->curbssparams.ssid,
617 adapter->curbssparams.ssid.ssidlength), 594 adapter->curbssparams.ssid_len),
618 MAC_ARG(adapter->curbssparams.bssid)); 595 MAC_ARG(adapter->curbssparams.bssid));
619 libertas_prepare_and_send_command(priv, 596 libertas_prepare_and_send_command(priv,
620 cmd_802_11_rssi, 597 cmd_802_11_rssi,
@@ -667,7 +644,8 @@ struct assoc_request * wlan_get_association_request(wlan_adapter *adapter)
667 assoc_req = adapter->pending_assoc_req; 644 assoc_req = adapter->pending_assoc_req;
668 if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 645 if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
669 memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid, 646 memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
670 sizeof(struct WLAN_802_11_SSID)); 647 IW_ESSID_MAX_SIZE);
648 assoc_req->ssid_len = adapter->curbssparams.ssid_len;
671 } 649 }
672 650
673 if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags)) 651 if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index 9385df52d7a2..ebedd630d72e 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -61,25 +61,28 @@ void libertas_mac_event_disconnected(wlan_private * priv)
61 adapter->nextSNRNF = 0; 61 adapter->nextSNRNF = 0;
62 adapter->numSNRNF = 0; 62 adapter->numSNRNF = 0;
63 adapter->rxpd_rate = 0; 63 adapter->rxpd_rate = 0;
64 lbs_deb_cmd("Current SSID=%s, ssid length=%u\n", 64 lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
65 adapter->curbssparams.ssid.ssid, 65 escape_essid(adapter->curbssparams.ssid,
66 adapter->curbssparams.ssid.ssidlength); 66 adapter->curbssparams.ssid_len),
67 lbs_deb_cmd("Previous SSID=%s, ssid length=%u\n", 67 adapter->curbssparams.ssid_len);
68 adapter->previousssid.ssid, adapter->previousssid.ssidlength); 68 lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
69 escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
70 adapter->prev_ssid_len);
69 71
70 adapter->connect_status = libertas_disconnected; 72 adapter->connect_status = libertas_disconnected;
71 73
72 /* Save previous SSID and BSSID for possible reassociation */ 74 /* Save previous SSID and BSSID for possible reassociation */
73 memcpy(&adapter->previousssid, 75 memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
74 &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID)); 76 IW_ESSID_MAX_SIZE);
75 memcpy(adapter->previousbssid, 77 adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
76 adapter->curbssparams.bssid, ETH_ALEN); 78 memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
77 79
78 /* Clear out associated SSID and BSSID since connection is 80 /* Clear out associated SSID and BSSID since connection is
79 * no longer valid. 81 * no longer valid.
80 */ 82 */
81 memset(&adapter->curbssparams.bssid, 0, ETH_ALEN); 83 memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
82 memset(&adapter->curbssparams.ssid, 0, sizeof(struct WLAN_802_11_SSID)); 84 memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
85 adapter->curbssparams.ssid_len = 0;
83 86
84 if (adapter->psstate != PS_STATE_FULL_POWER) { 87 if (adapter->psstate != PS_STATE_FULL_POWER) {
85 /* make firmware to exit PS mode */ 88 /* make firmware to exit PS mode */
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index b62ebca9ab6d..902b4be19d40 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -84,7 +84,8 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
84 iter_bss->cap.spectrummgmt ? 'S' : ' '); 84 iter_bss->cap.spectrummgmt ? 'S' : ' ');
85 pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); 85 pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
86 pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi)); 86 pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
87 pos += snprintf(buf+pos, len-pos, " %s\n", iter_bss->ssid.ssid); 87 pos += snprintf(buf+pos, len-pos, " %s\n",
88 escape_essid(iter_bss->ssid, iter_bss->ssid_len));
88 89
89 numscansdone++; 90 numscansdone++;
90 } 91 }
@@ -174,7 +175,6 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
174{ 175{
175 wlan_private *priv = file->private_data; 176 wlan_private *priv = file->private_data;
176 ssize_t res, buf_size; 177 ssize_t res, buf_size;
177 struct WLAN_802_11_SSID extscan_ssid;
178 union iwreq_data wrqu; 178 union iwreq_data wrqu;
179 unsigned long addr = get_zeroed_page(GFP_KERNEL); 179 unsigned long addr = get_zeroed_page(GFP_KERNEL);
180 char *buf = (char *)addr; 180 char *buf = (char *)addr;
@@ -185,10 +185,7 @@ static ssize_t libertas_extscan(struct file *file, const char __user *userbuf,
185 goto out_unlock; 185 goto out_unlock;
186 } 186 }
187 187
188 memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1); 188 libertas_send_specific_SSID_scan(priv, buf, strlen(buf)-1, 0);
189 extscan_ssid.ssidlength = strlen(buf)-1;
190
191 libertas_send_specific_SSID_scan(priv, &extscan_ssid, 0);
192 189
193 memset(&wrqu, 0, sizeof(union iwreq_data)); 190 memset(&wrqu, 0, sizeof(union iwreq_data));
194 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL); 191 wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index 91ac744ab9bc..d6c340aef681 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -66,7 +66,8 @@ struct current_bss_params {
66 /** bssid */ 66 /** bssid */
67 u8 bssid[ETH_ALEN]; 67 u8 bssid[ETH_ALEN];
68 /** ssid */ 68 /** ssid */
69 struct WLAN_802_11_SSID ssid; 69 u8 ssid[IW_ESSID_MAX_SIZE + 1];
70 u8 ssid_len;
70 71
71 /** band */ 72 /** band */
72 u8 band; 73 u8 band;
@@ -178,7 +179,8 @@ struct assoc_request {
178#define ASSOC_FLAG_WPA_IE 11 179#define ASSOC_FLAG_WPA_IE 11
179 unsigned long flags; 180 unsigned long flags;
180 181
181 struct WLAN_802_11_SSID ssid; 182 u8 ssid[IW_ESSID_MAX_SIZE + 1];
183 u8 ssid_len;
182 u8 channel; 184 u8 channel;
183 u8 band; 185 u8 band;
184 u8 mode; 186 u8 mode;
@@ -256,8 +258,9 @@ struct _wlan_adapter {
256 /* IW_MODE_* */ 258 /* IW_MODE_* */
257 u8 mode; 259 u8 mode;
258 260
259 struct WLAN_802_11_SSID previousssid; 261 u8 prev_ssid[IW_ESSID_MAX_SIZE + 1];
260 u8 previousbssid[ETH_ALEN]; 262 u8 prev_ssid_len;
263 u8 prev_bssid[ETH_ALEN];
261 264
262 /* Scan results list */ 265 /* Scan results list */
263 struct list_head network_list; 266 struct list_head network_list;
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index dc66cf525339..0a3a89905e2d 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -102,14 +102,6 @@ struct IE_WPA {
102 __le16 version; 102 __le16 version;
103}; 103};
104 104
105struct WLAN_802_11_SSID {
106 /* SSID length */
107 __le32 ssidlength;
108
109 /* SSID information field */
110 u8 ssid[IW_ESSID_MAX_SIZE];
111};
112
113struct WPA_SUPPLICANT { 105struct WPA_SUPPLICANT {
114 u8 wpa_ie[256]; 106 u8 wpa_ie[256];
115 u8 wpa_ie_len; 107 u8 wpa_ie_len;
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index b728f7fb9e34..1f866aa29a62 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -184,18 +184,20 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso
184 struct bss_descriptor * bss = &assoc_req->bss; 184 struct bss_descriptor * bss = &assoc_req->bss;
185 int ret = 0; 185 int ret = 0;
186 186
187 lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n", 187 lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
188 adapter->curbssparams.ssid.ssid); 188 __func__,
189 lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n", 189 escape_essid(adapter->curbssparams.ssid,
190 adapter->curbssparams.ssid.ssidlength); 190 adapter->curbssparams.ssid_len),
191 lbs_deb_join("libertas_join_adhoc_network: ssid = '%s'\n", 191 adapter->curbssparams.ssid_len);
192 bss->ssid.ssid); 192 lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
193 lbs_deb_join("libertas_join_adhoc_network: ssid len = %u\n", 193 __func__, escape_essid(bss->ssid, bss->ssid_len),
194 bss->ssid.ssidlength); 194 bss->ssid_len);
195 195
196 /* check if the requested SSID is already joined */ 196 /* check if the requested SSID is already joined */
197 if (adapter->curbssparams.ssid.ssidlength 197 if (adapter->curbssparams.ssid_len
198 && !libertas_SSID_cmp(&bss->ssid, &adapter->curbssparams.ssid) 198 && !libertas_SSID_cmp(adapter->curbssparams.ssid,
199 adapter->curbssparams.ssid_len,
200 bss->ssid, bss->ssid_len)
199 && (adapter->mode == IW_MODE_ADHOC)) { 201 && (adapter->mode == IW_MODE_ADHOC)) {
200 lbs_deb_join( 202 lbs_deb_join(
201 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " 203 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
@@ -362,9 +364,9 @@ int libertas_cmd_80211_associate(wlan_private * priv,
362 364
363 ssid = (struct mrvlietypes_ssidparamset *) pos; 365 ssid = (struct mrvlietypes_ssidparamset *) pos;
364 ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); 366 ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
365 tmplen = bss->ssid.ssidlength; 367 tmplen = bss->ssid_len;
366 ssid->header.len = cpu_to_le16(tmplen); 368 ssid->header.len = cpu_to_le16(tmplen);
367 memcpy(ssid->ssid, bss->ssid.ssid, tmplen); 369 memcpy(ssid->ssid, bss->ssid, tmplen);
368 pos += sizeof(ssid->header) + tmplen; 370 pos += sizeof(ssid->header) + tmplen;
369 371
370 phy = (struct mrvlietypes_phyparamset *) pos; 372 phy = (struct mrvlietypes_phyparamset *) pos;
@@ -482,9 +484,11 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
482 */ 484 */
483 485
484 memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE); 486 memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
485 memcpy(adhs->SSID, assoc_req->ssid.ssid, assoc_req->ssid.ssidlength); 487 memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len);
486 488
487 lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID); 489 lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
490 escape_essid(assoc_req->ssid, assoc_req->ssid_len),
491 assoc_req->ssid_len);
488 492
489 /* set the BSS type */ 493 /* set the BSS type */
490 adhs->bsstype = cmd_bss_type_ibss; 494 adhs->bsstype = cmd_bss_type_ibss;
@@ -600,7 +604,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
600 padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod); 604 padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
601 605
602 memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); 606 memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
603 memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); 607 memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
604 608
605 memcpy(&padhocjoin->bssdescriptor.phyparamset, 609 memcpy(&padhocjoin->bssdescriptor.phyparamset,
606 &bss->phyparamset, sizeof(union ieeetypes_phyparamset)); 610 &bss->phyparamset, sizeof(union ieeetypes_phyparamset));
@@ -733,11 +737,12 @@ int libertas_ret_80211_associate(wlan_private * priv,
733 /* Send a Media Connected event, according to the Spec */ 737 /* Send a Media Connected event, according to the Spec */
734 adapter->connect_status = libertas_connected; 738 adapter->connect_status = libertas_connected;
735 739
736 lbs_deb_join("ASSOC_RESP: %s\n", bss->ssid.ssid); 740 lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
741 escape_essid(bss->ssid, bss->ssid_len));
737 742
738 /* Update current SSID and BSSID */ 743 /* Update current SSID and BSSID */
739 memcpy(&adapter->curbssparams.ssid, 744 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
740 &bss->ssid, sizeof(struct WLAN_802_11_SSID)); 745 adapter->curbssparams.ssid_len = bss->ssid_len;
741 memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); 746 memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
742 747
743 lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n", 748 lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
@@ -821,7 +826,8 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
821 * Now the join cmd should be successful 826 * Now the join cmd should be successful
822 * If BSSID has changed use SSID to compare instead of BSSID 827 * If BSSID has changed use SSID to compare instead of BSSID
823 */ 828 */
824 lbs_deb_join("ADHOC_RESP: %s\n", bss->ssid.ssid); 829 lbs_deb_join("ADHOC_RESP: associated to '%s'\n",
830 escape_essid(bss->ssid, bss->ssid_len));
825 831
826 /* Send a Media Connected event, according to the Spec */ 832 /* Send a Media Connected event, according to the Spec */
827 adapter->connect_status = libertas_connected; 833 adapter->connect_status = libertas_connected;
@@ -835,8 +841,8 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
835 memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); 841 memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
836 842
837 /* Set the new SSID to current SSID */ 843 /* Set the new SSID to current SSID */
838 memcpy(&adapter->curbssparams.ssid, &bss->ssid, 844 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
839 sizeof(struct WLAN_802_11_SSID)); 845 adapter->curbssparams.ssid_len = bss->ssid_len;
840 846
841 netif_carrier_on(priv->dev); 847 netif_carrier_on(priv->dev);
842 netif_wake_queue(priv->dev); 848 netif_wake_queue(priv->dev);
diff --git a/drivers/net/wireless/libertas/join.h b/drivers/net/wireless/libertas/join.h
index c84e33cf8752..d522630ff8cf 100644
--- a/drivers/net/wireless/libertas/join.h
+++ b/drivers/net/wireless/libertas/join.h
@@ -40,9 +40,6 @@ extern int libertas_ret_80211_associate(wlan_private * priv,
40 40
41extern int libertas_reassociation_thread(void *data); 41extern int libertas_reassociation_thread(void *data);
42 42
43struct WLAN_802_11_SSID;
44struct bss_descriptor;
45
46extern int libertas_start_adhoc_network(wlan_private * priv, 43extern int libertas_start_adhoc_network(wlan_private * priv,
47 struct assoc_request * assoc_req); 44 struct assoc_request * assoc_req);
48extern int libertas_join_adhoc_network(wlan_private * priv, 45extern int libertas_join_adhoc_network(wlan_private * priv,
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 */
1197int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2) 1200int 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 */
1264struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter, 1264struct 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 */
1371int libertas_find_best_network_SSID(wlan_private * priv, 1372int 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 */
1436int libertas_send_specific_SSID_scan(wlan_private * priv, 1435int 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/**
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h
index 60a09e347f45..9ace3478c62a 100644
--- a/drivers/net/wireless/libertas/scan.h
+++ b/drivers/net/wireless/libertas/scan.h
@@ -137,7 +137,8 @@ struct wlan_ioctl_user_scan_cfg {
137struct bss_descriptor { 137struct bss_descriptor {
138 u8 bssid[ETH_ALEN]; 138 u8 bssid[ETH_ALEN];
139 139
140 struct WLAN_802_11_SSID ssid; 140 u8 ssid[IW_ESSID_MAX_SIZE + 1];
141 u8 ssid_len;
141 142
142 /* WEP encryption requirement */ 143 /* WEP encryption requirement */
143 u32 privacy; 144 u32 privacy;
@@ -174,11 +175,10 @@ struct bss_descriptor {
174 struct list_head list; 175 struct list_head list;
175}; 176};
176 177
177extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, 178extern int libertas_SSID_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
178 struct WLAN_802_11_SSID *ssid2);
179 179
180struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter, 180struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter,
181 struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode, 181 u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
182 int channel); 182 int channel);
183 183
184struct bss_descriptor * libertas_find_best_SSID_in_list(wlan_adapter * adapter, 184struct bss_descriptor * libertas_find_best_SSID_in_list(wlan_adapter * adapter,
@@ -187,13 +187,11 @@ struct bss_descriptor * libertas_find_best_SSID_in_list(wlan_adapter * adapter,
187extern struct bss_descriptor * libertas_find_BSSID_in_list(wlan_adapter * adapter, 187extern struct bss_descriptor * libertas_find_BSSID_in_list(wlan_adapter * adapter,
188 u8 * bssid, u8 mode); 188 u8 * bssid, u8 mode);
189 189
190int libertas_find_best_network_SSID(wlan_private * priv, 190int libertas_find_best_network_SSID(wlan_private * priv, u8 *out_ssid,
191 struct WLAN_802_11_SSID *pSSID, 191 u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
192 u8 preferred_mode, u8 *out_mode);
193 192
194extern int libertas_send_specific_SSID_scan(wlan_private * priv, 193extern int libertas_send_specific_SSID_scan(wlan_private * priv, u8 *ssid,
195 struct WLAN_802_11_SSID *prequestedssid, 194 u8 ssid_len, u8 clear_ssid);
196 u8 clear_ssid);
197extern int libertas_send_specific_BSSID_scan(wlan_private * priv, 195extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
198 u8 * bssid, u8 clear_bssid); 196 u8 * bssid, u8 clear_bssid);
199 197
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 5b7e5f257d62..8939251a2f4c 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -2163,12 +2163,12 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2163 * Get the current SSID 2163 * Get the current SSID
2164 */ 2164 */
2165 if (adapter->connect_status == libertas_connected) { 2165 if (adapter->connect_status == libertas_connected) {
2166 memcpy(extra, adapter->curbssparams.ssid.ssid, 2166 memcpy(extra, adapter->curbssparams.ssid,
2167 adapter->curbssparams.ssid.ssidlength); 2167 adapter->curbssparams.ssid_len);
2168 extra[adapter->curbssparams.ssid.ssidlength] = '\0'; 2168 extra[adapter->curbssparams.ssid_len] = '\0';
2169 } else { 2169 } else {
2170 memset(extra, 0, 32); 2170 memset(extra, 0, 32);
2171 extra[adapter->curbssparams.ssid.ssidlength] = '\0'; 2171 extra[adapter->curbssparams.ssid_len] = '\0';
2172 } 2172 }
2173 /* 2173 /*
2174 * If none, we may want to get the one that was set 2174 * If none, we may want to get the one that was set
@@ -2176,10 +2176,10 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2176 2176
2177 /* To make the driver backward compatible with WPA supplicant v0.2.4 */ 2177 /* To make the driver backward compatible with WPA supplicant v0.2.4 */
2178 if (dwrq->length == 32) /* check with WPA supplicant buffer size */ 2178 if (dwrq->length == 32) /* check with WPA supplicant buffer size */
2179 dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength, 2179 dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len,
2180 IW_ESSID_MAX_SIZE); 2180 IW_ESSID_MAX_SIZE);
2181 else 2181 else
2182 dwrq->length = adapter->curbssparams.ssid.ssidlength + 1; 2182 dwrq->length = adapter->curbssparams.ssid_len + 1;
2183 2183
2184 dwrq->flags = 1; /* active */ 2184 dwrq->flags = 1; /* active */
2185 2185
@@ -2193,9 +2193,10 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2193 wlan_private *priv = dev->priv; 2193 wlan_private *priv = dev->priv;
2194 wlan_adapter *adapter = priv->adapter; 2194 wlan_adapter *adapter = priv->adapter;
2195 int ret = 0; 2195 int ret = 0;
2196 struct WLAN_802_11_SSID ssid; 2196 u8 ssid[IW_ESSID_MAX_SIZE];
2197 u8 ssid_len = 0;
2197 struct assoc_request * assoc_req; 2198 struct assoc_request * assoc_req;
2198 int ssid_len = dwrq->length; 2199 int in_ssid_len = dwrq->length;
2199 2200
2200 lbs_deb_enter(LBS_DEB_WEXT); 2201 lbs_deb_enter(LBS_DEB_WEXT);
2201 2202
@@ -2204,27 +2205,31 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2204 * SSID length so it can be used like a string. WE-21 and later don't, 2205 * SSID length so it can be used like a string. WE-21 and later don't,
2205 * but some userspace tools aren't able to cope with the change. 2206 * but some userspace tools aren't able to cope with the change.
2206 */ 2207 */
2207 if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0')) 2208 if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0'))
2208 ssid_len--; 2209 in_ssid_len--;
2209 2210
2210 /* Check the size of the string */ 2211 /* Check the size of the string */
2211 if (ssid_len > IW_ESSID_MAX_SIZE) { 2212 if (in_ssid_len > IW_ESSID_MAX_SIZE) {
2212 ret = -E2BIG; 2213 ret = -E2BIG;
2213 goto out; 2214 goto out;
2214 } 2215 }
2215 2216
2216 memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID)); 2217 memset(&ssid, 0, sizeof(ssid));
2217 2218
2218 if (!dwrq->flags || !ssid_len) { 2219 if (!dwrq->flags || !in_ssid_len) {
2219 /* "any" SSID requested; leave SSID blank */ 2220 /* "any" SSID requested; leave SSID blank */
2220 } else { 2221 } else {
2221 /* Specific SSID requested */ 2222 /* Specific SSID requested */
2222 memcpy(&ssid.ssid, extra, ssid_len); 2223 memcpy(&ssid, extra, in_ssid_len);
2223 ssid.ssidlength = ssid_len; 2224 ssid_len = in_ssid_len;
2224 } 2225 }
2225 2226
2226 lbs_deb_wext("requested new SSID '%s'\n", 2227 if (!ssid_len) {
2227 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); 2228 lbs_deb_wext("requested any SSID\n");
2229 } else {
2230 lbs_deb_wext("requested SSID '%s'\n",
2231 escape_essid(ssid, ssid_len));
2232 }
2228 2233
2229out: 2234out:
2230 mutex_lock(&adapter->lock); 2235 mutex_lock(&adapter->lock);
@@ -2235,7 +2240,8 @@ out:
2235 ret = -ENOMEM; 2240 ret = -ENOMEM;
2236 } else { 2241 } else {
2237 /* Copy the SSID to the association request */ 2242 /* Copy the SSID to the association request */
2238 memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID)); 2243 memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE);
2244 assoc_req->ssid_len = ssid_len;
2239 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags); 2245 set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
2240 wlan_postpone_association_work(priv); 2246 wlan_postpone_association_work(priv);
2241 } 2247 }