config LIBERTAS
tristate "Marvell 8xxx Libertas WLAN driver support"
depends on WLAN_80211
+ select IEEE80211
select FW_LOADER
---help---
A library for Marvell Libertas 8xxx devices.
static const u8 bssid_any[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
static const u8 bssid_off[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-/* From ieee80211_module.c */
-static const char *libertas_escape_essid(const char *essid, u8 essid_len)
-{
- static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
- const char *s = essid;
- char *d = escaped;
-
- if (ieee80211_is_empty_essid(essid, essid_len))
- return "";
-
- essid_len = min(essid_len, (u8) IW_ESSID_MAX_SIZE);
- while (essid_len--) {
- if (*s == '\0') {
- *d++ = '\\';
- *d++ = '0';
- s++;
- } else {
- *d++ = *s++;
- }
- }
- *d = '\0';
- return escaped;
-}
-
static void print_assoc_req(const char * extra, struct assoc_request * assoc_req)
{
lbs_deb_assoc(
" Encryption:%s%s%s\n"
" auth: %d\n",
extra, assoc_req->flags,
- libertas_escape_essid(assoc_req->ssid.ssid, assoc_req->ssid.ssidlength),
+ escape_essid(assoc_req->ssid, assoc_req->ssid_len),
assoc_req->channel, assoc_req->band, assoc_req->mode,
MAC_ARG(assoc_req->bssid),
assoc_req->secinfo.WPAenabled ? " WPA" : "",
if (test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
channel = assoc_req->channel;
- lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid);
+ lbs_deb_assoc("New SSID requested: '%s'\n",
+ escape_essid(assoc_req->ssid, assoc_req->ssid_len));
if (assoc_req->mode == IW_MODE_INFRA) {
if (adapter->prescan) {
- libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 0);
+ libertas_send_specific_SSID_scan(priv, assoc_req->ssid,
+ assoc_req->ssid_len, 0);
}
- bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
- NULL, IW_MODE_INFRA, channel);
+ bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid,
+ assoc_req->ssid_len, NULL, IW_MODE_INFRA, channel);
if (bss != NULL) {
lbs_deb_assoc("SSID found in scan list, associating\n");
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
ret = wlan_associate(priv, assoc_req);
} else {
- lbs_deb_assoc("SSID '%s' not found; cannot associate\n",
- assoc_req->ssid.ssid);
+ lbs_deb_assoc("SSID not found; cannot associate\n");
}
} else if (assoc_req->mode == IW_MODE_ADHOC) {
/* Scan for the network, do not save previous results. Stale
* scan data will cause us to join a non-existant adhoc network
*/
- libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
+ libertas_send_specific_SSID_scan(priv, assoc_req->ssid,
+ assoc_req->ssid_len, 1);
/* Search for the requested SSID in the scan table */
- bss = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
- IW_MODE_ADHOC, channel);
+ bss = libertas_find_SSID_in_list(adapter, assoc_req->ssid,
+ assoc_req->ssid_len, NULL, IW_MODE_ADHOC, channel);
if (bss != NULL) {
- lbs_deb_assoc("SSID found joining\n");
+ lbs_deb_assoc("SSID found, will join\n");
memcpy(&assoc_req->bss, bss, sizeof(struct bss_descriptor));
libertas_join_adhoc_network(priv, assoc_req);
} else {
/* else send START command */
- lbs_deb_assoc("SSID not found in list, so creating adhoc"
- " with SSID '%s'\n", assoc_req->ssid.ssid);
+ lbs_deb_assoc("SSID not found, creating adhoc network\n");
memcpy(&assoc_req->bss.ssid, &assoc_req->ssid,
- sizeof(struct WLAN_802_11_SSID));
+ IW_ESSID_MAX_SIZE);
+ assoc_req->bss.ssid_len = assoc_req->ssid_len;
libertas_start_adhoc_network(priv, assoc_req);
}
}
if (adapter->connect_status != libertas_connected)
return 0;
- if (adapter->curbssparams.ssid.ssidlength != assoc_req->ssid.ssidlength)
- return 1;
- if (memcmp(adapter->curbssparams.ssid.ssid, assoc_req->ssid.ssid,
- adapter->curbssparams.ssid.ssidlength))
+ if (libertas_SSID_cmp(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len,
+ assoc_req->ssid, assoc_req->ssid_len) != 0)
return 1;
/* FIXME: deal with 'auto' mode somehow */
/* If 'any' SSID was specified, find an SSID to associate with */
if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)
- && !assoc_req->ssid.ssidlength)
+ && !assoc_req->ssid_len)
find_any_ssid = 1;
/* But don't use 'any' SSID if there's a valid locked BSSID to use */
if (find_any_ssid) {
u8 new_mode;
- ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
- assoc_req->mode, &new_mode);
+ ret = libertas_find_best_network_SSID(priv, assoc_req->ssid,
+ &assoc_req->ssid_len, assoc_req->mode, &new_mode);
if (ret) {
lbs_deb_assoc("Could not find best network\n");
ret = -ENETUNREACH;
if (success) {
lbs_deb_assoc("ASSOC: association attempt successful. "
"Associated to '%s' (" MAC_FMT ")\n",
- libertas_escape_essid(adapter->curbssparams.ssid.ssid,
- adapter->curbssparams.ssid.ssidlength),
+ escape_essid(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len),
MAC_ARG(adapter->curbssparams.bssid));
libertas_prepare_and_send_command(priv,
cmd_802_11_rssi,
assoc_req = adapter->pending_assoc_req;
if (!test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
memcpy(&assoc_req->ssid, &adapter->curbssparams.ssid,
- sizeof(struct WLAN_802_11_SSID));
+ IW_ESSID_MAX_SIZE);
+ assoc_req->ssid_len = adapter->curbssparams.ssid_len;
}
if (!test_bit(ASSOC_FLAG_CHANNEL, &assoc_req->flags))
adapter->nextSNRNF = 0;
adapter->numSNRNF = 0;
adapter->rxpd_rate = 0;
- lbs_deb_cmd("Current SSID=%s, ssid length=%u\n",
- adapter->curbssparams.ssid.ssid,
- adapter->curbssparams.ssid.ssidlength);
- lbs_deb_cmd("Previous SSID=%s, ssid length=%u\n",
- adapter->previousssid.ssid, adapter->previousssid.ssidlength);
+ lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
+ escape_essid(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len),
+ adapter->curbssparams.ssid_len);
+ lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
+ escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
+ adapter->prev_ssid_len);
adapter->connect_status = libertas_disconnected;
/* Save previous SSID and BSSID for possible reassociation */
- memcpy(&adapter->previousssid,
- &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID));
- memcpy(adapter->previousbssid,
- adapter->curbssparams.bssid, ETH_ALEN);
+ memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
+ IW_ESSID_MAX_SIZE);
+ adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
+ memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
/* Clear out associated SSID and BSSID since connection is
* no longer valid.
*/
memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
- memset(&adapter->curbssparams.ssid, 0, sizeof(struct WLAN_802_11_SSID));
+ memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
+ adapter->curbssparams.ssid_len = 0;
if (adapter->psstate != PS_STATE_FULL_POWER) {
/* make firmware to exit PS mode */
iter_bss->cap.spectrummgmt ? 'S' : ' ');
pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf);
pos += snprintf(buf+pos, len-pos, " %d |", SCAN_RSSI(iter_bss->rssi));
- pos += snprintf(buf+pos, len-pos, " %s\n", iter_bss->ssid.ssid);
+ pos += snprintf(buf+pos, len-pos, " %s\n",
+ escape_essid(iter_bss->ssid, iter_bss->ssid_len));
numscansdone++;
}
{
wlan_private *priv = file->private_data;
ssize_t res, buf_size;
- struct WLAN_802_11_SSID extscan_ssid;
union iwreq_data wrqu;
unsigned long addr = get_zeroed_page(GFP_KERNEL);
char *buf = (char *)addr;
goto out_unlock;
}
- memcpy(&extscan_ssid.ssid, buf, strlen(buf)-1);
- extscan_ssid.ssidlength = strlen(buf)-1;
-
- libertas_send_specific_SSID_scan(priv, &extscan_ssid, 0);
+ libertas_send_specific_SSID_scan(priv, buf, strlen(buf)-1, 0);
memset(&wrqu, 0, sizeof(union iwreq_data));
wireless_send_event(priv->dev, SIOCGIWSCAN, &wrqu, NULL);
/** bssid */
u8 bssid[ETH_ALEN];
/** ssid */
- struct WLAN_802_11_SSID ssid;
+ u8 ssid[IW_ESSID_MAX_SIZE + 1];
+ u8 ssid_len;
/** band */
u8 band;
#define ASSOC_FLAG_WPA_IE 11
unsigned long flags;
- struct WLAN_802_11_SSID ssid;
+ u8 ssid[IW_ESSID_MAX_SIZE + 1];
+ u8 ssid_len;
u8 channel;
u8 band;
u8 mode;
/* IW_MODE_* */
u8 mode;
- struct WLAN_802_11_SSID previousssid;
- u8 previousbssid[ETH_ALEN];
+ u8 prev_ssid[IW_ESSID_MAX_SIZE + 1];
+ u8 prev_ssid_len;
+ u8 prev_bssid[ETH_ALEN];
/* Scan results list */
struct list_head network_list;
__le16 version;
};
-struct WLAN_802_11_SSID {
- /* SSID length */
- __le32 ssidlength;
-
- /* SSID information field */
- u8 ssid[IW_ESSID_MAX_SIZE];
-};
-
struct WPA_SUPPLICANT {
u8 wpa_ie[256];
u8 wpa_ie_len;
struct bss_descriptor * bss = &assoc_req->bss;
int ret = 0;
- lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n",
- adapter->curbssparams.ssid.ssid);
- lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
- adapter->curbssparams.ssid.ssidlength);
- lbs_deb_join("libertas_join_adhoc_network: ssid = '%s'\n",
- bss->ssid.ssid);
- lbs_deb_join("libertas_join_adhoc_network: ssid len = %u\n",
- bss->ssid.ssidlength);
+ lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
+ __func__,
+ escape_essid(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len),
+ adapter->curbssparams.ssid_len);
+ lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
+ __func__, escape_essid(bss->ssid, bss->ssid_len),
+ bss->ssid_len);
/* check if the requested SSID is already joined */
- if (adapter->curbssparams.ssid.ssidlength
- && !libertas_SSID_cmp(&bss->ssid, &adapter->curbssparams.ssid)
+ if (adapter->curbssparams.ssid_len
+ && !libertas_SSID_cmp(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len,
+ bss->ssid, bss->ssid_len)
&& (adapter->mode == IW_MODE_ADHOC)) {
lbs_deb_join(
"ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
ssid = (struct mrvlietypes_ssidparamset *) pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
- tmplen = bss->ssid.ssidlength;
+ tmplen = bss->ssid_len;
ssid->header.len = cpu_to_le16(tmplen);
- memcpy(ssid->ssid, bss->ssid.ssid, tmplen);
+ memcpy(ssid->ssid, bss->ssid, tmplen);
pos += sizeof(ssid->header) + tmplen;
phy = (struct mrvlietypes_phyparamset *) pos;
*/
memset(adhs->SSID, 0, IW_ESSID_MAX_SIZE);
- memcpy(adhs->SSID, assoc_req->ssid.ssid, assoc_req->ssid.ssidlength);
+ memcpy(adhs->SSID, assoc_req->ssid, assoc_req->ssid_len);
- lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
+ lbs_deb_join("ADHOC_S_CMD: SSID '%s', ssid length %u\n",
+ escape_essid(assoc_req->ssid, assoc_req->ssid_len),
+ assoc_req->ssid_len);
/* set the BSS type */
adhs->bsstype = cmd_bss_type_ibss;
padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
- memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength);
+ memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len);
memcpy(&padhocjoin->bssdescriptor.phyparamset,
&bss->phyparamset, sizeof(union ieeetypes_phyparamset));
/* Send a Media Connected event, according to the Spec */
adapter->connect_status = libertas_connected;
- lbs_deb_join("ASSOC_RESP: %s\n", bss->ssid.ssid);
+ lbs_deb_join("ASSOC_RESP: assocated to '%s'\n",
+ escape_essid(bss->ssid, bss->ssid_len));
/* Update current SSID and BSSID */
- memcpy(&adapter->curbssparams.ssid,
- &bss->ssid, sizeof(struct WLAN_802_11_SSID));
+ memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
+ adapter->curbssparams.ssid_len = bss->ssid_len;
memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
* Now the join cmd should be successful
* If BSSID has changed use SSID to compare instead of BSSID
*/
- lbs_deb_join("ADHOC_RESP: %s\n", bss->ssid.ssid);
+ lbs_deb_join("ADHOC_RESP: associated to '%s'\n",
+ escape_essid(bss->ssid, bss->ssid_len));
/* Send a Media Connected event, according to the Spec */
adapter->connect_status = libertas_connected;
memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN);
/* Set the new SSID to current SSID */
- memcpy(&adapter->curbssparams.ssid, &bss->ssid,
- sizeof(struct WLAN_802_11_SSID));
+ memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
+ adapter->curbssparams.ssid_len = bss->ssid_len;
netif_carrier_on(priv->dev);
netif_wake_queue(priv->dev);
extern int libertas_reassociation_thread(void *data);
-struct WLAN_802_11_SSID;
-struct bss_descriptor;
-
extern int libertas_start_adhoc_network(wlan_private * priv,
struct assoc_request * assoc_req);
extern int libertas_join_adhoc_network(wlan_private * priv,
{
wlan_adapter *adapter = priv->adapter;
struct bss_descriptor * iter_bss;
+ int i = 0;
if (adapter->connect_status == libertas_connected)
return;
list_for_each_entry (iter_bss, &adapter->network_list, list) {
lbs_deb_scan("Scan:(%02d) " MAC_FMT ", RSSI[%03d], SSID[%s]\n",
i++, MAC_ARG(iter_bss->bssid), (s32) iter_bss->rssi,
- iter_bss->ssid.ssid);
+ escape_essid(iter_bss->ssid, iter_bss->ssid_len));
}
mutex_unlock(&adapter->lock);
}
/* Check for an SSID match */
if ( clear_ssid_flag
- && (bss->ssid.ssidlength == scan_cfg->ssid_len)
- && !memcmp(bss->ssid.ssid, scan_cfg->ssid, bss->ssid.ssidlength))
+ && (bss->ssid_len == scan_cfg->ssid_len)
+ && !memcmp(bss->ssid, scan_cfg->ssid, bss->ssid_len))
clear = 1;
/* Check for a BSSID match */
switch (elemID) {
case SSID:
- bss->ssid.ssidlength = elemlen;
- memcpy(bss->ssid.ssid, (pcurrentptr + 2), elemlen);
- lbs_deb_scan("ssid '%s'\n", bss->ssid.ssid);
+ bss->ssid_len = elemlen;
+ memcpy(bss->ssid, (pcurrentptr + 2), elemlen);
+ lbs_deb_scan("ssid '%s', ssid length %u\n",
+ escape_essid(bss->ssid, bss->ssid_len),
+ bss->ssid_len);
break;
case SUPPORTED_RATES:
*
* @return 0--ssid is same, otherwise is different
*/
-int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1, struct WLAN_802_11_SSID *ssid2)
+int libertas_SSID_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len)
{
- if (!ssid1 || !ssid2)
+ if (ssid1_len != ssid2_len)
return -1;
- if (ssid1->ssidlength != ssid2->ssidlength)
- return -1;
-
- return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssidlength);
+ return memcmp(ssid1, ssid2, ssid1_len);
}
/**
* @return index in BSSID list
*/
struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter,
- struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode,
+ u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
int channel)
{
u8 bestrssi = 0;
|| (iter_bss->last_scanned < tmp_oldest->last_scanned))
tmp_oldest = iter_bss;
- if (libertas_SSID_cmp(&iter_bss->ssid, ssid) != 0)
+ if (libertas_SSID_cmp(iter_bss->ssid, iter_bss->ssid_len,
+ ssid, ssid_len) != 0)
continue; /* ssid doesn't match */
if (bssid && compare_ether_addr(iter_bss->bssid, bssid) != 0)
continue; /* bssid doesn't match */
* @return 0--success, otherwise--fail
*/
int libertas_find_best_network_SSID(wlan_private * priv,
- struct WLAN_802_11_SSID *ssid,
- u8 preferred_mode, u8 *out_mode)
+ u8 *out_ssid, u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode)
{
wlan_adapter *adapter = priv->adapter;
int ret = -1;
lbs_deb_enter(LBS_DEB_ASSOC);
- memset(ssid, 0, sizeof(struct WLAN_802_11_SSID));
-
wlan_scan_networks(priv, NULL, 1);
if (adapter->surpriseremoved)
return -1;
wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
found = libertas_find_best_SSID_in_list(adapter, preferred_mode);
- if (found && (found->ssid.ssidlength > 0)) {
- memcpy(ssid, &found->ssid, sizeof(struct WLAN_802_11_SSID));
+ if (found && (found->ssid_len > 0)) {
+ memcpy(out_ssid, &found->ssid, IW_ESSID_MAX_SIZE);
+ *out_ssid_len = found->ssid_len;
*out_mode = found->mode;
ret = 0;
}
* @return 0-success, otherwise fail
*/
int libertas_send_specific_SSID_scan(wlan_private * priv,
- struct WLAN_802_11_SSID *prequestedssid,
- u8 clear_ssid)
+ u8 *ssid, u8 ssid_len, u8 clear_ssid)
{
wlan_adapter *adapter = priv->adapter;
struct wlan_ioctl_user_scan_cfg scancfg;
lbs_deb_enter(LBS_DEB_ASSOC);
- if (prequestedssid == NULL)
+ if (!ssid_len)
goto out;
memset(&scancfg, 0x00, sizeof(scancfg));
- memcpy(scancfg.ssid, prequestedssid->ssid, prequestedssid->ssidlength);
- scancfg.ssid_len = prequestedssid->ssidlength;
+ memcpy(scancfg.ssid, ssid, ssid_len);
+ scancfg.ssid_len = ssid_len;
scancfg.clear_ssid = clear_ssid;
wlan_scan_networks(priv, &scancfg, 1);
/* SSID */
iwe.cmd = SIOCGIWESSID;
iwe.u.data.flags = 1;
- iwe.u.data.length = min(bss->ssid.ssidlength, (u32) IW_ESSID_MAX_SIZE);
- start = iwe_stream_add_point(start, stop, &iwe, bss->ssid.ssid);
+ iwe.u.data.length = min((u32) bss->ssid_len, (u32) IW_ESSID_MAX_SIZE);
+ start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
/* Mode */
iwe.cmd = SIOCGIWMODE;
*/
if ((adapter->mode == IW_MODE_ADHOC)
&& adapter->adhoccreate
- && !libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid)) {
+ && !libertas_SSID_cmp(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len,
+ bss->ssid, bss->ssid_len)) {
int snr, nf;
snr = adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
nf = adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
iwe.u.data.flags = IW_ENCODE_DISABLED;
}
iwe.u.data.length = 0;
- start = iwe_stream_add_point(start, stop, &iwe, bss->ssid.ssid);
+ start = iwe_stream_add_point(start, stop, &iwe, bss->ssid);
current_val = start + IW_EV_LCP_LEN;
stop, &iwe, IW_EV_PARAM_LEN);
}
if ((bss->mode == IW_MODE_ADHOC)
- && !libertas_SSID_cmp(&adapter->curbssparams.ssid, &bss->ssid)
+ && !libertas_SSID_cmp(adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len,
+ bss->ssid, bss->ssid_len)
&& adapter->adhoccreate) {
iwe.u.bitrate.value = 22 * 500000;
current_val = iwe_stream_add_value(start, current_val,
/* A network is only a duplicate if the channel, BSSID, and ESSID
* all match. We treat all <hidden> with the same BSSID and channel
* as one network */
- return ((src->ssid.ssidlength == dst->ssid.ssidlength) &&
+ return ((src->ssid_len == dst->ssid_len) &&
(src->channel == dst->channel) &&
!compare_ether_addr(src->bssid, dst->bssid) &&
- !memcmp(src->ssid.ssid, dst->ssid.ssid, src->ssid.ssidlength));
+ !memcmp(src->ssid, dst->ssid, src->ssid_len));
}
/**
struct bss_descriptor {
u8 bssid[ETH_ALEN];
- struct WLAN_802_11_SSID ssid;
+ u8 ssid[IW_ESSID_MAX_SIZE + 1];
+ u8 ssid_len;
/* WEP encryption requirement */
u32 privacy;
struct list_head list;
};
-extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
- struct WLAN_802_11_SSID *ssid2);
+extern int libertas_SSID_cmp(u8 *ssid1, u8 ssid1_len, u8 *ssid2, u8 ssid2_len);
struct bss_descriptor * libertas_find_SSID_in_list(wlan_adapter * adapter,
- struct WLAN_802_11_SSID *ssid, u8 * bssid, u8 mode,
+ u8 *ssid, u8 ssid_len, u8 * bssid, u8 mode,
int channel);
struct bss_descriptor * libertas_find_best_SSID_in_list(wlan_adapter * adapter,
extern struct bss_descriptor * libertas_find_BSSID_in_list(wlan_adapter * adapter,
u8 * bssid, u8 mode);
-int libertas_find_best_network_SSID(wlan_private * priv,
- struct WLAN_802_11_SSID *pSSID,
- u8 preferred_mode, u8 *out_mode);
+int libertas_find_best_network_SSID(wlan_private * priv, u8 *out_ssid,
+ u8 *out_ssid_len, u8 preferred_mode, u8 *out_mode);
-extern int libertas_send_specific_SSID_scan(wlan_private * priv,
- struct WLAN_802_11_SSID *prequestedssid,
- u8 clear_ssid);
+extern int libertas_send_specific_SSID_scan(wlan_private * priv, u8 *ssid,
+ u8 ssid_len, u8 clear_ssid);
extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
u8 * bssid, u8 clear_bssid);
* Get the current SSID
*/
if (adapter->connect_status == libertas_connected) {
- memcpy(extra, adapter->curbssparams.ssid.ssid,
- adapter->curbssparams.ssid.ssidlength);
- extra[adapter->curbssparams.ssid.ssidlength] = '\0';
+ memcpy(extra, adapter->curbssparams.ssid,
+ adapter->curbssparams.ssid_len);
+ extra[adapter->curbssparams.ssid_len] = '\0';
} else {
memset(extra, 0, 32);
- extra[adapter->curbssparams.ssid.ssidlength] = '\0';
+ extra[adapter->curbssparams.ssid_len] = '\0';
}
/*
* If none, we may want to get the one that was set
/* To make the driver backward compatible with WPA supplicant v0.2.4 */
if (dwrq->length == 32) /* check with WPA supplicant buffer size */
- dwrq->length = min_t(size_t, adapter->curbssparams.ssid.ssidlength,
+ dwrq->length = min_t(size_t, adapter->curbssparams.ssid_len,
IW_ESSID_MAX_SIZE);
else
- dwrq->length = adapter->curbssparams.ssid.ssidlength + 1;
+ dwrq->length = adapter->curbssparams.ssid_len + 1;
dwrq->flags = 1; /* active */
wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter;
int ret = 0;
- struct WLAN_802_11_SSID ssid;
+ u8 ssid[IW_ESSID_MAX_SIZE];
+ u8 ssid_len = 0;
struct assoc_request * assoc_req;
- int ssid_len = dwrq->length;
+ int in_ssid_len = dwrq->length;
lbs_deb_enter(LBS_DEB_WEXT);
* SSID length so it can be used like a string. WE-21 and later don't,
* but some userspace tools aren't able to cope with the change.
*/
- if ((ssid_len > 0) && (extra[ssid_len - 1] == '\0'))
- ssid_len--;
+ if ((in_ssid_len > 0) && (extra[in_ssid_len - 1] == '\0'))
+ in_ssid_len--;
/* Check the size of the string */
- if (ssid_len > IW_ESSID_MAX_SIZE) {
+ if (in_ssid_len > IW_ESSID_MAX_SIZE) {
ret = -E2BIG;
goto out;
}
- memset(&ssid, 0, sizeof(struct WLAN_802_11_SSID));
+ memset(&ssid, 0, sizeof(ssid));
- if (!dwrq->flags || !ssid_len) {
+ if (!dwrq->flags || !in_ssid_len) {
/* "any" SSID requested; leave SSID blank */
} else {
/* Specific SSID requested */
- memcpy(&ssid.ssid, extra, ssid_len);
- ssid.ssidlength = ssid_len;
+ memcpy(&ssid, extra, in_ssid_len);
+ ssid_len = in_ssid_len;
}
- lbs_deb_wext("requested new SSID '%s'\n",
- (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
+ if (!ssid_len) {
+ lbs_deb_wext("requested any SSID\n");
+ } else {
+ lbs_deb_wext("requested SSID '%s'\n",
+ escape_essid(ssid, ssid_len));
+ }
out:
mutex_lock(&adapter->lock);
ret = -ENOMEM;
} else {
/* Copy the SSID to the association request */
- memcpy(&assoc_req->ssid, &ssid, sizeof(struct WLAN_802_11_SSID));
+ memcpy(&assoc_req->ssid, &ssid, IW_ESSID_MAX_SIZE);
+ assoc_req->ssid_len = ssid_len;
set_bit(ASSOC_FLAG_SSID, &assoc_req->flags);
wlan_postpone_association_work(priv);
}