Commit 0c9ca690 authored by Dan Williams's avatar Dan Williams Committed by David S. Miller

[PATCH] libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types

Use standard BSS capability field constants from ieee80211.h.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6dbc9c89
...@@ -70,18 +70,18 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf, ...@@ -70,18 +70,18 @@ static ssize_t libertas_getscantable(struct file *file, char __user *userbuf,
mutex_lock(&priv->adapter->lock); mutex_lock(&priv->adapter->lock);
list_for_each_entry (iter_bss, &priv->adapter->network_list, list) { list_for_each_entry (iter_bss, &priv->adapter->network_list, list) {
u16 cap; u16 ibss = (iter_bss->capability & WLAN_CAPABILITY_IBSS);
u16 privacy = (iter_bss->capability & WLAN_CAPABILITY_PRIVACY);
u16 spectrum_mgmt = (iter_bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT);
memcpy(&cap, &iter_bss->cap, sizeof(cap));
pos += snprintf(buf+pos, len-pos, pos += snprintf(buf+pos, len-pos,
"%02u| %03d | %03ld | " MAC_FMT " |", "%02u| %03d | %03ld | " MAC_FMT " |",
numscansdone, iter_bss->channel, iter_bss->rssi, numscansdone, iter_bss->channel, iter_bss->rssi,
MAC_ARG(iter_bss->bssid)); MAC_ARG(iter_bss->bssid));
pos += snprintf(buf+pos, len-pos, " %04x-", cap); pos += snprintf(buf+pos, len-pos, " %04x-", iter_bss->capability);
pos += snprintf(buf+pos, len-pos, "%c%c%c |", pos += snprintf(buf+pos, len-pos, "%c%c%c |",
iter_bss->cap.ibss ? 'A' : 'I', ibss ? 'A' : 'I', privacy ? 'P' : ' ',
iter_bss->cap.privacy ? 'P' : ' ', spectrum_mgmt ? 'S' : ' ');
iter_bss->cap.spectrummgmt ? 'S' : ' ');
pos += snprintf(buf+pos, len-pos, " %08llx |", iter_bss->networktsf); 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, " %d |", SCAN_RSSI(iter_bss->rssi));
pos += snprintf(buf+pos, len-pos, " %s\n", pos += snprintf(buf+pos, len-pos, " %s\n",
......
...@@ -275,7 +275,7 @@ struct _wlan_adapter { ...@@ -275,7 +275,7 @@ struct _wlan_adapter {
u8 adhoccreate; u8 adhoccreate;
/** capability Info used in Association, start, join */ /** capability Info used in Association, start, join */
struct ieeetypes_capinfo capinfo; u16 capability;
/** MAC address information */ /** MAC address information */
u8 current_addr[ETH_ALEN]; u8 current_addr[ETH_ALEN];
......
...@@ -217,10 +217,8 @@ static void wlan_init_adapter(wlan_private * priv) ...@@ -217,10 +217,8 @@ static void wlan_init_adapter(wlan_private * priv)
adapter->is_datarate_auto = 1; adapter->is_datarate_auto = 1;
adapter->beaconperiod = MRVDRV_BEACON_INTERVAL; adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
// set default value of capinfo. // set default capabilities
#define SHORT_PREAMBLE_ALLOWED 1 adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
memset(&adapter->capinfo, 0, sizeof(adapter->capinfo));
adapter->capinfo.shortpreamble = SHORT_PREAMBLE_ALLOWED;
adapter->psmode = wlan802_11powermodecam; adapter->psmode = wlan802_11powermodecam;
adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM; adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
......
...@@ -108,12 +108,6 @@ struct wlan_offset_value { ...@@ -108,12 +108,6 @@ struct wlan_offset_value {
u32 value; u32 value;
}; };
struct WLAN_802_11_FIXED_IEs {
__le64 timestamp;
__le16 beaconinterval;
u16 capabilities; /* Actually struct ieeetypes_capinfo */
};
struct WLAN_802_11_VARIABLE_IEs { struct WLAN_802_11_VARIABLE_IEs {
u8 elementid; u8 elementid;
u8 length; u8 length;
...@@ -237,7 +231,7 @@ struct cmd_ds_802_11_deauthenticate { ...@@ -237,7 +231,7 @@ struct cmd_ds_802_11_deauthenticate {
struct cmd_ds_802_11_associate { struct cmd_ds_802_11_associate {
u8 peerstaaddr[6]; u8 peerstaaddr[6];
struct ieeetypes_capinfo capinfo; __le16 capability;
__le16 listeninterval; __le16 listeninterval;
__le16 bcnperiod; __le16 bcnperiod;
u8 dtimperiod; u8 dtimperiod;
...@@ -469,22 +463,22 @@ struct cmd_ds_802_11_ad_hoc_start { ...@@ -469,22 +463,22 @@ struct cmd_ds_802_11_ad_hoc_start {
union IEEEtypes_ssparamset ssparamset; union IEEEtypes_ssparamset ssparamset;
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
__le16 probedelay; __le16 probedelay;
struct ieeetypes_capinfo cap; __le16 capability;
u8 datarate[G_SUPPORTED_RATES]; u8 datarate[G_SUPPORTED_RATES];
u8 tlv_memory_size_pad[100]; u8 tlv_memory_size_pad[100];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct adhoc_bssdesc { struct adhoc_bssdesc {
u8 BSSID[6]; u8 bssid[6];
u8 SSID[32]; u8 ssid[32];
u8 bsstype; u8 type;
__le16 beaconperiod; __le16 beaconperiod;
u8 dtimperiod; u8 dtimperiod;
__le64 timestamp; __le64 timestamp;
__le64 localtime; __le64 localtime;
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
union IEEEtypes_ssparamset ssparamset; union IEEEtypes_ssparamset ssparamset;
struct ieeetypes_capinfo cap; __le16 capability;
u8 datarates[G_SUPPORTED_RATES]; u8 datarates[G_SUPPORTED_RATES];
/* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the /* DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
...@@ -494,7 +488,7 @@ struct adhoc_bssdesc { ...@@ -494,7 +488,7 @@ struct adhoc_bssdesc {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_ad_hoc_join { struct cmd_ds_802_11_ad_hoc_join {
struct adhoc_bssdesc bssdescriptor; struct adhoc_bssdesc bss;
__le16 failtimeout; __le16 failtimeout;
__le16 probedelay; __le16 probedelay;
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "dev.h" #include "dev.h"
#include "assoc.h" #include "assoc.h"
#define AD_HOC_CAP_PRIVACY_ON 1
/** /**
* @brief This function finds out the common rates between rate1 and rate2. * @brief This function finds out the common rates between rate1 and rate2.
* *
...@@ -121,7 +119,8 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req) ...@@ -121,7 +119,8 @@ int wlan_associate(wlan_private * priv, struct assoc_request * assoc_req)
goto done; goto done;
/* set preamble to firmware */ /* set preamble to firmware */
if (adapter->capinfo.shortpreamble && assoc_req->bss.cap.shortpreamble) if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
&& (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE))
adapter->preamble = cmd_type_short_preamble; adapter->preamble = cmd_type_short_preamble;
else else
adapter->preamble = cmd_type_long_preamble; adapter->preamble = cmd_type_long_preamble;
...@@ -150,12 +149,12 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass ...@@ -150,12 +149,12 @@ int libertas_start_adhoc_network(wlan_private * priv, struct assoc_request * ass
adapter->adhoccreate = 1; adapter->adhoccreate = 1;
if (!adapter->capinfo.shortpreamble) { if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) {
lbs_deb_join("AdhocStart: Long preamble\n");
adapter->preamble = cmd_type_long_preamble;
} else {
lbs_deb_join("AdhocStart: Short preamble\n"); lbs_deb_join("AdhocStart: Short preamble\n");
adapter->preamble = cmd_type_short_preamble; adapter->preamble = cmd_type_short_preamble;
} else {
lbs_deb_join("AdhocStart: Long preamble\n");
adapter->preamble = cmd_type_long_preamble;
} }
libertas_set_radio_control(priv); libertas_set_radio_control(priv);
...@@ -205,9 +204,10 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso ...@@ -205,9 +204,10 @@ int libertas_join_adhoc_network(wlan_private * priv, struct assoc_request * asso
return -1; return -1;
} }
/*Use shortpreamble only when both creator and card supports /* Use shortpreamble only when both creator and card supports
short preamble */ short preamble */
if (!bss->cap.shortpreamble || !adapter->capinfo.shortpreamble) { if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
|| !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
lbs_deb_join("AdhocJoin: Long preamble\n"); lbs_deb_join("AdhocJoin: Long preamble\n");
adapter->preamble = cmd_type_long_preamble; adapter->preamble = cmd_type_long_preamble;
} else { } else {
...@@ -357,7 +357,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -357,7 +357,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
/* set the listen interval */ /* set the listen interval */
passo->listeninterval = cpu_to_le16(adapter->listeninterval); passo->listeninterval = cpu_to_le16(adapter->listeninterval);
pos += sizeof(passo->capinfo); pos += sizeof(passo->capability);
pos += sizeof(passo->listeninterval); pos += sizeof(passo->listeninterval);
pos += sizeof(passo->bcnperiod); pos += sizeof(passo->bcnperiod);
pos += sizeof(passo->dtimperiod); pos += sizeof(passo->dtimperiod);
...@@ -427,12 +427,6 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -427,12 +427,6 @@ int libertas_cmd_80211_associate(wlan_private * priv,
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
cpu_to_le16(rates->header.len)); cpu_to_le16(rates->header.len));
/* set IBSS field */
if (bss->mode == IW_MODE_INFRA) {
#define CAPINFO_ESS_MODE 1
passo->capinfo.ess = CAPINFO_ESS_MODE;
}
if (libertas_parse_dnld_countryinfo_11d(priv, bss)) { if (libertas_parse_dnld_countryinfo_11d(priv, bss)) {
ret = -1; ret = -1;
goto done; goto done;
...@@ -440,12 +434,13 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -440,12 +434,13 @@ int libertas_cmd_80211_associate(wlan_private * priv,
cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN); cmd->size = cpu_to_le16((u16) (pos - (u8 *) passo) + S_DS_GEN);
/* set the capability info at last */ /* set the capability info */
memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); tmpcap = (bss->capability & CAPINFO_MASK);
tmpcap &= CAPINFO_MASK; if (bss->mode == IW_MODE_INFRA)
lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", tmpcap |= WLAN_CAPABILITY_ESS;
passo->capability = cpu_to_le16(tmpcap);
lbs_deb_join("ASSOC_CMD: capability=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK); tmpcap, CAPINFO_MASK);
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
done: done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
...@@ -461,6 +456,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -461,6 +456,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
int cmdappendsize = 0; int cmdappendsize = 0;
int i; int i;
struct assoc_request * assoc_req = pdata_buf; struct assoc_request * assoc_req = pdata_buf;
u16 tmpcap = 0;
lbs_deb_enter(LBS_DEB_JOIN); lbs_deb_enter(LBS_DEB_JOIN);
...@@ -518,19 +514,17 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -518,19 +514,17 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
/* set capability info */ /* set capability info */
adhs->cap.ess = 0; tmpcap = WLAN_CAPABILITY_IBSS;
adhs->cap.ibss = 1;
/* probedelay */
adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
/* set up privacy in adapter->scantable[i] */
if (assoc_req->secinfo.wep_enabled) { if (assoc_req->secinfo.wep_enabled) {
lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n"); lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; tmpcap |= WLAN_CAPABILITY_PRIVACY;
} else { } else {
lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n"); lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
} }
adhs->capability = cpu_to_le16(tmpcap);
/* probedelay */
adhs->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
memset(adhs->datarate, 0, sizeof(adhs->datarate)); memset(adhs->datarate, 0, sizeof(adhs->datarate));
...@@ -585,67 +579,58 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -585,67 +579,58 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
struct cmd_ds_command *cmd, void *pdata_buf) struct cmd_ds_command *cmd, void *pdata_buf)
{ {
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_ad_hoc_join *padhocjoin = &cmd->params.adj; struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj;
struct assoc_request * assoc_req = pdata_buf; struct assoc_request * assoc_req = pdata_buf;
struct bss_descriptor *bss = &assoc_req->bss; struct bss_descriptor *bss = &assoc_req->bss;
int cmdappendsize = 0; int cmdappendsize = 0;
int ret = 0; int ret = 0;
u8 *card_rates; u8 *card_rates;
int card_rates_size; int card_rates_size;
u16 tmpcap;
int i; int i;
lbs_deb_enter(LBS_DEB_JOIN); lbs_deb_enter(LBS_DEB_JOIN);
cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join); cmd->command = cpu_to_le16(cmd_802_11_ad_hoc_join);
padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; join_cmd->bss.type = cmd_bss_type_ibss;
join_cmd->bss.beaconperiod = cpu_to_le16(bss->beaconperiod);
padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); memcpy(&join_cmd->bss.bssid, &bss->bssid, ETH_ALEN);
memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid, bss->ssid_len); memcpy(&join_cmd->bss.ssid, &bss->ssid, bss->ssid_len);
memcpy(&padhocjoin->bssdescriptor.phyparamset, memcpy(&join_cmd->bss.phyparamset, &bss->phyparamset,
&bss->phyparamset, sizeof(union ieeetypes_phyparamset)); sizeof(union ieeetypes_phyparamset));
memcpy(&padhocjoin->bssdescriptor.ssparamset, memcpy(&join_cmd->bss.ssparamset, &bss->ssparamset,
&bss->ssparamset, sizeof(union IEEEtypes_ssparamset)); sizeof(union IEEEtypes_ssparamset));
memcpy(&tmpcap, &bss->cap, sizeof(struct ieeetypes_capinfo));
tmpcap &= CAPINFO_MASK;
join_cmd->bss.capability = cpu_to_le16(bss->capability & CAPINFO_MASK);
lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK); bss->capability, CAPINFO_MASK);
memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
sizeof(struct ieeetypes_capinfo));
/* information on BSSID descriptor passed to FW */ /* information on BSSID descriptor passed to FW */
lbs_deb_join( lbs_deb_join(
"ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n", "ADHOC_J_CMD: BSSID = " MAC_FMT ", SSID = '%s'\n",
MAC_ARG(padhocjoin->bssdescriptor.BSSID), MAC_ARG(join_cmd->bss.bssid), join_cmd->bss.ssid);
padhocjoin->bssdescriptor.SSID);
/* failtimeout */ /* failtimeout */
padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); join_cmd->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
/* probedelay */ /* probedelay */
padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); join_cmd->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
/* Copy Data rates from the rates recorded in scan response */ /* Copy Data rates from the rates recorded in scan response */
memset(padhocjoin->bssdescriptor.datarates, 0, memset(join_cmd->bss.datarates, 0, sizeof(join_cmd->bss.datarates));
sizeof(padhocjoin->bssdescriptor.datarates)); memcpy(join_cmd->bss.datarates, bss->datarates,
memcpy(padhocjoin->bssdescriptor.datarates, bss->datarates, min(sizeof(join_cmd->bss.datarates), sizeof(bss->datarates)));
min(sizeof(padhocjoin->bssdescriptor.datarates),
sizeof(bss->datarates)));
card_rates = libertas_supported_rates; card_rates = libertas_supported_rates;
card_rates_size = sizeof(libertas_supported_rates); card_rates_size = sizeof(libertas_supported_rates);
adapter->curbssparams.channel = bss->channel; adapter->curbssparams.channel = bss->channel;
if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, if (get_common_rates(adapter, join_cmd->bss.datarates,
sizeof(padhocjoin->bssdescriptor.datarates), sizeof(join_cmd->bss.datarates),
card_rates, card_rates_size)) { card_rates, card_rates_size)) {
lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
ret = -1; ret = -1;
...@@ -653,8 +638,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -653,8 +638,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
} }
/* Find the last non zero */ /* Find the last non zero */
for (i = 0; i < sizeof(padhocjoin->bssdescriptor.datarates) for (i = 0; i < sizeof(join_cmd->bss.datarates)
&& padhocjoin->bssdescriptor.datarates[i]; i++) ; && join_cmd->bss.datarates[i]; i++) ;
adapter->curbssparams.numofrates = i; adapter->curbssparams.numofrates = i;
...@@ -662,14 +647,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -662,14 +647,16 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
* Copy the adhoc joining rates to Current BSS State structure * Copy the adhoc joining rates to Current BSS State structure
*/ */
memcpy(adapter->curbssparams.datarates, memcpy(adapter->curbssparams.datarates,
padhocjoin->bssdescriptor.datarates, join_cmd->bss.datarates,
adapter->curbssparams.numofrates); adapter->curbssparams.numofrates);
padhocjoin->bssdescriptor.ssparamset.ibssparamset.atimwindow = join_cmd->bss.ssparamset.ibssparamset.atimwindow =
cpu_to_le16(bss->atimwindow); cpu_to_le16(bss->atimwindow);
if (assoc_req->secinfo.wep_enabled) { if (assoc_req->secinfo.wep_enabled) {
padhocjoin->bssdescriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; u16 tmp = le16_to_cpu(join_cmd->bss.capability);
tmp |= WLAN_CAPABILITY_PRIVACY;
join_cmd->bss.capability = cpu_to_le16(tmp);
} }
if (adapter->psmode == wlan802_11powermodemax_psp) { if (adapter->psmode == wlan802_11powermodemax_psp) {
......
...@@ -76,7 +76,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo, ...@@ -76,7 +76,7 @@ static inline int match_bss_no_security(struct wlan_802_11_security * secinfo,
&& !secinfo->WPA2enabled && !secinfo->WPA2enabled
&& match_bss->wpa_ie[0] != WPA_IE && match_bss->wpa_ie[0] != WPA_IE
&& match_bss->rsn_ie[0] != WPA2_IE && match_bss->rsn_ie[0] != WPA2_IE
&& !match_bss->privacy) { && !(match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
return 1; return 1;
} }
return 0; return 0;
...@@ -88,7 +88,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo, ...@@ -88,7 +88,7 @@ static inline int match_bss_static_wep(struct wlan_802_11_security * secinfo,
if ( secinfo->wep_enabled if ( secinfo->wep_enabled
&& !secinfo->WPAenabled && !secinfo->WPAenabled
&& !secinfo->WPA2enabled && !secinfo->WPA2enabled
&& match_bss->privacy) { && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
return 1; return 1;
} }
return 0; return 0;
...@@ -101,7 +101,8 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo, ...@@ -101,7 +101,8 @@ static inline int match_bss_wpa(struct wlan_802_11_security * secinfo,
&& secinfo->WPAenabled && secinfo->WPAenabled
&& (match_bss->wpa_ie[0] == WPA_IE) && (match_bss->wpa_ie[0] == WPA_IE)
/* privacy bit may NOT be set in some APs like LinkSys WRT54G /* privacy bit may NOT be set in some APs like LinkSys WRT54G
&& bss->privacy */ && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
*/
) { ) {
return 1; return 1;
} }
...@@ -115,7 +116,8 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo, ...@@ -115,7 +116,8 @@ static inline int match_bss_wpa2(struct wlan_802_11_security * secinfo,
&& secinfo->WPA2enabled && secinfo->WPA2enabled
&& (match_bss->rsn_ie[0] == WPA2_IE) && (match_bss->rsn_ie[0] == WPA2_IE)
/* privacy bit may NOT be set in some APs like LinkSys WRT54G /* privacy bit may NOT be set in some APs like LinkSys WRT54G
&& bss->privacy */ && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
*/
) { ) {
return 1; return 1;
} }
...@@ -130,7 +132,7 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo, ...@@ -130,7 +132,7 @@ static inline int match_bss_dynamic_wep(struct wlan_802_11_security * secinfo,
&& !secinfo->WPA2enabled && !secinfo->WPA2enabled
&& (match_bss->wpa_ie[0] != WPA_IE) && (match_bss->wpa_ie[0] != WPA_IE)
&& (match_bss->rsn_ie[0] != WPA2_IE) && (match_bss->rsn_ie[0] != WPA2_IE)
&& match_bss->privacy) { && (match_bss->capability & WLAN_CAPABILITY_PRIVACY)) {
return 1; return 1;
} }
return 0; return 0;
...@@ -177,7 +179,7 @@ static int is_network_compatible(wlan_adapter * adapter, ...@@ -177,7 +179,7 @@ static int is_network_compatible(wlan_adapter * adapter,
adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.wep_enabled ? "e" : "d",
adapter->secinfo.WPAenabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d", adapter->secinfo.WPA2enabled ? "e" : "d",
bss->privacy); (bss->capability & WLAN_CAPABILITY_PRIVACY));
goto done; goto done;
} else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) { } else if ((matched = match_bss_wpa2(&adapter->secinfo, bss))) {
lbs_deb_scan( lbs_deb_scan(
...@@ -187,15 +189,14 @@ static int is_network_compatible(wlan_adapter * adapter, ...@@ -187,15 +189,14 @@ static int is_network_compatible(wlan_adapter * adapter,
adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.wep_enabled ? "e" : "d",
adapter->secinfo.WPAenabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d", adapter->secinfo.WPA2enabled ? "e" : "d",
bss->privacy); (bss->capability & WLAN_CAPABILITY_PRIVACY));
goto done; goto done;
} else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) { } else if ((matched = match_bss_dynamic_wep(&adapter->secinfo, bss))) {
lbs_deb_scan( lbs_deb_scan(
"is_network_compatible() dynamic WEP: " "is_network_compatible() dynamic WEP: "
"wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
bss->wpa_ie[0], bss->wpa_ie[0], bss->rsn_ie[0],
bss->rsn_ie[0], (bss->capability & WLAN_CAPABILITY_PRIVACY));
bss->privacy);
goto done; goto done;
} }
...@@ -207,7 +208,7 @@ static int is_network_compatible(wlan_adapter * adapter, ...@@ -207,7 +208,7 @@ static int is_network_compatible(wlan_adapter * adapter,
adapter->secinfo.wep_enabled ? "e" : "d", adapter->secinfo.wep_enabled ? "e" : "d",
adapter->secinfo.WPAenabled ? "e" : "d", adapter->secinfo.WPAenabled ? "e" : "d",
adapter->secinfo.WPA2enabled ? "e" : "d", adapter->secinfo.WPA2enabled ? "e" : "d",
bss->privacy); (bss->capability & WLAN_CAPABILITY_PRIVACY));
done: done:
lbs_deb_leave(LBS_DEB_SCAN); lbs_deb_leave(LBS_DEB_SCAN);
...@@ -904,8 +905,6 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -904,8 +905,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
struct ieeetypes_dsparamset *pDS; struct ieeetypes_dsparamset *pDS;
struct ieeetypes_cfparamset *pCF; struct ieeetypes_cfparamset *pCF;
struct ieeetypes_ibssparamset *pibss; struct ieeetypes_ibssparamset *pibss;
struct ieeetypes_capinfo *pcap;
struct WLAN_802_11_FIXED_IEs fixedie;
u8 *pcurrentptr; u8 *pcurrentptr;
u8 *pRate; u8 *pRate;
u8 elemlen; u8 elemlen;
...@@ -974,24 +973,28 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -974,24 +973,28 @@ static int libertas_process_bss(struct bss_descriptor * bss,
bytesleftforcurrentbeacon -= 1; bytesleftforcurrentbeacon -= 1;
/* time stamp is 8 bytes long */ /* time stamp is 8 bytes long */
fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr); bss->timestamp = le64_to_cpup((void *)pcurrentptr);
pcurrentptr += 8; pcurrentptr += 8;
bytesleftforcurrentbeacon -= 8; bytesleftforcurrentbeacon -= 8;
/* beacon interval is 2 bytes long */ /* beacon interval is 2 bytes long */
fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
pcurrentptr += 2; pcurrentptr += 2;
bytesleftforcurrentbeacon -= 2; bytesleftforcurrentbeacon -= 2;
/* capability information is 2 bytes long */ /* capability information is 2 bytes long */
memcpy(&fixedie.capabilities, pcurrentptr, 2); bss->capability = le16_to_cpup((void *)pcurrentptr);
lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", lbs_deb_scan("process_bss: capabilities = 0x%4X\n", bss->capability);
fixedie.capabilities);
pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
pcurrentptr += 2; pcurrentptr += 2;
bytesleftforcurrentbeacon -= 2; bytesleftforcurrentbeacon -= 2;
if (bss->capability & WLAN_CAPABILITY_PRIVACY)
lbs_deb_scan("process_bss: AP WEP enabled\n");
if (bss->capability & WLAN_CAPABILITY_IBSS)
bss->mode = IW_MODE_ADHOC;
else
bss->mode = IW_MODE_INFRA;
/* rest of the current buffer are IE's */ /* rest of the current buffer are IE's */
lbs_deb_scan("process_bss: IE length for this AP = %d\n", lbs_deb_scan("process_bss: IE length for this AP = %d\n",
bytesleftforcurrentbeacon); bytesleftforcurrentbeacon);
...@@ -999,19 +1002,6 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -999,19 +1002,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr, lbs_dbg_hex("process_bss: IE info", (u8 *) pcurrentptr,
bytesleftforcurrentbeacon); bytesleftforcurrentbeacon);
if (pcap->privacy) {
lbs_deb_scan("process_bss: AP WEP enabled\n");
bss->privacy = wlan802_11privfilter8021xWEP;
} else {
bss->privacy = wlan802_11privfilteracceptall;
}
if (pcap->ibss == 1) {
bss->mode = IW_MODE_ADHOC;
} else {
bss->mode = IW_MODE_INFRA;
}
/* process variable IE */ /* process variable IE */
while (bytesleftforcurrentbeacon >= 2) { while (bytesleftforcurrentbeacon >= 2) {
elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr)); elemID = (enum ieeetypes_elementid) (*((u8 *) pcurrentptr));
...@@ -1550,7 +1540,7 @@ static inline char *libertas_translate_scan(wlan_private *priv, ...@@ -1550,7 +1540,7 @@ static inline char *libertas_translate_scan(wlan_private *priv,
/* Add encryption capability */ /* Add encryption capability */
iwe.cmd = SIOCGIWENCODE; iwe.cmd = SIOCGIWENCODE;
if (bss->privacy) { if (bss->capability & WLAN_CAPABILITY_PRIVACY) {
iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
} else { } else {
iwe.u.data.flags = IW_ENCODE_DISABLED; iwe.u.data.flags = IW_ENCODE_DISABLED;
......
...@@ -140,8 +140,7 @@ struct bss_descriptor { ...@@ -140,8 +140,7 @@ struct bss_descriptor {
u8 ssid[IW_ESSID_MAX_SIZE + 1]; u8 ssid[IW_ESSID_MAX_SIZE + 1];
u8 ssid_len; u8 ssid_len;
/* WEP encryption requirement */ u16 capability;
u32 privacy;
/* receive signal strength in dBm */ /* receive signal strength in dBm */
long rssi; long rssi;
...@@ -160,7 +159,6 @@ struct bss_descriptor { ...@@ -160,7 +159,6 @@ struct bss_descriptor {
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
union IEEEtypes_ssparamset ssparamset; union IEEEtypes_ssparamset ssparamset;
struct ieeetypes_capinfo cap;
u8 datarates[WLAN_SUPPORTED_RATES]; u8 datarates[WLAN_SUPPORTED_RATES];
u64 networktsf; //!< TSF timestamp from the current firmware TSF u64 networktsf; //!< TSF timestamp from the current firmware TSF
......
...@@ -30,47 +30,7 @@ enum ieeetypes_elementid { ...@@ -30,47 +30,7 @@ enum ieeetypes_elementid {
EXTRA_IE = 133, EXTRA_IE = 133,
} __attribute__ ((packed)); } __attribute__ ((packed));
#ifdef __BIG_ENDIAN
#define CAPINFO_MASK (~(0xda00))
#else
#define CAPINFO_MASK (~(0x00da)) #define CAPINFO_MASK (~(0x00da))
#endif
struct ieeetypes_capinfo {
#ifdef __BIG_ENDIAN_BITFIELD
u8 chanagility:1;
u8 pbcc:1;
u8 shortpreamble:1;
u8 privacy:1;
u8 cfpollrqst:1;
u8 cfpollable:1;
u8 ibss:1;
u8 ess:1;
u8 rsrvd1:2;
u8 dsssofdm:1;
u8 rsvrd2:1;
u8 apsd:1;
u8 shortslottime:1;
u8 rsrvd3:1;
u8 spectrummgmt:1;
#else
u8 ess:1;
u8 ibss:1;
u8 cfpollable:1;
u8 cfpollrqst:1;
u8 privacy:1;
u8 shortpreamble:1;
u8 pbcc:1;
u8 chanagility:1;
u8 spectrummgmt:1;
u8 rsrvd3:1;
u8 shortslottime:1;
u8 apsd:1;
u8 rsvrd2:1;
u8 dsssofdm:1;
u8 rsrvd1:2;
#endif
} __attribute__ ((packed));
struct ieeetypes_cfparamset { struct ieeetypes_cfparamset {
u8 elementid; u8 elementid;
...@@ -114,7 +74,7 @@ union ieeetypes_phyparamset { ...@@ -114,7 +74,7 @@ union ieeetypes_phyparamset {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_assocrsp { struct ieeetypes_assocrsp {
struct ieeetypes_capinfo capability; __le16 capability;
__le16 statuscode; __le16 statuscode;
__le16 aid; __le16 aid;
u8 iebuffer[1]; u8 iebuffer[1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment