staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part XVII
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
f38d223b69
commit
62f27cc4ae
|
@ -25,7 +25,8 @@
|
||||||
#include "rtl_pci.h"
|
#include "rtl_pci.h"
|
||||||
#include "rtl_core.h"
|
#include "rtl_core.h"
|
||||||
|
|
||||||
static void rtl8192_parse_pci_configuration(struct pci_dev *pdev, struct net_device *dev)
|
static void rtl8192_parse_pci_configuration(struct pci_dev *pdev,
|
||||||
|
struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
|
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
|
||||||
|
|
||||||
|
@ -37,10 +38,11 @@ static void rtl8192_parse_pci_configuration(struct pci_dev *pdev, struct net_dev
|
||||||
pci_read_config_byte(priv->pdev, pos + PCI_EXP_LNKCTL, &LinkCtrlReg);
|
pci_read_config_byte(priv->pdev, pos + PCI_EXP_LNKCTL, &LinkCtrlReg);
|
||||||
priv->NdisAdapter.LinkCtrlReg = LinkCtrlReg;
|
priv->NdisAdapter.LinkCtrlReg = LinkCtrlReg;
|
||||||
|
|
||||||
RT_TRACE(COMP_INIT, "Link Control Register =%x\n", priv->NdisAdapter.LinkCtrlReg);
|
RT_TRACE(COMP_INIT, "Link Control Register =%x\n",
|
||||||
|
priv->NdisAdapter.LinkCtrlReg);
|
||||||
|
|
||||||
pci_read_config_byte(pdev, 0x98, &tmp);
|
pci_read_config_byte(pdev, 0x98, &tmp);
|
||||||
tmp |=BIT4;
|
tmp |= BIT4;
|
||||||
pci_write_config_byte(pdev, 0x98, tmp);
|
pci_write_config_byte(pdev, 0x98, tmp);
|
||||||
|
|
||||||
tmp = 0x17;
|
tmp = 0x17;
|
||||||
|
@ -65,24 +67,27 @@ bool rtl8192_pci_findadapter(struct pci_dev *pdev, struct net_device *dev)
|
||||||
if (DeviceID == 0x8172) {
|
if (DeviceID == 0x8172) {
|
||||||
switch (RevisionID) {
|
switch (RevisionID) {
|
||||||
case HAL_HW_PCI_REVISION_ID_8192PCIE:
|
case HAL_HW_PCI_REVISION_ID_8192PCIE:
|
||||||
printk("Adapter(8192 PCI-E) is found - DeviceID=%x\n", DeviceID);
|
printk(KERN_INFO "Adapter(8192 PCI-E) is found - "
|
||||||
|
"DeviceID=%x\n", DeviceID);
|
||||||
priv->card_8192 = NIC_8192E;
|
priv->card_8192 = NIC_8192E;
|
||||||
break;
|
break;
|
||||||
case HAL_HW_PCI_REVISION_ID_8192SE:
|
case HAL_HW_PCI_REVISION_ID_8192SE:
|
||||||
printk("Adapter(8192SE) is found - DeviceID=%x\n", DeviceID);
|
printk(KERN_INFO "Adapter(8192SE) is found - "
|
||||||
|
"DeviceID=%x\n", DeviceID);
|
||||||
priv->card_8192 = NIC_8192SE;
|
priv->card_8192 = NIC_8192SE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printk("UNKNOWN nic type(%4x:%4x)\n", pdev->vendor, pdev->device);
|
printk(KERN_INFO "UNKNOWN nic type(%4x:%4x)\n",
|
||||||
|
pdev->vendor, pdev->device);
|
||||||
priv->card_8192 = NIC_UNKNOWN;
|
priv->card_8192 = NIC_UNKNOWN;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->ops->nic_type != priv->card_8192) {
|
if (priv->ops->nic_type != priv->card_8192) {
|
||||||
printk("Detect info(%x) and hardware info(%x) not match!\n",
|
printk(KERN_INFO "Detect info(%x) and hardware info(%x) not match!\n",
|
||||||
priv->ops->nic_type, priv->card_8192);
|
priv->ops->nic_type, priv->card_8192);
|
||||||
printk("Please select proper driver before install!!!!\n");
|
printk(KERN_INFO "Please select proper driver before install!!!!\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,11 +69,11 @@ struct mp_adapter {
|
||||||
u16 PciBridgeDeviceId;
|
u16 PciBridgeDeviceId;
|
||||||
u8 PciBridgePCIeHdrOffset;
|
u8 PciBridgePCIeHdrOffset;
|
||||||
u8 PciBridgeLinkCtrlReg;
|
u8 PciBridgeLinkCtrlReg;
|
||||||
};//,*pmp_adapter;
|
};
|
||||||
|
|
||||||
struct rt_pci_capab_header {
|
struct rt_pci_capab_header {
|
||||||
unsigned char CapabilityID;
|
unsigned char CapabilityID;
|
||||||
unsigned char Next;
|
unsigned char Next;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PCI_MAX_BRIDGE_NUMBER 255
|
#define PCI_MAX_BRIDGE_NUMBER 255
|
||||||
|
|
|
@ -40,19 +40,19 @@ struct modes_unit {
|
||||||
int mode_size;
|
int mode_size;
|
||||||
};
|
};
|
||||||
static struct modes_unit rtllib_modes[] = {
|
static struct modes_unit rtllib_modes[] = {
|
||||||
{"a",1},
|
{"a", 1},
|
||||||
{"b",1},
|
{"b", 1},
|
||||||
{"g",1},
|
{"g", 1},
|
||||||
{"?",1},
|
{"?", 1},
|
||||||
{"N-24G",5},
|
{"N-24G", 5},
|
||||||
{"N-5G",4},
|
{"N-5G", 4},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_CUSTOM_LEN 64
|
#define MAX_CUSTOM_LEN 64
|
||||||
static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
char *start, char *stop,
|
char *start, char *stop,
|
||||||
struct rtllib_network *network,
|
struct rtllib_network *network,
|
||||||
struct iw_request_info *info)
|
struct iw_request_info *info)
|
||||||
{
|
{
|
||||||
char custom[MAX_CUSTOM_LEN];
|
char custom[MAX_CUSTOM_LEN];
|
||||||
char proto_name[IFNAMSIZ];
|
char proto_name[IFNAMSIZ];
|
||||||
|
@ -67,52 +67,60 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
iwe.cmd = SIOCGIWAP;
|
iwe.cmd = SIOCGIWAP;
|
||||||
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
|
iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
|
||||||
memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
|
memcpy(iwe.u.ap_addr.sa_data, network->bssid, ETH_ALEN);
|
||||||
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_ADDR_LEN);
|
start = iwe_stream_add_event_rsl(info, start, stop,
|
||||||
|
&iwe, IW_EV_ADDR_LEN);
|
||||||
/* Remaining entries will be displayed in the order we provide them */
|
/* Remaining entries will be displayed in the order we provide them */
|
||||||
|
|
||||||
/* Add the ESSID */
|
/* Add the ESSID */
|
||||||
iwe.cmd = SIOCGIWESSID;
|
iwe.cmd = SIOCGIWESSID;
|
||||||
iwe.u.data.flags = 1;
|
iwe.u.data.flags = 1;
|
||||||
if (network->ssid_len > 0){
|
if (network->ssid_len > 0) {
|
||||||
iwe.u.data.length = min(network->ssid_len, (u8)32);
|
iwe.u.data.length = min(network->ssid_len, (u8)32);
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->ssid);
|
start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
|
||||||
}else if (network->hidden_ssid_len == 0){
|
network->ssid);
|
||||||
|
} else if (network->hidden_ssid_len == 0) {
|
||||||
iwe.u.data.length = sizeof("<hidden>");
|
iwe.u.data.length = sizeof("<hidden>");
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, "<hidden>");
|
start = iwe_stream_add_point_rsl(info, start, stop,
|
||||||
}else {
|
&iwe, "<hidden>");
|
||||||
|
} else {
|
||||||
iwe.u.data.length = min(network->hidden_ssid_len, (u8)32);
|
iwe.u.data.length = min(network->hidden_ssid_len, (u8)32);
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->hidden_ssid);
|
start = iwe_stream_add_point_rsl(info, start, stop, &iwe,
|
||||||
|
network->hidden_ssid);
|
||||||
}
|
}
|
||||||
/* Add the protocol name */
|
/* Add the protocol name */
|
||||||
iwe.cmd = SIOCGIWNAME;
|
iwe.cmd = SIOCGIWNAME;
|
||||||
for (i=0; i<(sizeof(rtllib_modes)/sizeof(rtllib_modes[0])); i++) {
|
for (i = 0; i < (sizeof(rtllib_modes)/sizeof(rtllib_modes[0])); i++) {
|
||||||
if (network->mode&(1<<i)) {
|
if (network->mode&(1<<i)) {
|
||||||
sprintf(pname,rtllib_modes[i].mode_string,rtllib_modes[i].mode_size);
|
sprintf(pname, rtllib_modes[i].mode_string,
|
||||||
pname +=rtllib_modes[i].mode_size;
|
rtllib_modes[i].mode_size);
|
||||||
|
pname += rtllib_modes[i].mode_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*pname = '\0';
|
*pname = '\0';
|
||||||
snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
|
snprintf(iwe.u.name, IFNAMSIZ, "IEEE802.11%s", proto_name);
|
||||||
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_CHAR_LEN);
|
start = iwe_stream_add_event_rsl(info, start, stop,
|
||||||
/* Add mode */
|
&iwe, IW_EV_CHAR_LEN);
|
||||||
iwe.cmd = SIOCGIWMODE;
|
/* Add mode */
|
||||||
if (network->capability &
|
iwe.cmd = SIOCGIWMODE;
|
||||||
|
if (network->capability &
|
||||||
(WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
|
(WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
|
||||||
if (network->capability & WLAN_CAPABILITY_ESS)
|
if (network->capability & WLAN_CAPABILITY_ESS)
|
||||||
iwe.u.mode = IW_MODE_MASTER;
|
iwe.u.mode = IW_MODE_MASTER;
|
||||||
else
|
else
|
||||||
iwe.u.mode = IW_MODE_ADHOC;
|
iwe.u.mode = IW_MODE_ADHOC;
|
||||||
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_UINT_LEN);
|
start = iwe_stream_add_event_rsl(info, start, stop,
|
||||||
}
|
&iwe, IW_EV_UINT_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
/* Add frequency/channel */
|
/* Add frequency/channel */
|
||||||
iwe.cmd = SIOCGIWFREQ;
|
iwe.cmd = SIOCGIWFREQ;
|
||||||
/* iwe.u.freq.m = rtllib_frequency(network->channel, network->mode);
|
/* iwe.u.freq.m = rtllib_frequency(network->channel, network->mode);
|
||||||
iwe.u.freq.e = 3; */
|
iwe.u.freq.e = 3; */
|
||||||
iwe.u.freq.m = network->channel;
|
iwe.u.freq.m = network->channel;
|
||||||
iwe.u.freq.e = 0;
|
iwe.u.freq.e = 0;
|
||||||
iwe.u.freq.i = 0;
|
iwe.u.freq.i = 0;
|
||||||
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_FREQ_LEN);
|
start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
|
||||||
|
IW_EV_FREQ_LEN);
|
||||||
|
|
||||||
/* Add encryption capability */
|
/* Add encryption capability */
|
||||||
iwe.cmd = SIOCGIWENCODE;
|
iwe.cmd = SIOCGIWENCODE;
|
||||||
|
@ -121,12 +129,13 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
else
|
else
|
||||||
iwe.u.data.flags = IW_ENCODE_DISABLED;
|
iwe.u.data.flags = IW_ENCODE_DISABLED;
|
||||||
iwe.u.data.length = 0;
|
iwe.u.data.length = 0;
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, network->ssid);
|
start = iwe_stream_add_point_rsl(info, start, stop,
|
||||||
|
&iwe, network->ssid);
|
||||||
/* Add basic and extended rates */
|
/* Add basic and extended rates */
|
||||||
max_rate = 0;
|
max_rate = 0;
|
||||||
p = custom;
|
p = custom;
|
||||||
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");
|
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): ");
|
||||||
for (i = 0, j = 0; i < network->rates_len; ) {
|
for (i = 0, j = 0; i < network->rates_len;) {
|
||||||
if (j < network->rates_ex_len &&
|
if (j < network->rates_ex_len &&
|
||||||
((network->rates_ex[j] & 0x7F) <
|
((network->rates_ex[j] & 0x7F) <
|
||||||
(network->rates[i] & 0x7F)))
|
(network->rates[i] & 0x7F)))
|
||||||
|
@ -146,22 +155,24 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
max_rate = rate;
|
max_rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network->mode >= IEEE_N_24G)
|
if (network->mode >= IEEE_N_24G) {
|
||||||
{
|
|
||||||
struct ht_capab_ele *ht_cap = NULL;
|
struct ht_capab_ele *ht_cap = NULL;
|
||||||
bool is40M = false, isShortGI = false;
|
bool is40M = false, isShortGI = false;
|
||||||
u8 max_mcs = 0;
|
u8 max_mcs = 0;
|
||||||
if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4))
|
if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4))
|
||||||
ht_cap = (struct ht_capab_ele *)&network->bssht.bdHTCapBuf[4];
|
ht_cap = (struct ht_capab_ele *)
|
||||||
|
&network->bssht.bdHTCapBuf[4];
|
||||||
else
|
else
|
||||||
ht_cap = (struct ht_capab_ele *)&network->bssht.bdHTCapBuf[0];
|
ht_cap = (struct ht_capab_ele *)
|
||||||
is40M = (ht_cap->ChlWidth)?1:0;
|
&network->bssht.bdHTCapBuf[0];
|
||||||
isShortGI = (ht_cap->ChlWidth)?
|
is40M = (ht_cap->ChlWidth) ? 1 : 0;
|
||||||
((ht_cap->ShortGI40Mhz)?1:0):
|
isShortGI = (ht_cap->ChlWidth) ?
|
||||||
((ht_cap->ShortGI20Mhz)?1:0);
|
((ht_cap->ShortGI40Mhz) ? 1 : 0) :
|
||||||
|
((ht_cap->ShortGI20Mhz) ? 1 : 0);
|
||||||
|
|
||||||
max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS, MCS_FILTER_ALL);
|
max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS,
|
||||||
rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs&0x7f];
|
MCS_FILTER_ALL);
|
||||||
|
rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs & 0x7f];
|
||||||
if (rate > max_rate)
|
if (rate > max_rate)
|
||||||
max_rate = rate;
|
max_rate = rate;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +184,8 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
iwe.cmd = IWEVCUSTOM;
|
iwe.cmd = IWEVCUSTOM;
|
||||||
iwe.u.data.length = p - custom;
|
iwe.u.data.length = p - custom;
|
||||||
if (iwe.u.data.length)
|
if (iwe.u.data.length)
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, custom);
|
start = iwe_stream_add_point_rsl(info, start, stop,
|
||||||
|
&iwe, custom);
|
||||||
/* Add quality statistics */
|
/* Add quality statistics */
|
||||||
/* TODO: Fix these values... */
|
/* TODO: Fix these values... */
|
||||||
iwe.cmd = IWEVQUAL;
|
iwe.cmd = IWEVQUAL;
|
||||||
|
@ -188,53 +200,54 @@ static inline char *rtl819x_translate_scan(struct rtllib_device *ieee,
|
||||||
if (!(network->stats.mask & RTLLIB_STATMASK_SIGNAL))
|
if (!(network->stats.mask & RTLLIB_STATMASK_SIGNAL))
|
||||||
iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
|
iwe.u.qual.updated |= IW_QUAL_QUAL_INVALID;
|
||||||
iwe.u.qual.updated = 7;
|
iwe.u.qual.updated = 7;
|
||||||
start = iwe_stream_add_event_rsl(info, start, stop, &iwe, IW_EV_QUAL_LEN);
|
start = iwe_stream_add_event_rsl(info, start, stop, &iwe,
|
||||||
|
IW_EV_QUAL_LEN);
|
||||||
|
|
||||||
iwe.cmd = IWEVCUSTOM;
|
iwe.cmd = IWEVCUSTOM;
|
||||||
p = custom;
|
p = custom;
|
||||||
iwe.u.data.length = p - custom;
|
iwe.u.data.length = p - custom;
|
||||||
if (iwe.u.data.length)
|
if (iwe.u.data.length)
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, custom);
|
start = iwe_stream_add_point_rsl(info, start, stop,
|
||||||
|
&iwe, custom);
|
||||||
|
|
||||||
memset(&iwe, 0, sizeof(iwe));
|
memset(&iwe, 0, sizeof(iwe));
|
||||||
if (network->wpa_ie_len)
|
if (network->wpa_ie_len) {
|
||||||
{
|
|
||||||
char buf[MAX_WPA_IE_LEN];
|
char buf[MAX_WPA_IE_LEN];
|
||||||
memcpy(buf, network->wpa_ie, network->wpa_ie_len);
|
memcpy(buf, network->wpa_ie, network->wpa_ie_len);
|
||||||
iwe.cmd = IWEVGENIE;
|
iwe.cmd = IWEVGENIE;
|
||||||
iwe.u.data.length = network->wpa_ie_len;
|
iwe.u.data.length = network->wpa_ie_len;
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
||||||
}
|
}
|
||||||
memset(&iwe, 0, sizeof(iwe));
|
memset(&iwe, 0, sizeof(iwe));
|
||||||
if (network->rsn_ie_len)
|
if (network->rsn_ie_len) {
|
||||||
{
|
|
||||||
char buf[MAX_WPA_IE_LEN];
|
char buf[MAX_WPA_IE_LEN];
|
||||||
memcpy(buf, network->rsn_ie, network->rsn_ie_len);
|
memcpy(buf, network->rsn_ie, network->rsn_ie_len);
|
||||||
iwe.cmd = IWEVGENIE;
|
iwe.cmd = IWEVGENIE;
|
||||||
iwe.u.data.length = network->rsn_ie_len;
|
iwe.u.data.length = network->rsn_ie_len;
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add info for WZC */
|
/* add info for WZC */
|
||||||
memset(&iwe, 0, sizeof(iwe));
|
memset(&iwe, 0, sizeof(iwe));
|
||||||
if (network->wzc_ie_len)
|
if (network->wzc_ie_len) {
|
||||||
{
|
|
||||||
char buf[MAX_WZC_IE_LEN];
|
char buf[MAX_WZC_IE_LEN];
|
||||||
memcpy(buf, network->wzc_ie, network->wzc_ie_len);
|
memcpy(buf, network->wzc_ie, network->wzc_ie_len);
|
||||||
iwe.cmd = IWEVGENIE;
|
iwe.cmd = IWEVGENIE;
|
||||||
iwe.u.data.length = network->wzc_ie_len;
|
iwe.u.data.length = network->wzc_ie_len;
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add EXTRA: Age to display seconds since last beacon/probe response
|
/* Add EXTRA: Age to display seconds since last beacon/probe response
|
||||||
* for given network. */
|
* for given network. */
|
||||||
iwe.cmd = IWEVCUSTOM;
|
iwe.cmd = IWEVCUSTOM;
|
||||||
p = custom;
|
p = custom;
|
||||||
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
|
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
|
||||||
" Last beacon: %lums ago", (jiffies - network->last_scanned) / (HZ / 100));
|
" Last beacon: %lums ago",
|
||||||
|
(jiffies - network->last_scanned) / (HZ / 100));
|
||||||
iwe.u.data.length = p - custom;
|
iwe.u.data.length = p - custom;
|
||||||
if (iwe.u.data.length)
|
if (iwe.u.data.length)
|
||||||
start = iwe_stream_add_point_rsl(info, start, stop, &iwe, custom);
|
start = iwe_stream_add_point_rsl(info, start, stop,
|
||||||
|
&iwe, custom);
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
@ -256,17 +269,16 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee,
|
||||||
|
|
||||||
list_for_each_entry(network, &ieee->network_list, list) {
|
list_for_each_entry(network, &ieee->network_list, list) {
|
||||||
i++;
|
i++;
|
||||||
if ((stop-ev)<200)
|
if ((stop - ev) < 200) {
|
||||||
{
|
|
||||||
err = -E2BIG;
|
err = -E2BIG;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ieee->scan_age == 0 ||
|
if (ieee->scan_age == 0 ||
|
||||||
time_after(network->last_scanned + ieee->scan_age, jiffies))
|
time_after(network->last_scanned + ieee->scan_age, jiffies))
|
||||||
ev = rtl819x_translate_scan(ieee, ev, stop, network, info);
|
ev = rtl819x_translate_scan(ieee, ev, stop, network,
|
||||||
|
info);
|
||||||
else
|
else
|
||||||
RTLLIB_DEBUG_SCAN(
|
RTLLIB_DEBUG_SCAN("Not showing network '%s ("
|
||||||
"Not showing network '%s ("
|
|
||||||
MAC_FMT ")' due to age (%lums).\n",
|
MAC_FMT ")' due to age (%lums).\n",
|
||||||
escape_essid(network->ssid,
|
escape_essid(network->ssid,
|
||||||
network->ssid_len),
|
network->ssid_len),
|
||||||
|
@ -326,7 +338,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
|
||||||
if (ieee->crypt[i] != NULL) {
|
if (ieee->crypt[i] != NULL) {
|
||||||
if (key_provided)
|
if (key_provided)
|
||||||
break;
|
break;
|
||||||
rtllib_crypt_delayed_deinit(ieee, &ieee->crypt[i]);
|
rtllib_crypt_delayed_deinit(ieee,
|
||||||
|
&ieee->crypt[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +419,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
|
||||||
NULL, (*crypt)->priv);
|
NULL, (*crypt)->priv);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
/* Set a default key of all 0 */
|
/* Set a default key of all 0 */
|
||||||
printk("Setting key %d to all zero.\n",
|
printk(KERN_INFO "Setting key %d to all zero.\n",
|
||||||
key);
|
key);
|
||||||
|
|
||||||
RTLLIB_DEBUG_WX("Setting key %d to all zero.\n",
|
RTLLIB_DEBUG_WX("Setting key %d to all zero.\n",
|
||||||
|
@ -429,7 +442,8 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee,
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED);
|
ieee->open_wep = !(erq->flags & IW_ENCODE_RESTRICTED);
|
||||||
ieee->auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
|
ieee->auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN :
|
||||||
|
WLAN_AUTH_SHARED_KEY;
|
||||||
sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
|
sec.auth_mode = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY;
|
||||||
sec.flags |= SEC_AUTH_MODE;
|
sec.flags |= SEC_AUTH_MODE;
|
||||||
RTLLIB_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ?
|
RTLLIB_DEBUG_WX("Auth: %s\n", sec.auth_mode == WLAN_AUTH_OPEN ?
|
||||||
|
@ -501,27 +515,27 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee,
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
|
int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
|
||||||
struct iw_request_info *info,
|
struct iw_request_info *info,
|
||||||
union iwreq_data *wrqu, char *extra)
|
union iwreq_data *wrqu, char *extra)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct net_device *dev = ieee->dev;
|
struct net_device *dev = ieee->dev;
|
||||||
struct iw_point *encoding = &wrqu->encoding;
|
struct iw_point *encoding = &wrqu->encoding;
|
||||||
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
|
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
|
||||||
int i, idx;
|
int i, idx;
|
||||||
int group_key = 0;
|
int group_key = 0;
|
||||||
const char *alg, *module;
|
const char *alg, *module;
|
||||||
struct rtllib_crypto_ops *ops;
|
struct rtllib_crypto_ops *ops;
|
||||||
struct rtllib_crypt_data **crypt;
|
struct rtllib_crypt_data **crypt;
|
||||||
|
|
||||||
struct rtllib_security sec = {
|
struct rtllib_security sec = {
|
||||||
.flags = 0,
|
.flags = 0,
|
||||||
};
|
};
|
||||||
idx = encoding->flags & IW_ENCODE_INDEX;
|
idx = encoding->flags & IW_ENCODE_INDEX;
|
||||||
if (idx) {
|
if (idx) {
|
||||||
if (idx < 1 || idx > WEP_KEYS)
|
if (idx < 1 || idx > WEP_KEYS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
idx--;
|
idx--;
|
||||||
} else{
|
} else{
|
||||||
idx = ieee->tx_keyidx;
|
idx = ieee->tx_keyidx;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +545,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
|
||||||
} else {
|
} else {
|
||||||
/* some Cisco APs use idx>0 for unicast in dynamic WEP */
|
/* some Cisco APs use idx>0 for unicast in dynamic WEP */
|
||||||
if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
|
if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (ieee->iw_mode == IW_MODE_INFRA)
|
if (ieee->iw_mode == IW_MODE_INFRA)
|
||||||
crypt = &ieee->crypt[idx];
|
crypt = &ieee->crypt[idx];
|
||||||
else
|
else
|
||||||
|
@ -540,7 +554,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
|
||||||
|
|
||||||
sec.flags |= SEC_ENABLED;
|
sec.flags |= SEC_ENABLED;
|
||||||
if ((encoding->flags & IW_ENCODE_DISABLED) ||
|
if ((encoding->flags & IW_ENCODE_DISABLED) ||
|
||||||
ext->alg == IW_ENCODE_ALG_NONE) {
|
ext->alg == IW_ENCODE_ALG_NONE) {
|
||||||
if (*crypt)
|
if (*crypt)
|
||||||
rtllib_crypt_delayed_deinit(ieee, crypt);
|
rtllib_crypt_delayed_deinit(ieee, crypt);
|
||||||
|
|
||||||
|
@ -557,108 +571,108 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
|
||||||
}
|
}
|
||||||
|
|
||||||
sec.enabled = 1;
|
sec.enabled = 1;
|
||||||
switch (ext->alg) {
|
switch (ext->alg) {
|
||||||
case IW_ENCODE_ALG_WEP:
|
case IW_ENCODE_ALG_WEP:
|
||||||
alg = "WEP";
|
alg = "WEP";
|
||||||
module = "rtllib_crypt_wep";
|
module = "rtllib_crypt_wep";
|
||||||
break;
|
break;
|
||||||
case IW_ENCODE_ALG_TKIP:
|
case IW_ENCODE_ALG_TKIP:
|
||||||
alg = "TKIP";
|
alg = "TKIP";
|
||||||
module = "rtllib_crypt_tkip";
|
module = "rtllib_crypt_tkip";
|
||||||
break;
|
break;
|
||||||
case IW_ENCODE_ALG_CCMP:
|
case IW_ENCODE_ALG_CCMP:
|
||||||
alg = "CCMP";
|
alg = "CCMP";
|
||||||
module = "rtllib_crypt_ccmp";
|
module = "rtllib_crypt_ccmp";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
|
RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
|
||||||
dev->name, ext->alg);
|
dev->name, ext->alg);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
printk("alg name:%s\n",alg);
|
printk(KERN_INFO "alg name:%s\n", alg);
|
||||||
|
|
||||||
ops = rtllib_get_crypto_ops(alg);
|
ops = rtllib_get_crypto_ops(alg);
|
||||||
if (ops == NULL) {
|
if (ops == NULL) {
|
||||||
char tempbuf[100];
|
char tempbuf[100];
|
||||||
|
|
||||||
memset( tempbuf, 0x00, 100 );
|
memset(tempbuf, 0x00, 100);
|
||||||
sprintf( tempbuf, "%s", module);
|
sprintf(tempbuf, "%s", module);
|
||||||
request_module("%s",tempbuf);
|
request_module("%s", tempbuf);
|
||||||
ops = rtllib_get_crypto_ops(alg);
|
ops = rtllib_get_crypto_ops(alg);
|
||||||
}
|
}
|
||||||
if (ops == NULL) {
|
if (ops == NULL) {
|
||||||
RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
|
RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n",
|
||||||
dev->name, ext->alg);
|
dev->name, ext->alg);
|
||||||
printk("========>unknown crypto alg %d\n", ext->alg);
|
printk(KERN_INFO "========>unknown crypto alg %d\n", ext->alg);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*crypt == NULL || (*crypt)->ops != ops) {
|
if (*crypt == NULL || (*crypt)->ops != ops) {
|
||||||
struct rtllib_crypt_data *new_crypt;
|
struct rtllib_crypt_data *new_crypt;
|
||||||
|
|
||||||
rtllib_crypt_delayed_deinit(ieee, crypt);
|
rtllib_crypt_delayed_deinit(ieee, crypt);
|
||||||
|
|
||||||
new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
|
new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL);
|
||||||
if (new_crypt == NULL) {
|
if (new_crypt == NULL) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
new_crypt->ops = ops;
|
new_crypt->ops = ops;
|
||||||
if (new_crypt->ops)
|
if (new_crypt->ops)
|
||||||
new_crypt->priv = new_crypt->ops->init(idx);
|
new_crypt->priv = new_crypt->ops->init(idx);
|
||||||
|
|
||||||
if (new_crypt->priv == NULL) {
|
if (new_crypt->priv == NULL) {
|
||||||
kfree(new_crypt);
|
kfree(new_crypt);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
*crypt = new_crypt;
|
*crypt = new_crypt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ext->key_len > 0 && (*crypt)->ops->set_key &&
|
if (ext->key_len > 0 && (*crypt)->ops->set_key &&
|
||||||
(*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
|
(*crypt)->ops->set_key(ext->key, ext->key_len, ext->rx_seq,
|
||||||
(*crypt)->priv) < 0) {
|
(*crypt)->priv) < 0) {
|
||||||
RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name);
|
RTLLIB_DEBUG_WX("%s: key setting failed\n", dev->name);
|
||||||
printk("key setting failed\n");
|
printk(KERN_INFO "key setting failed\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
|
if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
|
||||||
ieee->tx_keyidx = idx;
|
ieee->tx_keyidx = idx;
|
||||||
sec.active_key = idx;
|
sec.active_key = idx;
|
||||||
sec.flags |= SEC_ACTIVE_KEY;
|
sec.flags |= SEC_ACTIVE_KEY;
|
||||||
}
|
}
|
||||||
if (ext->alg != IW_ENCODE_ALG_NONE) {
|
if (ext->alg != IW_ENCODE_ALG_NONE) {
|
||||||
sec.key_sizes[idx] = ext->key_len;
|
sec.key_sizes[idx] = ext->key_len;
|
||||||
sec.flags |= (1 << idx);
|
sec.flags |= (1 << idx);
|
||||||
if (ext->alg == IW_ENCODE_ALG_WEP) {
|
if (ext->alg == IW_ENCODE_ALG_WEP) {
|
||||||
sec.flags |= SEC_LEVEL;
|
sec.flags |= SEC_LEVEL;
|
||||||
sec.level = SEC_LEVEL_1;
|
sec.level = SEC_LEVEL_1;
|
||||||
} else if (ext->alg == IW_ENCODE_ALG_TKIP) {
|
} else if (ext->alg == IW_ENCODE_ALG_TKIP) {
|
||||||
sec.flags |= SEC_LEVEL;
|
sec.flags |= SEC_LEVEL;
|
||||||
sec.level = SEC_LEVEL_2;
|
sec.level = SEC_LEVEL_2;
|
||||||
} else if (ext->alg == IW_ENCODE_ALG_CCMP) {
|
} else if (ext->alg == IW_ENCODE_ALG_CCMP) {
|
||||||
sec.flags |= SEC_LEVEL;
|
sec.flags |= SEC_LEVEL;
|
||||||
sec.level = SEC_LEVEL_3;
|
sec.level = SEC_LEVEL_3;
|
||||||
}
|
}
|
||||||
/* Don't set sec level for group keys. */
|
/* Don't set sec level for group keys. */
|
||||||
if (group_key)
|
if (group_key)
|
||||||
sec.flags &= ~SEC_LEVEL;
|
sec.flags &= ~SEC_LEVEL;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (ieee->set_security)
|
if (ieee->set_security)
|
||||||
ieee->set_security(ieee->dev, &sec);
|
ieee->set_security(ieee->dev, &sec);
|
||||||
|
|
||||||
if (ieee->reset_on_keychange &&
|
if (ieee->reset_on_keychange &&
|
||||||
ieee->iw_mode != IW_MODE_INFRA &&
|
ieee->iw_mode != IW_MODE_INFRA &&
|
||||||
ieee->reset_port && ieee->reset_port(dev)) {
|
ieee->reset_port && ieee->reset_port(dev)) {
|
||||||
RTLLIB_DEBUG_WX("%s: reset_port failed\n", dev->name);
|
RTLLIB_DEBUG_WX("%s: reset_port failed\n", dev->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
|
int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
|
||||||
|
@ -692,12 +706,12 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
|
||||||
encoding->flags = idx + 1;
|
encoding->flags = idx + 1;
|
||||||
memset(ext, 0, sizeof(*ext));
|
memset(ext, 0, sizeof(*ext));
|
||||||
|
|
||||||
if (crypt == NULL || crypt->ops == NULL ) {
|
if (crypt == NULL || crypt->ops == NULL) {
|
||||||
ext->alg = IW_ENCODE_ALG_NONE;
|
ext->alg = IW_ENCODE_ALG_NONE;
|
||||||
ext->key_len = 0;
|
ext->key_len = 0;
|
||||||
encoding->flags |= IW_ENCODE_DISABLED;
|
encoding->flags |= IW_ENCODE_DISABLED;
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(crypt->ops->name, "WEP") == 0 )
|
if (strcmp(crypt->ops->name, "WEP") == 0)
|
||||||
ext->alg = IW_ENCODE_ALG_WEP;
|
ext->alg = IW_ENCODE_ALG_WEP;
|
||||||
else if (strcmp(crypt->ops->name, "TKIP"))
|
else if (strcmp(crypt->ops->name, "TKIP"))
|
||||||
ext->alg = IW_ENCODE_ALG_TKIP;
|
ext->alg = IW_ENCODE_ALG_TKIP;
|
||||||
|
@ -705,7 +719,8 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
|
||||||
ext->alg = IW_ENCODE_ALG_CCMP;
|
ext->alg = IW_ENCODE_ALG_CCMP;
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ext->key_len = crypt->ops->get_key(ext->key, SCM_KEY_LEN, NULL, crypt->priv);
|
ext->key_len = crypt->ops->get_key(ext->key, SCM_KEY_LEN,
|
||||||
|
NULL, crypt->priv);
|
||||||
encoding->flags |= IW_ENCODE_ENABLED;
|
encoding->flags |= IW_ENCODE_ENABLED;
|
||||||
if (ext->key_len &&
|
if (ext->key_len &&
|
||||||
(ext->alg == IW_ENCODE_ALG_TKIP ||
|
(ext->alg == IW_ENCODE_ALG_TKIP ||
|
||||||
|
@ -718,8 +733,8 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtllib_wx_set_mlme(struct rtllib_device *ieee,
|
int rtllib_wx_set_mlme(struct rtllib_device *ieee,
|
||||||
struct iw_request_info *info,
|
struct iw_request_info *info,
|
||||||
union iwreq_data *wrqu, char *extra)
|
union iwreq_data *wrqu, char *extra)
|
||||||
{
|
{
|
||||||
u8 i = 0;
|
u8 i = 0;
|
||||||
bool deauth = false;
|
bool deauth = false;
|
||||||
|
@ -731,28 +746,28 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee,
|
||||||
down(&ieee->wx_sem);
|
down(&ieee->wx_sem);
|
||||||
|
|
||||||
switch (mlme->cmd) {
|
switch (mlme->cmd) {
|
||||||
case IW_MLME_DEAUTH:
|
case IW_MLME_DEAUTH:
|
||||||
deauth = true;
|
deauth = true;
|
||||||
/* leave break out intentionly */
|
/* leave break out intentionly */
|
||||||
|
|
||||||
case IW_MLME_DISASSOC:
|
case IW_MLME_DISASSOC:
|
||||||
if (deauth == true)
|
if (deauth == true)
|
||||||
printk("disauth packet !\n");
|
printk(KERN_INFO "disauth packet !\n");
|
||||||
else
|
else
|
||||||
printk("dis associate packet!\n");
|
printk(KERN_INFO "dis associate packet!\n");
|
||||||
|
|
||||||
ieee->cannot_notify = true;
|
ieee->cannot_notify = true;
|
||||||
|
|
||||||
SendDisassociation(ieee,deauth,mlme->reason_code);
|
SendDisassociation(ieee, deauth, mlme->reason_code);
|
||||||
rtllib_disassociate(ieee);
|
rtllib_disassociate(ieee);
|
||||||
|
|
||||||
ieee->wap_set = 0;
|
ieee->wap_set = 0;
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
ieee->current_network.bssid[i]= 0x55;
|
ieee->current_network.bssid[i] = 0x55;
|
||||||
|
|
||||||
ieee->ssid_set = 0;
|
ieee->ssid_set = 0;
|
||||||
ieee->current_network.ssid[0] = '\0';
|
ieee->current_network.ssid[0] = '\0';
|
||||||
ieee->current_network.ssid_len = 0;
|
ieee->current_network.ssid_len = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
up(&ieee->wx_sem);
|
up(&ieee->wx_sem);
|
||||||
|
@ -765,56 +780,53 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee,
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtllib_wx_set_auth(struct rtllib_device *ieee,
|
int rtllib_wx_set_auth(struct rtllib_device *ieee,
|
||||||
struct iw_request_info *info,
|
struct iw_request_info *info,
|
||||||
struct iw_param *data, char *extra)
|
struct iw_param *data, char *extra)
|
||||||
{
|
{
|
||||||
switch (data->flags & IW_AUTH_INDEX) {
|
switch (data->flags & IW_AUTH_INDEX) {
|
||||||
case IW_AUTH_WPA_VERSION:
|
case IW_AUTH_WPA_VERSION:
|
||||||
break;
|
break;
|
||||||
case IW_AUTH_CIPHER_PAIRWISE:
|
case IW_AUTH_CIPHER_PAIRWISE:
|
||||||
case IW_AUTH_CIPHER_GROUP:
|
case IW_AUTH_CIPHER_GROUP:
|
||||||
case IW_AUTH_KEY_MGMT:
|
case IW_AUTH_KEY_MGMT:
|
||||||
/*
|
/*
|
||||||
* Host AP driver does not use these parameters and allows
|
* Host AP driver does not use these parameters and allows
|
||||||
* wpa_supplicant to control them internally.
|
* wpa_supplicant to control them internally.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case IW_AUTH_TKIP_COUNTERMEASURES:
|
case IW_AUTH_TKIP_COUNTERMEASURES:
|
||||||
ieee->tkip_countermeasures = data->value;
|
ieee->tkip_countermeasures = data->value;
|
||||||
break;
|
break;
|
||||||
case IW_AUTH_DROP_UNENCRYPTED:
|
case IW_AUTH_DROP_UNENCRYPTED:
|
||||||
ieee->drop_unencrypted = data->value;
|
ieee->drop_unencrypted = data->value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IW_AUTH_80211_AUTH_ALG:
|
case IW_AUTH_80211_AUTH_ALG:
|
||||||
if (data->value & IW_AUTH_ALG_SHARED_KEY){
|
if (data->value & IW_AUTH_ALG_SHARED_KEY) {
|
||||||
ieee->open_wep = 0;
|
ieee->open_wep = 0;
|
||||||
ieee->auth_mode = 1;
|
ieee->auth_mode = 1;
|
||||||
}
|
} else if (data->value & IW_AUTH_ALG_OPEN_SYSTEM) {
|
||||||
else if (data->value & IW_AUTH_ALG_OPEN_SYSTEM){
|
|
||||||
ieee->open_wep = 1;
|
ieee->open_wep = 1;
|
||||||
ieee->auth_mode = 0;
|
ieee->auth_mode = 0;
|
||||||
}
|
} else if (data->value & IW_AUTH_ALG_LEAP) {
|
||||||
else if (data->value & IW_AUTH_ALG_LEAP){
|
|
||||||
ieee->open_wep = 1;
|
ieee->open_wep = 1;
|
||||||
ieee->auth_mode = 2;
|
ieee->auth_mode = 2;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IW_AUTH_WPA_ENABLED:
|
case IW_AUTH_WPA_ENABLED:
|
||||||
ieee->wpa_enabled = (data->value)?1:0;
|
ieee->wpa_enabled = (data->value) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IW_AUTH_RX_UNENCRYPTED_EAPOL:
|
case IW_AUTH_RX_UNENCRYPTED_EAPOL:
|
||||||
ieee->ieee802_1x = data->value;
|
ieee->ieee802_1x = data->value;
|
||||||
break;
|
break;
|
||||||
case IW_AUTH_PRIVACY_INVOKED:
|
case IW_AUTH_PRIVACY_INVOKED:
|
||||||
ieee->privacy_invoked = data->value;
|
ieee->privacy_invoked = data->value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -822,17 +834,18 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee,
|
||||||
int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
|
int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
|
||||||
{
|
{
|
||||||
u8 *buf;
|
u8 *buf;
|
||||||
u8 eid, wps_oui[4]={0x0,0x50,0xf2,0x04};
|
u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04};
|
||||||
|
|
||||||
if (len > MAX_WPA_IE_LEN || (len && ie == NULL)) {
|
if (len > MAX_WPA_IE_LEN || (len && ie == NULL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
eid = ie[0];
|
eid = ie[0];
|
||||||
if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2], wps_oui, 4))) {
|
if ((eid == MFIE_TYPE_GENERIC) && (!memcmp(&ie[2],
|
||||||
|
wps_oui, 4))) {
|
||||||
|
|
||||||
ieee->wps_ie_len = (len < MAX_WZC_IE_LEN) ? (len):(MAX_WZC_IE_LEN);
|
ieee->wps_ie_len = (len < MAX_WZC_IE_LEN) ? (len) :
|
||||||
|
(MAX_WZC_IE_LEN);
|
||||||
buf = kmalloc(ieee->wps_ie_len, GFP_KERNEL);
|
buf = kmalloc(ieee->wps_ie_len, GFP_KERNEL);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -842,13 +855,11 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ieee->wps_ie_len = 0;
|
ieee->wps_ie_len = 0;
|
||||||
if (ieee->wps_ie)
|
kfree(ieee->wps_ie);
|
||||||
kfree(ieee->wps_ie);
|
|
||||||
ieee->wps_ie = NULL;
|
ieee->wps_ie = NULL;
|
||||||
if (len) {
|
if (len) {
|
||||||
if (len != ie[1]+2) {
|
if (len != ie[1]+2)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
|
||||||
buf = kmalloc(len, GFP_KERNEL);
|
buf = kmalloc(len, GFP_KERNEL);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -857,7 +868,6 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len)
|
||||||
ieee->wpa_ie = buf;
|
ieee->wpa_ie = buf;
|
||||||
ieee->wpa_ie_len = len;
|
ieee->wpa_ie_len = len;
|
||||||
} else {
|
} else {
|
||||||
if (ieee->wpa_ie)
|
|
||||||
kfree(ieee->wpa_ie);
|
kfree(ieee->wpa_ie);
|
||||||
ieee->wpa_ie = NULL;
|
ieee->wpa_ie = NULL;
|
||||||
ieee->wpa_ie_len = 0;
|
ieee->wpa_ie_len = 0;
|
||||||
|
|
Loading…
Reference in a new issue