Commit 6da16f96 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging:vt6655:iwctl: Whitespace cleanups

Neatening only.
git diff -w shows no differences.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 722bf5ee
...@@ -62,14 +62,14 @@ static const long frequency_list[] = { ...@@ -62,14 +62,14 @@ static const long frequency_list[] = {
5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240, 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680, 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
5700, 5745, 5765, 5785, 5805, 5825 5700, 5745, 5765, 5785, 5805, 5825
}; };
/*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Classes ----------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG; //static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO; static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Variables --------------------------*/ /*--------------------- Static Variables --------------------------*/
...@@ -83,13 +83,13 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev) ...@@ -83,13 +83,13 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
long ldBm; long ldBm;
pDevice->wstats.status = pDevice->eOPMode; pDevice->wstats.status = pDevice->eOPMode;
#ifdef Calcu_LinkQual #ifdef Calcu_LinkQual
if(pDevice->scStatistic.LinkQuality > 100) if (pDevice->scStatistic.LinkQuality > 100)
pDevice->scStatistic.LinkQuality = 100; pDevice->scStatistic.LinkQuality = 100;
pDevice->wstats.qual.qual =(unsigned char) pDevice->scStatistic.LinkQuality; pDevice->wstats.qual.qual = (unsigned char)pDevice->scStatistic.LinkQuality;
#else #else
pDevice->wstats.qual.qual = pDevice->byCurrSQ; pDevice->wstats.qual.qual = pDevice->byCurrSQ;
#endif #endif
RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm); RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
pDevice->wstats.qual.level = ldBm; pDevice->wstats.qual.level = ldBm;
//pDevice->wstats.qual.level = 0x100 - pDevice->uCurrRSSI; //pDevice->wstats.qual.level = 0x100 - pDevice->uCurrRSSI;
...@@ -146,44 +146,44 @@ int iwctl_siwscan(struct net_device *dev, ...@@ -146,44 +146,44 @@ int iwctl_siwscan(struct net_device *dev,
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra; struct iw_scan_req *req = (struct iw_scan_req *)extra;
unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
PWLAN_IE_SSID pItemSSID=NULL; PWLAN_IE_SSID pItemSSID = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n");
if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! if (pDevice->byReAssocCount > 0) { //reject scan when re-associating!
//send scan event to wpa_Supplicant //send scan event to wpa_Supplicant
union iwreq_data wrqu; union iwreq_data wrqu;
PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
return 0; return 0;
} }
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
//mike add: active scan OR passive scan OR desire_ssid scan //mike add: active scan OR passive scan OR desire_ssid scan
if(wrq->length == sizeof(struct iw_scan_req)) { if (wrq->length == sizeof(struct iw_scan_req)) {
if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan
memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
pItemSSID = (PWLAN_IE_SSID)abyScanSSID; pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len); memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
if (pItemSSID->abySSID[req->essid_len - 1] == '\0') { if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
if(req->essid_len>0) if (req->essid_len > 0)
pItemSSID->len = req->essid_len - 1; pItemSSID->len = req->essid_len - 1;
} }
else else
pItemSSID->len = req->essid_len; pItemSSID->len = req->essid_len;
pMgmt->eScanType = WMAC_SCAN_PASSIVE; pMgmt->eScanType = WMAC_SCAN_PASSIVE;
PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID, PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID,
((PWLAN_IE_SSID)abyScanSSID)->len); ((PWLAN_IE_SSID)abyScanSSID)->len);
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return 0; return 0;
} }
else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
pMgmt->eScanType = WMAC_SCAN_PASSIVE; pMgmt->eScanType = WMAC_SCAN_PASSIVE;
} }
} }
...@@ -193,7 +193,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating! ...@@ -193,7 +193,7 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
pMgmt->eScanType = WMAC_SCAN_PASSIVE; pMgmt->eScanType = WMAC_SCAN_PASSIVE;
//printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n"); //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n");
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return 0; return 0;
...@@ -230,7 +230,7 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -230,7 +230,7 @@ int iwctl_giwscan(struct net_device *dev,
return -EAGAIN; return -EAGAIN;
} }
pBSS = &(pMgmt->sBSSList[0]); pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) { for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) {
if (current_ev >= end_buf) if (current_ev >= end_buf)
break; break;
pBSS = &(pMgmt->sBSSList[jj]); pBSS = &(pMgmt->sBSSList[jj]);
...@@ -240,14 +240,14 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -240,14 +240,14 @@ int iwctl_giwscan(struct net_device *dev,
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, pBSS->abyBSSID, WLAN_BSSID_LEN); memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
//ADD ssid //ADD ssid
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWESSID; iwe.cmd = SIOCGIWESSID;
pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
iwe.u.data.length = pItemSSID->len; iwe.u.data.length = pItemSSID->len;
iwe.u.data.flags = 1; iwe.u.data.flags = 1;
current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
//ADD mode //ADD mode
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
...@@ -258,7 +258,7 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -258,7 +258,7 @@ int iwctl_giwscan(struct net_device *dev,
iwe.u.mode = IW_MODE_ADHOC; iwe.u.mode = IW_MODE_ADHOC;
} }
iwe.len = IW_EV_UINT_LEN; iwe.len = IW_EV_UINT_LEN;
current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
//ADD frequency //ADD frequency
pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates; pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates; pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
...@@ -267,15 +267,15 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -267,15 +267,15 @@ int iwctl_giwscan(struct net_device *dev,
iwe.u.freq.m = pBSS->uChannel; iwe.u.freq.m = pBSS->uChannel;
iwe.u.freq.e = 0; iwe.u.freq.e = 0;
iwe.u.freq.i = 0; iwe.u.freq.i = 0;
current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
//2008-0409-04, <Add> by Einsn Liu //2008-0409-04, <Add> by Einsn Liu
{ {
int f = (int)pBSS->uChannel - 1; int f = (int)pBSS->uChannel - 1;
if(f < 0)f = 0; if (f < 0)f = 0;
iwe.u.freq.m = frequency_list[f] * 100000; iwe.u.freq.m = frequency_list[f] * 100000;
iwe.u.freq.e = 1; iwe.u.freq.e = 1;
} }
current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
//ADD quality //ADD quality
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVQUAL; iwe.cmd = IWEVQUAL;
...@@ -283,69 +283,69 @@ int iwctl_giwscan(struct net_device *dev, ...@@ -283,69 +283,69 @@ int iwctl_giwscan(struct net_device *dev,
iwe.u.qual.level = ldBm; iwe.u.qual.level = ldBm;
iwe.u.qual.noise = 0; iwe.u.qual.noise = 0;
//2008-0409-01, <Add> by Einsn Liu //2008-0409-01, <Add> by Einsn Liu
if(-ldBm<50){ if (-ldBm < 50) {
iwe.u.qual.qual = 100; iwe.u.qual.qual = 100;
}else if(-ldBm > 90) { } else if (-ldBm > 90) {
iwe.u.qual.qual = 0; iwe.u.qual.qual = 0;
}else { } else {
iwe.u.qual.qual=(40-(-ldBm-50))*100/40; iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
} }
iwe.u.qual.updated=7; iwe.u.qual.updated = 7;
// iwe.u.qual.qual = 0; // iwe.u.qual.qual = 0;
current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWENCODE; iwe.cmd = SIOCGIWENCODE;
iwe.u.data.length = 0; iwe.u.data.length = 0;
if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) { if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
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;
} }
current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID); current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWRATE; iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
current_val = current_ev + IW_EV_LCP_LEN; current_val = current_ev + IW_EV_LCP_LEN;
for (kk = 0 ; kk < 12 ; kk++) { for (kk = 0; kk < 12; kk++) {
if (pSuppRates->abyRates[kk] == 0) if (pSuppRates->abyRates[kk] == 0)
break; break;
// Bit rate given in 500 kb/s units (+ 0x80) // Bit rate given in 500 kb/s units (+ 0x80)
iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000); iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
} }
for (kk = 0 ; kk < 8 ; kk++) { for (kk = 0; kk < 8; kk++) {
if (pExtSuppRates->abyRates[kk] == 0) if (pExtSuppRates->abyRates[kk] == 0)
break; break;
// Bit rate given in 500 kb/s units (+ 0x80) // Bit rate given in 500 kb/s units (+ 0x80)
iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000); iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
} }
if((current_val - current_ev) > IW_EV_LCP_LEN) if ((current_val - current_ev) > IW_EV_LCP_LEN)
current_ev = current_val; current_ev = current_val;
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVCUSTOM; iwe.cmd = IWEVCUSTOM;
sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval); sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
iwe.u.data.length = strlen(buf); iwe.u.data.length = strlen(buf);
current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf); current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) { if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = pBSS->wWPALen; iwe.u.data.length = pBSS->wWPALen;
current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE); current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE);
} }
if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) { if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
memset(&iwe, 0, sizeof(iwe)); memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE; iwe.cmd = IWEVGENIE;
iwe.u.data.length = pBSS->wRSNLen; iwe.u.data.length = pBSS->wRSNLen;
current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE); current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE);
} }
} }
...@@ -372,22 +372,22 @@ int iwctl_siwfreq(struct net_device *dev, ...@@ -372,22 +372,22 @@ int iwctl_siwfreq(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
// If setting by frequency, convert to a channel // If setting by frequency, convert to a channel
if((wrq->e == 1) && if ((wrq->e == 1) &&
(wrq->m >= (int) 2.412e8) && (wrq->m >= (int) 2.412e8) &&
(wrq->m <= (int) 2.487e8)) { (wrq->m <= (int) 2.487e8)) {
int f = wrq->m / 100000; int f = wrq->m / 100000;
int c = 0; int c = 0;
while((c < 14) && (f != frequency_list[c])) while ((c < 14) && (f != frequency_list[c]))
c++; c++;
wrq->e = 0; wrq->e = 0;
wrq->m = c + 1; wrq->m = c + 1;
} }
// Setting by channel number // Setting by channel number
if((wrq->m > 14) || (wrq->e > 0)) if ((wrq->m > 14) || (wrq->e > 0))
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
else { else {
int channel = wrq->m; int channel = wrq->m;
if((channel < 1) || (channel > 14)) { if ((channel < 1) || (channel > 14)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
rc = -EINVAL; rc = -EINVAL;
} else { } else {
...@@ -423,7 +423,7 @@ int iwctl_giwfreq(struct net_device *dev, ...@@ -423,7 +423,7 @@ int iwctl_giwfreq(struct net_device *dev,
#else #else
{ {
int f = (int)pMgmt->uCurrChannel - 1; int f = (int)pMgmt->uCurrChannel - 1;
if(f < 0) if (f < 0)
f = 0; f = 0;
wrq->m = frequency_list[f] * 100000; wrq->m = frequency_list[f] * 100000;
wrq->e = 1; wrq->e = 1;
...@@ -449,11 +449,11 @@ int iwctl_siwmode(struct net_device *dev, ...@@ -449,11 +449,11 @@ int iwctl_siwmode(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Can't set operation mode, hostapd is running \n");
return rc; return rc;
} }
switch(*wmode) { switch (*wmode) {
case IW_MODE_ADHOC: case IW_MODE_ADHOC:
if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) { if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
...@@ -545,9 +545,9 @@ int iwctl_giwrange(struct net_device *dev, ...@@ -545,9 +545,9 @@ int iwctl_giwrange(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
struct iw_range *range = (struct iw_range *) extra; struct iw_range *range = (struct iw_range *)extra;
int i,k; int i, k;
unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
...@@ -560,25 +560,25 @@ int iwctl_giwrange(struct net_device *dev, ...@@ -560,25 +560,25 @@ int iwctl_giwrange(struct net_device *dev,
// Should be based on cap_rid.country to give only // Should be based on cap_rid.country to give only
// what the current card support // what the current card support
k = 0; k = 0;
for(i = 0; i < 14; i++) { for (i = 0; i < 14; i++) {
range->freq[k].i = i + 1; // List index range->freq[k].i = i + 1; // List index
range->freq[k].m = frequency_list[i] * 100000; range->freq[k].m = frequency_list[i] * 100000;
range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10 range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10
} }
range->num_frequency = k; range->num_frequency = k;
// Hum... Should put the right values there // Hum... Should put the right values there
#ifdef Calcu_LinkQual #ifdef Calcu_LinkQual
range->max_qual.qual = 100; range->max_qual.qual = 100;
#else #else
range->max_qual.qual = 255; range->max_qual.qual = 255;
#endif #endif
range->max_qual.level = 0; range->max_qual.level = 0;
range->max_qual.noise = 0; range->max_qual.noise = 0;
range->sensitivity = 255; range->sensitivity = 255;
for(i = 0 ; i < 13 ; i++) { for (i = 0; i < 13; i++) {
range->bitrate[i] = abySupportedRates[i] * 500000; range->bitrate[i] = abySupportedRates[i] * 500000;
if(range->bitrate[i] == 0) if (range->bitrate[i] == 0)
break; break;
} }
range->num_bitrates = i; range->num_bitrates = i;
...@@ -586,7 +586,7 @@ int iwctl_giwrange(struct net_device *dev, ...@@ -586,7 +586,7 @@ int iwctl_giwrange(struct net_device *dev,
// Set an indication of the max TCP throughput // Set an indication of the max TCP throughput
// in bit/s that we can expect using this interface. // in bit/s that we can expect using this interface.
// May be use for QoS stuff... Jean II // May be use for QoS stuff... Jean II
if(i > 2) if (i > 2)
range->throughput = 5 * 1000 * 1000; range->throughput = 5 * 1000 * 1000;
else else
range->throughput = 1.5 * 1000 * 1000; range->throughput = 1.5 * 1000 * 1000;
...@@ -658,10 +658,10 @@ int iwctl_siwap(struct net_device *dev, ...@@ -658,10 +658,10 @@ int iwctl_siwap(struct net_device *dev,
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
unsigned char ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00}; unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n");
if (pMgmt->eScanState == WMAC_IS_SCANNING) { if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning.. // In scanning..
printk("SIOCSIWAP(??)-->In scanning...\n"); printk("SIOCSIWAP(??)-->In scanning...\n");
// return -EAGAIN; // return -EAGAIN;
...@@ -671,27 +671,27 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { ...@@ -671,27 +671,27 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
else { else {
memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6); memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
//2008-0409-05, <Add> by Einsn Liu //2008-0409-05, <Add> by Einsn Liu
if((pDevice->bLinkPass == true) && if ((pDevice->bLinkPass == true) &&
(memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6)== 0)){ (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6) == 0)) {
return rc; return rc;
} }
//mike :add //mike :add
if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) || if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
(memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){ (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) {
PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n"); PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
return rc; return rc;
} }
//mike add: if desired AP is hidden ssid(there are two same BSSID in list), //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
// then ignore,because you don't known which one to be connect with?? // then ignore,because you don't known which one to be connect with??
{ {
unsigned int ii , uSameBssidNum=0; unsigned int ii, uSameBssidNum = 0;
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (pMgmt->sBSSList[ii].bActive && if (pMgmt->sBSSList[ii].bActive &&
!compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyDesireBSSID)) { !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyDesireBSSID)) {
uSameBssidNum++; uSameBssidNum++;
} }
} }
if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n"); PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
return rc; return rc;
} }
...@@ -744,7 +744,7 @@ int iwctl_giwaplist(struct net_device *dev, ...@@ -744,7 +744,7 @@ int iwctl_giwaplist(struct net_device *dev,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
int ii,jj, rc = 0; int ii, jj, rc = 0;
struct sockaddr sock[IW_MAX_AP]; struct sockaddr sock[IW_MAX_AP];
struct iw_quality qual[IW_MAX_AP]; struct iw_quality qual[IW_MAX_AP];
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
...@@ -763,11 +763,11 @@ int iwctl_giwaplist(struct net_device *dev, ...@@ -763,11 +763,11 @@ int iwctl_giwaplist(struct net_device *dev,
PKnownBSS pBSS = &(pMgmt->sBSSList[0]); PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
pBSS = &(pMgmt->sBSSList[ii]); pBSS = &(pMgmt->sBSSList[ii]);
if (!pBSS->bActive) if (!pBSS->bActive)
continue; continue;
if ( jj >= IW_MAX_AP) if (jj >= IW_MAX_AP)
break; break;
memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6); memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
sock[jj].sa_family = ARPHRD_ETHER; sock[jj].sa_family = ARPHRD_ETHER;
...@@ -805,23 +805,23 @@ int iwctl_siwessid(struct net_device *dev, ...@@ -805,23 +805,23 @@ int iwctl_siwessid(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
pDevice->fWPA_Authened = false; pDevice->fWPA_Authened = false;
if (pMgmt->eScanState == WMAC_IS_SCANNING) { if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning.. // In scanning..
printk("SIOCSIWESSID(??)-->In scanning...\n"); printk("SIOCSIWESSID(??)-->In scanning...\n");
// return -EAGAIN; // return -EAGAIN;
} }
// Check if we asked for `any' // Check if we asked for `any'
if(wrq->flags == 0) { if (wrq->flags == 0) {
// Just send an empty SSID list // Just send an empty SSID list
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memset(pMgmt->abyDesireBSSID, 0xFF,6); memset(pMgmt->abyDesireBSSID, 0xFF, 6);
PRINT_K("set essid to 'any' \n"); PRINT_K("set essid to 'any' \n");
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//Unknown desired AP,so here need not associate?? //Unknown desired AP,so here need not associate??
//if(pDevice->bWPASuppWextEnabled == true) { //if (pDevice->bWPASuppWextEnabled == true) {
return 0; return 0;
// } // }
#endif #endif
} else { } else {
// Set the SSID // Set the SSID
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
...@@ -830,47 +830,47 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { ...@@ -830,47 +830,47 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
memcpy(pItemSSID->abySSID, extra, wrq->length); memcpy(pItemSSID->abySSID, extra, wrq->length);
if (pItemSSID->abySSID[wrq->length - 1] == '\0') { if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
if(wrq->length>0) if (wrq->length > 0)
pItemSSID->len = wrq->length - 1; pItemSSID->len = wrq->length - 1;
} }
else else
pItemSSID->len = wrq->length; pItemSSID->len = wrq->length;
printk("set essid to %s \n",pItemSSID->abySSID); printk("set essid to %s \n", pItemSSID->abySSID);
//2008-0409-05, <Add> by Einsn Liu //2008-0409-05, <Add> by Einsn Liu
len=(pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len)?pItemSSID->len:((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len; len = (pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) ? pItemSSID->len : ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len;
if((pDevice->bLinkPass == true) && if ((pDevice->bLinkPass == true) &&
(memcmp(pItemSSID->abySSID,((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,len)==0)) (memcmp(pItemSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, len) == 0))
return 0; return 0;
//mike:need clear desiredBSSID //mike:need clear desiredBSSID
if(pItemSSID->len==0) { if (pItemSSID->len == 0) {
memset(pMgmt->abyDesireBSSID, 0xFF,6); memset(pMgmt->abyDesireBSSID, 0xFF, 6);
return 0; return 0;
} }
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//Wext wil order another command of siwap to link with desired AP, //Wext wil order another command of siwap to link with desired AP,
//so here need not associate?? //so here need not associate??
if(pDevice->bWPASuppWextEnabled == true) { if (pDevice->bWPASuppWextEnabled == true) {
/*******search if in hidden ssid mode ****/ /*******search if in hidden ssid mode ****/
{ {
PKnownBSS pCurr = NULL; PKnownBSS pCurr = NULL;
unsigned char abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned char abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
unsigned int ii , uSameBssidNum=0; unsigned int ii, uSameBssidNum = 0;
memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID)); memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID));
pCurr = BSSpSearchBSSList(pDevice, pCurr = BSSpSearchBSSList(pDevice,
NULL, NULL,
abyTmpDesireSSID, abyTmpDesireSSID,
pMgmt->eConfigPHYMode pMgmt->eConfigPHYMode
); );
if (pCurr == NULL){ if (pCurr == NULL) {
PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n"); PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
vResetCommandTimer((void *) pDevice); vResetCommandTimer((void *)pDevice);
pMgmt->eScanType = WMAC_SCAN_ACTIVE; pMgmt->eScanType = WMAC_SCAN_ACTIVE;
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
} }
else { //mike:to find out if that desired SSID is a hidden-ssid AP , else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
// by means of judging if there are two same BSSID exist in list ? // by means of judging if there are two same BSSID exist in list ?
...@@ -880,18 +880,18 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) { ...@@ -880,18 +880,18 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
uSameBssidNum++; uSameBssidNum++;
} }
} }
if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!! if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
printk("SIOCSIWESSID:hidden ssid directly associate.......\n"); printk("SIOCSIWESSID:hidden ssid directly associate.......\n");
vResetCommandTimer((void *) pDevice); vResetCommandTimer((void *)pDevice);
pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result! pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result!
bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
} }
} }
} }
return 0; return 0;
} }
#endif #endif
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
} }
...@@ -951,7 +951,7 @@ int iwctl_siwrate(struct net_device *dev, ...@@ -951,7 +951,7 @@ int iwctl_siwrate(struct net_device *dev,
int rc = 0; int rc = 0;
u8 brate = 0; u8 brate = 0;
int i; int i;
unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
...@@ -963,7 +963,7 @@ int iwctl_siwrate(struct net_device *dev, ...@@ -963,7 +963,7 @@ int iwctl_siwrate(struct net_device *dev,
// First : get a valid bit rate value // First : get a valid bit rate value
// Which type of value // Which type of value
if((wrq->value < 13) && if ((wrq->value < 13) &&
(wrq->value >= 0)) { (wrq->value >= 0)) {
// Setting by rate index // Setting by rate index
// Find value in the magic rate table // Find value in the magic rate table
...@@ -973,38 +973,38 @@ int iwctl_siwrate(struct net_device *dev, ...@@ -973,38 +973,38 @@ int iwctl_siwrate(struct net_device *dev,
u8 normvalue = (u8) (wrq->value/500000); u8 normvalue = (u8) (wrq->value/500000);
// Check if rate is valid // Check if rate is valid
for(i = 0 ; i < 13 ; i++) { for (i = 0; i < 13; i++) {
if(normvalue == abySupportedRates[i]) { if (normvalue == abySupportedRates[i]) {
brate = i; brate = i;
break; break;
} }
} }
} }
// -1 designed the max rate (mostly auto mode) // -1 designed the max rate (mostly auto mode)
if(wrq->value == -1) { if (wrq->value == -1) {
// Get the highest available rate // Get the highest available rate
for(i = 0 ; i < 13 ; i++) { for (i = 0; i < 13; i++) {
if(abySupportedRates[i] == 0) if (abySupportedRates[i] == 0)
break; break;
} }
if(i != 0) if (i != 0)
brate = i - 1; brate = i - 1;
} }
// Check that it is valid // Check that it is valid
// brate is index of abySupportedRates[] // brate is index of abySupportedRates[]
if(brate > 13 ) { if (brate > 13) {
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
// Now, check if we want a fixed or auto value // Now, check if we want a fixed or auto value
if(wrq->fixed != 0) { if (wrq->fixed != 0) {
// Fixed mode // Fixed mode
// One rate, fixed // One rate, fixed
printk("Rate Fix\n"); printk("Rate Fix\n");
pDevice->bFixRate = true; pDevice->bFixRate = true;
if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) { if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
pDevice->uConnectionRate = 3; pDevice->uConnectionRate = 3;
} }
else { else {
...@@ -1038,14 +1038,14 @@ int iwctl_giwrate(struct net_device *dev, ...@@ -1038,14 +1038,14 @@ int iwctl_giwrate(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
{ {
unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90}; unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
int brate = 0; int brate = 0;
//2008-5-8 <modify> by chester //2008-5-8 <modify> by chester
if(pDevice->bLinkPass){ if (pDevice->bLinkPass) {
if(pDevice->bFixRate == true){ if (pDevice->bFixRate == true) {
if (pDevice->uConnectionRate < 13) { if (pDevice->uConnectionRate < 13) {
brate = abySupportedRates[pDevice->uConnectionRate]; brate = abySupportedRates[pDevice->uConnectionRate];
}else { } else {
if (pDevice->byBBType == BB_TYPE_11B) if (pDevice->byBBType == BB_TYPE_11B)
brate = 0x16; brate = 0x16;
if (pDevice->byBBType == BB_TYPE_11G) if (pDevice->byBBType == BB_TYPE_11G)
...@@ -1053,14 +1053,14 @@ if(pDevice->bFixRate == true){ ...@@ -1053,14 +1053,14 @@ if(pDevice->bFixRate == true){
if (pDevice->byBBType == BB_TYPE_11A) if (pDevice->byBBType == BB_TYPE_11A)
brate = 0x6C; brate = 0x6C;
} }
} }
else else
{ {
brate = abySupportedRates[TxRate_iwconfig]; brate = abySupportedRates[TxRate_iwconfig];
} }
} }
else brate =0; else brate = 0;
//2007-0118-05,<Mark> by EinsnLiu //2007-0118-05,<Mark> by EinsnLiu
//Mark the unnecessary sentences. //Mark the unnecessary sentences.
/* /*
...@@ -1104,11 +1104,11 @@ int iwctl_siwrts(struct net_device *dev, ...@@ -1104,11 +1104,11 @@ int iwctl_siwrts(struct net_device *dev,
{ {
int rthr = wrq->value; int rthr = wrq->value;
if(wrq->disabled) if (wrq->disabled)
rthr = 2312; rthr = 2312;
if((rthr < 0) || (rthr > 2312)) { if ((rthr < 0) || (rthr > 2312)) {
rc = -EINVAL; rc = -EINVAL;
}else { } else {
pDevice->wRTSThreshold = rthr; pDevice->wRTSThreshold = rthr;
} }
} }
...@@ -1154,9 +1154,9 @@ int iwctl_siwfrag(struct net_device *dev, ...@@ -1154,9 +1154,9 @@ int iwctl_siwfrag(struct net_device *dev,
if (wrq->disabled) if (wrq->disabled)
fthr = 2312; fthr = 2312;
if((fthr < 256) || (fthr > 2312)) { if ((fthr < 256) || (fthr > 2312)) {
rc = -EINVAL; rc = -EINVAL;
}else { } else {
fthr &= ~0x1; // Get an even value fthr &= ~0x1; // Get an even value
pDevice->wFragmentationThreshold = (u16)fthr; pDevice->wFragmentationThreshold = (u16)fthr;
} }
...@@ -1205,7 +1205,7 @@ int iwctl_siwretry(struct net_device *dev, ...@@ -1205,7 +1205,7 @@ int iwctl_siwretry(struct net_device *dev,
} }
if (wrq->flags & IW_RETRY_LIMIT) { if (wrq->flags & IW_RETRY_LIMIT) {
if(wrq->flags & IW_RETRY_MAX) if (wrq->flags & IW_RETRY_MAX)
pDevice->byLongRetryLimit = wrq->value; pDevice->byLongRetryLimit = wrq->value;
else if (wrq->flags & IW_RETRY_MIN) else if (wrq->flags & IW_RETRY_MIN)
pDevice->byShortRetryLimit = wrq->value; pDevice->byShortRetryLimit = wrq->value;
...@@ -1236,16 +1236,16 @@ int iwctl_giwretry(struct net_device *dev, ...@@ -1236,16 +1236,16 @@ int iwctl_giwretry(struct net_device *dev,
wrq->disabled = 0; // Can't be disabled wrq->disabled = 0; // Can't be disabled
// Note : by default, display the min retry number // Note : by default, display the min retry number
if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
wrq->flags = IW_RETRY_LIFETIME; wrq->flags = IW_RETRY_LIFETIME;
wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms
} else if((wrq->flags & IW_RETRY_MAX)) { } else if ((wrq->flags & IW_RETRY_MAX)) {
wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
wrq->value = (int)pDevice->byLongRetryLimit; wrq->value = (int)pDevice->byLongRetryLimit;
} else { } else {
wrq->flags = IW_RETRY_LIMIT; wrq->flags = IW_RETRY_LIMIT;
wrq->value = (int)pDevice->byShortRetryLimit; wrq->value = (int)pDevice->byShortRetryLimit;
if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit) if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
wrq->flags |= IW_RETRY_MIN; wrq->flags |= IW_RETRY_MIN;
} }
...@@ -1265,7 +1265,7 @@ int iwctl_siwencode(struct net_device *dev, ...@@ -1265,7 +1265,7 @@ int iwctl_siwencode(struct net_device *dev,
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX); unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX);
int ii,uu, rc = 0; int ii, uu, rc = 0;
int index = (wrq->flags & IW_ENCODE_INDEX); int index = (wrq->flags & IW_ENCODE_INDEX);
//2007-0207-07,<Modify> by EinsnLiu //2007-0207-07,<Modify> by EinsnLiu
...@@ -1281,7 +1281,7 @@ int iwctl_siwencode(struct net_device *dev, ...@@ -1281,7 +1281,7 @@ int iwctl_siwencode(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
if((wrq->flags & IW_ENCODE_DISABLED)==0){ if ((wrq->flags & IW_ENCODE_DISABLED) == 0) {
//Not disable encryption //Not disable encryption
if (dwKeyIndex > WLAN_WEP_NKEYS) { if (dwKeyIndex > WLAN_WEP_NKEYS) {
...@@ -1289,12 +1289,12 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1289,12 +1289,12 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
return rc; return rc;
} }
if(dwKeyIndex<1&&((wrq->flags&IW_ENCODE_NOKEY)==0)){//set default key if (dwKeyIndex < 1 && ((wrq->flags & IW_ENCODE_NOKEY) == 0)) {//set default key
if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) {
dwKeyIndex=pDevice->byKeyIndex; dwKeyIndex = pDevice->byKeyIndex;
} }
else dwKeyIndex=0; else dwKeyIndex = 0;
}else dwKeyIndex--; } else dwKeyIndex--;
// Check the size of the key // Check the size of the key
...@@ -1303,7 +1303,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1303,7 +1303,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
return rc; return rc;
} }
if(wrq->length>0){//have key if (wrq->length > 0) {//have key
if (wrq->length == WLAN_WEP232_KEYLEN) { if (wrq->length == WLAN_WEP232_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
...@@ -1313,14 +1313,14 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1313,14 +1313,14 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
} }
else if (wrq->length == WLAN_WEP40_KEYLEN) { else if (wrq->length == WLAN_WEP40_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
}else {//no support length } else {//no support length
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
memcpy(pDevice->abyKey, extra, wrq->length); memcpy(pDevice->abyKey, extra, wrq->length);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: ");
for (ii = 0; ii < wrq->length; ii++) { for (ii = 0; ii < wrq->length; ii++) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
} }
...@@ -1335,7 +1335,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1335,7 +1335,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
KEY_CTL_WEP, KEY_CTL_WEP,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID pDevice->byLocalID
); );
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
} }
pDevice->byKeyIndex = (unsigned char)dwKeyIndex; pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
...@@ -1344,40 +1344,40 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1344,40 +1344,40 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
pDevice->bEncryptionEnable = true; pDevice->bEncryptionEnable = true;
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
}else if(index>0){ } else if (index > 0) {
//when the length is 0 the request only changes the default transmit key index //when the length is 0 the request only changes the default transmit key index
//check the new key if it has a non zero length //check the new key if it has a non zero length
if(pDevice->bEncryptionEnable==false) if (pDevice->bEncryptionEnable == false)
{ {
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
pkeytab=&(pDevice->sKey.KeyTable[MAX_KEY_TABLE-1]); pkeytab = &(pDevice->sKey.KeyTable[MAX_KEY_TABLE - 1]);
if(pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength==0){ if (pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength == 0) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
pDevice->byKeyIndex =(unsigned char)dwKeyIndex; pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
pkeytab->dwGTKeyIndex =dwKeyIndex | (1 << 31); pkeytab->dwGTKeyIndex = dwKeyIndex | (1 << 31);
pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex=dwKeyIndex | (1 << 31); pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex = dwKeyIndex | (1 << 31);
} }
}else {//disable the key } else {//disable the key
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
if(pDevice->bEncryptionEnable==false) if (pDevice->bEncryptionEnable == false)
return 0; return 0;
pMgmt->bShareKeyAlgorithm = false; pMgmt->bShareKeyAlgorithm = false;
pDevice->bEncryptionEnable = false; pDevice->bEncryptionEnable = false;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
if (pDevice->flags & DEVICE_FLAGS_OPENED) { if (pDevice->flags & DEVICE_FLAGS_OPENED) {
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
for(uu=0;uu<MAX_KEY_TABLE;uu++) for (uu = 0; uu < MAX_KEY_TABLE; uu++)
MACvDisableKeyEntry(pDevice->PortOffset, uu); MACvDisableKeyEntry(pDevice->PortOffset, uu);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
} }
} }
//End Modify,Einsn //End Modify,Einsn
/* /*
...@@ -1412,7 +1412,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1412,7 +1412,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN); memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
memcpy(pDevice->abyKey, extra, wrq->length); memcpy(pDevice->abyKey, extra, wrq->length);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: "); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: ");
for (ii = 0; ii < wrq->length; ii++) { for (ii = 0; ii < wrq->length; ii++) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
} }
...@@ -1427,7 +1427,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1427,7 +1427,7 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
KEY_CTL_WEP, KEY_CTL_WEP,
pDevice->PortOffset, pDevice->PortOffset,
pDevice->byLocalID pDevice->byLocalID
); );
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
} }
pDevice->byKeyIndex = (unsigned char)dwKeyIndex; pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
...@@ -1437,16 +1437,16 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1437,16 +1437,16 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
// Do we want to just set the transmit key index ? // Do we want to just set the transmit key index ?
if ( index < 4 ) { if (index < 4) {
pDevice->byKeyIndex = index; pDevice->byKeyIndex = index;
} }
else if(!(wrq->flags & IW_ENCODE_MODE)) { else if (!(wrq->flags & IW_ENCODE_MODE)) {
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
} }
// Read the flags // Read the flags
if(wrq->flags & IW_ENCODE_DISABLED){ if (wrq->flags & IW_ENCODE_DISABLED) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
pMgmt->bShareKeyAlgorithm = false; pMgmt->bShareKeyAlgorithm = false;
...@@ -1454,18 +1454,18 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1454,18 +1454,18 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
if (pDevice->flags & DEVICE_FLAGS_OPENED) { if (pDevice->flags & DEVICE_FLAGS_OPENED) {
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
for(uu=0;uu<MAX_KEY_TABLE;uu++) for (uu=0; uu<MAX_KEY_TABLE; uu++)
MACvDisableKeyEntry(pDevice->PortOffset, uu); MACvDisableKeyEntry(pDevice->PortOffset, uu);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
} }
} }
*/ */
if(wrq->flags & IW_ENCODE_RESTRICTED) { if (wrq->flags & IW_ENCODE_RESTRICTED) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
pMgmt->bShareKeyAlgorithm = true; pMgmt->bShareKeyAlgorithm = true;
} }
if(wrq->flags & IW_ENCODE_OPEN) { if (wrq->flags & IW_ENCODE_OPEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
pMgmt->bShareKeyAlgorithm = false; pMgmt->bShareKeyAlgorithm = false;
} }
...@@ -1475,12 +1475,12 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){ ...@@ -1475,12 +1475,12 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
/* /*
* Wireless Handler : get encode mode * Wireless Handler : get encode mode
*/ */
/* /*
int iwctl_giwencode(struct net_device *dev, int iwctl_giwencode(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0; int rc = 0;
...@@ -1493,53 +1493,53 @@ int iwctl_giwencode(struct net_device *dev, ...@@ -1493,53 +1493,53 @@ int iwctl_giwencode(struct net_device *dev,
//the key index in iwconfig is 1-4 when our driver is 0-3 //the key index in iwconfig is 1-4 when our driver is 0-3
//so it can't be used directly. //so it can't be used directly.
//if the index is 0,we should used the index set by driver. //if the index is 0,we should used the index set by driver.
if (index > WLAN_WEP_NKEYS) { if (index > WLAN_WEP_NKEYS) {
rc = -EINVAL; rc = -EINVAL;
return rc; return rc;
} }
if(index<1){//set default key if (index<1) {//set default key
if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){ if (pDevice->byKeyIndex<WLAN_WEP_NKEYS) {
index=pDevice->byKeyIndex; index=pDevice->byKeyIndex;
} }
else index=0; else index=0;
}else index--; } else index--;
//End Add,Einsn //End Add,Einsn
memset(abyKey, 0, sizeof(abyKey)); memset(abyKey, 0, sizeof(abyKey));
// Check encryption mode // Check encryption mode
wrq->flags = IW_ENCODE_NOKEY; wrq->flags = IW_ENCODE_NOKEY;
// Is WEP enabled ??? // Is WEP enabled ???
if (pDevice->bEncryptionEnable) if (pDevice->bEncryptionEnable)
wrq->flags |= IW_ENCODE_ENABLED; wrq->flags |= IW_ENCODE_ENABLED;
else else
wrq->flags |= IW_ENCODE_DISABLED; wrq->flags |= IW_ENCODE_DISABLED;
if (pMgmt->bShareKeyAlgorithm) if (pMgmt->bShareKeyAlgorithm)
wrq->flags |= IW_ENCODE_RESTRICTED; wrq->flags |= IW_ENCODE_RESTRICTED;
else else
wrq->flags |= IW_ENCODE_OPEN; wrq->flags |= IW_ENCODE_OPEN;
if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)){ if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)) {
wrq->length = pKey->uKeyLength; wrq->length = pKey->uKeyLength;
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
//2007-0207-06,<Modify> by EinsnLiu //2007-0207-06,<Modify> by EinsnLiu
//only get key success need to copy data //only get key success need to copy data
//index should +1. //index should +1.
//there is not necessary to return -EINVAL when get key failed //there is not necessary to return -EINVAL when get key failed
//if return -EINVAL,the encryption item can't be display by the command "iwconfig". //if return -EINVAL,the encryption item can't be display by the command "iwconfig".
wrq->flags |= index+1; wrq->flags |= index+1;
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
} }
//else { //else {
// rc = -EINVAL; // rc = -EINVAL;
// return rc; // return rc;
// } // }
//End Modify,Einsn //End Modify,Einsn
return 0; return 0;
} }
*/ */
...@@ -1562,12 +1562,12 @@ int iwctl_giwencode(struct net_device *dev, ...@@ -1562,12 +1562,12 @@ int iwctl_giwencode(struct net_device *dev,
if (index > WLAN_WEP_NKEYS) { if (index > WLAN_WEP_NKEYS) {
return -EINVAL; return -EINVAL;
} }
if(index<1){//get default key if (index < 1) {//get default key
if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) {
index=pDevice->byKeyIndex; index = pDevice->byKeyIndex;
} else
index = 0;
} else } else
index=0;
}else
index--; index--;
memset(abyKey, 0, WLAN_WEP232_KEYLEN); memset(abyKey, 0, WLAN_WEP232_KEYLEN);
...@@ -1583,16 +1583,16 @@ int iwctl_giwencode(struct net_device *dev, ...@@ -1583,16 +1583,16 @@ int iwctl_giwencode(struct net_device *dev,
wrq->flags |= IW_ENCODE_RESTRICTED; wrq->flags |= IW_ENCODE_RESTRICTED;
else else
wrq->flags |= IW_ENCODE_OPEN; wrq->flags |= IW_ENCODE_OPEN;
wrq->length=0; wrq->length = 0;
if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled|| if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled ||
pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) {//get wpa pairwise key
if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){ if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) {
wrq->length = pKey->uKeyLength; wrq->length = pKey->uKeyLength;
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
} }
}else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)){ } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)) {
wrq->length = pKey->uKeyLength; wrq->length = pKey->uKeyLength;
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength); memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN); memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
...@@ -1723,19 +1723,19 @@ int iwctl_siwauth(struct net_device *dev, ...@@ -1723,19 +1723,19 @@ int iwctl_siwauth(struct net_device *dev,
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret = 0;
static int wpa_version=0; //must be static to save the last value,einsn liu static int wpa_version = 0; //must be static to save the last value,einsn liu
static int pairwise=0; static int pairwise = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
switch (wrq->flags & IW_AUTH_INDEX) { switch (wrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION: case IW_AUTH_WPA_VERSION:
wpa_version = wrq->value; wpa_version = wrq->value;
if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) { if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n"); PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
//pDevice->bWPADevEnable = false; //pDevice->bWPADevEnable = false;
} }
else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) { else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n"); PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
} }
else { else {
...@@ -1745,38 +1745,38 @@ int iwctl_siwauth(struct net_device *dev, ...@@ -1745,38 +1745,38 @@ int iwctl_siwauth(struct net_device *dev,
break; break;
case IW_AUTH_CIPHER_PAIRWISE: case IW_AUTH_CIPHER_PAIRWISE:
pairwise = wrq->value; pairwise = wrq->value;
if(pairwise == IW_AUTH_CIPHER_CCMP){ if (pairwise == IW_AUTH_CIPHER_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
}else if(pairwise == IW_AUTH_CIPHER_TKIP){ } else if (pairwise == IW_AUTH_CIPHER_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
}else if(pairwise == IW_AUTH_CIPHER_WEP40||pairwise == IW_AUTH_CIPHER_WEP104){ } else if (pairwise == IW_AUTH_CIPHER_WEP40 || pairwise == IW_AUTH_CIPHER_WEP104) {
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
}else if(pairwise == IW_AUTH_CIPHER_NONE){ } else if (pairwise == IW_AUTH_CIPHER_NONE) {
//do nothing,einsn liu //do nothing,einsn liu
}else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
break; break;
case IW_AUTH_CIPHER_GROUP: case IW_AUTH_CIPHER_GROUP:
if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED) if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
break; break;
if(pairwise == IW_AUTH_CIPHER_NONE){ if (pairwise == IW_AUTH_CIPHER_NONE) {
if(wrq->value == IW_AUTH_CIPHER_CCMP){ if (wrq->value == IW_AUTH_CIPHER_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
}else { } else {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
} }
} }
break; break;
case IW_AUTH_KEY_MGMT: case IW_AUTH_KEY_MGMT:
if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){ if (wpa_version == IW_AUTH_WPA_VERSION_WPA2) {
if(wrq->value == IW_AUTH_KEY_MGMT_PSK) if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK; pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
else pMgmt->eAuthenMode = WMAC_AUTH_WPA2; else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
}else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){ } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
if(wrq->value == 0){ if (wrq->value == 0) {
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE; pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
}else if(wrq->value == IW_AUTH_KEY_MGMT_PSK) } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK; pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
else pMgmt->eAuthenMode = WMAC_AUTH_WPA; else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
} }
...@@ -1787,10 +1787,10 @@ int iwctl_siwauth(struct net_device *dev, ...@@ -1787,10 +1787,10 @@ int iwctl_siwauth(struct net_device *dev,
case IW_AUTH_DROP_UNENCRYPTED: case IW_AUTH_DROP_UNENCRYPTED:
break; break;
case IW_AUTH_80211_AUTH_ALG: case IW_AUTH_80211_AUTH_ALG:
if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){ if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM) {
pMgmt->bShareKeyAlgorithm=false; pMgmt->bShareKeyAlgorithm = false;
}else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){ } else if (wrq->value == IW_AUTH_ALG_SHARED_KEY) {
pMgmt->bShareKeyAlgorithm=true; pMgmt->bShareKeyAlgorithm = true;
} }
break; break;
case IW_AUTH_WPA_ENABLED: case IW_AUTH_WPA_ENABLED:
...@@ -1803,7 +1803,7 @@ int iwctl_siwauth(struct net_device *dev, ...@@ -1803,7 +1803,7 @@ int iwctl_siwauth(struct net_device *dev,
break; break;
case IW_AUTH_PRIVACY_INVOKED: case IW_AUTH_PRIVACY_INVOKED:
pDevice->bEncryptionEnable = !!wrq->value; pDevice->bEncryptionEnable = !!wrq->value;
if(pDevice->bEncryptionEnable == false){ if (pDevice->bEncryptionEnable == false) {
wpa_version = 0; wpa_version = 0;
pairwise = 0; pairwise = 0;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
...@@ -1847,29 +1847,29 @@ int iwctl_siwgenie(struct net_device *dev, ...@@ -1847,29 +1847,29 @@ int iwctl_siwgenie(struct net_device *dev,
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret = 0;
if(wrq->length){ if (wrq->length) {
if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) { if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if(wrq->length > MAX_WPA_IE_LEN){ if (wrq->length > MAX_WPA_IE_LEN) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN); memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){ if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
} }
pMgmt->wWPAIELen = wrq->length; pMgmt->wWPAIELen = wrq->length;
}else { } else {
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN); memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
pMgmt->wWPAIELen = 0; pMgmt->wWPAIELen = 0;
} }
out://not completely ...not necessary in wpa_supplicant 0.5.8 out://not completely ...not necessary in wpa_supplicant 0.5.8
return ret; return ret;
} }
...@@ -1880,17 +1880,17 @@ int iwctl_giwgenie(struct net_device *dev, ...@@ -1880,17 +1880,17 @@ int iwctl_giwgenie(struct net_device *dev,
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int ret=0; int ret = 0;
int space = wrq->length; int space = wrq->length;
wrq->length = 0; wrq->length = 0;
if(pMgmt->wWPAIELen > 0){ if (pMgmt->wWPAIELen > 0) {
wrq->length = pMgmt->wWPAIELen; wrq->length = pMgmt->wWPAIELen;
if(pMgmt->wWPAIELen <= space){ if (pMgmt->wWPAIELen <= space) {
if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){ if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
ret = -EFAULT; ret = -EFAULT;
} }
}else } else
ret = -E2BIG; ret = -E2BIG;
} }
...@@ -1904,33 +1904,33 @@ int iwctl_siwencodeext(struct net_device *dev, ...@@ -1904,33 +1904,33 @@ int iwctl_siwencodeext(struct net_device *dev,
char *extra) char *extra)
{ {
PSDevice pDevice = (PSDevice)netdev_priv(dev); PSDevice pDevice = (PSDevice)netdev_priv(dev);
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct viawget_wpa_param *param=NULL; struct viawget_wpa_param *param = NULL;
//original member //original member
wpa_alg alg_name; wpa_alg alg_name;
u8 addr[6]; u8 addr[6];
int key_idx, set_tx=0; int key_idx, set_tx = 0;
u8 seq[IW_ENCODE_SEQ_MAX_SIZE]; u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
u8 key[64]; u8 key[64];
size_t seq_len=0,key_len=0; size_t seq_len = 0, key_len = 0;
// //
// int ii; // int ii;
u8 *buf; u8 *buf;
size_t blen; size_t blen;
u8 key_array[64]; u8 key_array[64];
int ret=0; int ret = 0;
PRINT_K("SIOCSIWENCODEEXT...... \n"); PRINT_K("SIOCSIWENCODEEXT...... \n");
blen = sizeof(*param); blen = sizeof(*param);
buf = kmalloc((int)blen, (int)GFP_KERNEL); buf = kmalloc((int)blen, (int)GFP_KERNEL);
if (buf == NULL) if (buf == NULL)
return -ENOMEM; return -ENOMEM;
memset(buf, 0, blen); memset(buf, 0, blen);
param = (struct viawget_wpa_param *) buf; param = (struct viawget_wpa_param *)buf;
//recover alg_name //recover alg_name
switch (ext->alg) { switch (ext->alg) {
case IW_ENCODE_ALG_NONE: case IW_ENCODE_ALG_NONE:
alg_name = WPA_ALG_NONE; alg_name = WPA_ALG_NONE;
break; break;
...@@ -1944,8 +1944,8 @@ switch (ext->alg) { ...@@ -1944,8 +1944,8 @@ switch (ext->alg) {
alg_name = WPA_ALG_CCMP; alg_name = WPA_ALG_CCMP;
break; break;
default: default:
PRINT_K("Unknown alg = %d\n",ext->alg); PRINT_K("Unknown alg = %d\n", ext->alg);
ret= -ENOMEM; ret = -ENOMEM;
goto error; goto error;
} }
//recover addr //recover addr
...@@ -1953,21 +1953,21 @@ switch (ext->alg) { ...@@ -1953,21 +1953,21 @@ switch (ext->alg) {
//recover key_idx //recover key_idx
key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1; key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
//recover set_tx //recover set_tx
if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
set_tx = 1; set_tx = 1;
//recover seq,seq_len //recover seq,seq_len
if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
seq_len=IW_ENCODE_SEQ_MAX_SIZE; seq_len = IW_ENCODE_SEQ_MAX_SIZE;
memcpy(seq, ext->rx_seq, seq_len); memcpy(seq, ext->rx_seq, seq_len);
} }
//recover key,key_len //recover key,key_len
if(ext->key_len) { if (ext->key_len) {
key_len=ext->key_len; key_len = ext->key_len;
memcpy(key, &ext->key[0], key_len); memcpy(key, &ext->key[0], key_len);
} }
memset(key_array, 0, 64); memset(key_array, 0, 64);
if ( key_len > 0) { if (key_len > 0) {
memcpy(key_array, key, key_len); memcpy(key_array, key, key_len);
if (key_len == 32) { if (key_len == 32) {
// notice ! the oder // notice ! the oder
...@@ -1977,34 +1977,34 @@ if ( key_len > 0) { ...@@ -1977,34 +1977,34 @@ if ( key_len > 0) {
} }
/**************Translate iw_encode_ext to viawget_wpa_param****************/ /**************Translate iw_encode_ext to viawget_wpa_param****************/
memcpy(param->addr, addr, ETH_ALEN); memcpy(param->addr, addr, ETH_ALEN);
param->u.wpa_key.alg_name = (int)alg_name; param->u.wpa_key.alg_name = (int)alg_name;
param->u.wpa_key.set_tx = set_tx; param->u.wpa_key.set_tx = set_tx;
param->u.wpa_key.key_index = key_idx; param->u.wpa_key.key_index = key_idx;
param->u.wpa_key.key_len = key_len; param->u.wpa_key.key_len = key_len;
param->u.wpa_key.key = (u8 *)key_array; param->u.wpa_key.key = (u8 *)key_array;
param->u.wpa_key.seq = (u8 *)seq; param->u.wpa_key.seq = (u8 *)seq;
param->u.wpa_key.seq_len = seq_len; param->u.wpa_key.seq_len = seq_len;
//****set if current action is Network Manager count?? //****set if current action is Network Manager count??
//****this method is so foolish,but there is no other way??? //****this method is so foolish,but there is no other way???
if(param->u.wpa_key.alg_name == WPA_ALG_NONE) { if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
if(param->u.wpa_key.key_index ==0) { if (param->u.wpa_key.key_index == 0) {
pDevice->bwextcount++; pDevice->bwextcount++;
} }
if((pDevice->bwextcount == 1)&&(param->u.wpa_key.key_index ==1)) { if ((pDevice->bwextcount == 1) && (param->u.wpa_key.key_index == 1)) {
pDevice->bwextcount++; pDevice->bwextcount++;
} }
if((pDevice->bwextcount ==2)&&(param->u.wpa_key.key_index ==2)) { if ((pDevice->bwextcount == 2) && (param->u.wpa_key.key_index == 2)) {
pDevice->bwextcount++; pDevice->bwextcount++;
} }
if((pDevice->bwextcount ==3)&&(param->u.wpa_key.key_index ==3)) { if ((pDevice->bwextcount == 3) && (param->u.wpa_key.key_index == 3)) {
pDevice->bwextcount++; pDevice->bwextcount++;
} }
} }
if( pDevice->bwextcount == 4) { if (pDevice->bwextcount == 4) {
printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n"); printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
pDevice->bwextcount=0; pDevice->bwextcount = 0;
pDevice->bWPASuppWextEnabled = true; pDevice->bWPASuppWextEnabled = true;
} }
//****** //******
...@@ -2014,7 +2014,7 @@ if( pDevice->bwextcount == 4) { ...@@ -2014,7 +2014,7 @@ if( pDevice->bwextcount == 4) {
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
error: error:
kfree(param); kfree(param);
return ret; return ret;
} }
...@@ -2029,7 +2029,7 @@ int iwctl_giwencodeext(struct net_device *dev, ...@@ -2029,7 +2029,7 @@ int iwctl_giwencodeext(struct net_device *dev,
} }
int iwctl_siwmlme(struct net_device *dev, int iwctl_siwmlme(struct net_device *dev,
struct iw_request_info * info, struct iw_request_info *info,
struct iw_point *wrq, struct iw_point *wrq,
char *extra) char *extra)
{ {
...@@ -2039,20 +2039,20 @@ int iwctl_siwmlme(struct net_device *dev, ...@@ -2039,20 +2039,20 @@ int iwctl_siwmlme(struct net_device *dev,
//u16 reason = cpu_to_le16(mlme->reason_code); //u16 reason = cpu_to_le16(mlme->reason_code);
int ret = 0; int ret = 0;
if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){ if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
ret = -EINVAL; ret = -EINVAL;
return ret; return ret;
} }
switch(mlme->cmd){ switch (mlme->cmd) {
case IW_MLME_DEAUTH: case IW_MLME_DEAUTH:
//this command seems to be not complete,please test it --einsnliu //this command seems to be not complete,please test it --einsnliu
//bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason); //bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason);
break; break;
case IW_MLME_DISASSOC: case IW_MLME_DISASSOC:
if(pDevice->bLinkPass == true){ if (pDevice->bLinkPass == true) {
printk("iwctl_siwmlme--->send DISASSOCIATE\n"); printk("iwctl_siwmlme--->send DISASSOCIATE\n");
//clear related flags //clear related flags
memset(pMgmt->abyDesireBSSID, 0xFF,6); memset(pMgmt->abyDesireBSSID, 0xFF, 6);
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset); KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL); bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
} }
...@@ -2075,8 +2075,8 @@ int iwctl_siwmlme(struct net_device *dev, ...@@ -2075,8 +2075,8 @@ int iwctl_siwmlme(struct net_device *dev,
/* /*
static const iw_handler iwctl_handler[] = static const iw_handler iwctl_handler[] =
{ {
(iw_handler) iwctl_commit, // SIOCSIWCOMMIT (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
(iw_handler) iwctl_giwname, // SIOCGIWNAME (iw_handler) iwctl_giwname, // SIOCGIWNAME
(iw_handler) NULL, // SIOCSIWNWID (iw_handler) NULL, // SIOCSIWNWID
...@@ -2134,7 +2134,7 @@ static const iw_handler iwctl_handler[] = ...@@ -2134,7 +2134,7 @@ static const iw_handler iwctl_handler[] =
(iw_handler) NULL, // SIOCSIWPMKSA (iw_handler) NULL, // SIOCSIWPMKSA
(iw_handler) NULL, // -- hole -- (iw_handler) NULL, // -- hole --
}; };
*/ */
static const iw_handler iwctl_handler[] = static const iw_handler iwctl_handler[] =
...@@ -2207,7 +2207,7 @@ static const iw_handler iwctl_private_handler[] = ...@@ -2207,7 +2207,7 @@ static const iw_handler iwctl_private_handler[] =
struct iw_priv_args iwctl_private_args[] = { struct iw_priv_args iwctl_private_args[] = {
{ IOCTL_CMD_SET, { IOCTL_CMD_SET,
IW_PRIV_TYPE_CHAR | 1024, 0, IW_PRIV_TYPE_CHAR | 1024, 0,
"set"}, "set"},
}; };
...@@ -2222,7 +2222,7 @@ const struct iw_handler_def iwctl_handler_def = ...@@ -2222,7 +2222,7 @@ const struct iw_handler_def iwctl_handler_def =
// .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args), // .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args),
.num_private = 0, .num_private = 0,
.num_private_args = 0, .num_private_args = 0,
.standard = (iw_handler *) iwctl_handler, .standard = (iw_handler *)iwctl_handler,
// .private = (iw_handler *) iwctl_private_handler, // .private = (iw_handler *) iwctl_private_handler,
// .private_args = (struct iw_priv_args *)iwctl_private_args, // .private_args = (struct iw_priv_args *)iwctl_private_args,
.private = NULL, .private = NULL,
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
/*--------------------- Export Functions --------------------------*/ /*--------------------- Export Functions --------------------------*/
struct iw_statistics *iwctl_get_wireless_stats (struct net_device *dev); struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
int iwctl_siwap(struct net_device *dev, int iwctl_siwap(struct net_device *dev,
...@@ -208,7 +208,7 @@ int iwctl_giwencodeext(struct net_device *dev, ...@@ -208,7 +208,7 @@ int iwctl_giwencodeext(struct net_device *dev,
char *extra); char *extra);
int iwctl_siwmlme(struct net_device *dev, int iwctl_siwmlme(struct net_device *dev,
struct iw_request_info * info, struct iw_request_info *info,
struct iw_point *wrq, struct iw_point *wrq,
char *extra); char *extra);
#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
......
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