// mike add: active scan OR passive scan OR desire_ssid scan
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);
pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
pItemSSID->byElementID = WLAN_EID_SSID;
spin_unlock_irq(&pDevice->lock);
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;
}
- }
- else { // active scan
+ } else { // active scan
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
}
// ADD mode
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWMODE;
- if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
+ if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo))
iwe.u.mode = IW_MODE_INFRA;
- }
- else {
+ else
iwe.u.mode = IW_MODE_ADHOC;
- }
iwe.len = IW_EV_UINT_LEN;
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
// ADD frequency
iwe.u.qual.level = ldBm;
iwe.u.qual.noise = 0;
- if (-ldBm<50){
+ if (-ldBm<50)
iwe.u.qual.qual = 100;
- }else if (-ldBm > 90) {
+ else if (-ldBm > 90)
iwe.u.qual.qual = 0;
- }else {
+ else
iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
- }
iwe.u.qual.updated = 7;
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWENCODE;
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;
- }else {
+ else
iwe.u.data.flags = IW_ENCODE_DISABLED;
- }
current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
memset(&iwe, 0, sizeof(iwe));
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
// If setting by frequency, convert to a channel
- if ((wrq->e == 1) &&
- (wrq->m >= (int)2.412e8) &&
+ if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) &&
(wrq->m <= (int)2.487e8)) {
int f = wrq->m / 100000;
int c = 0;
wrq->m = c + 1;
}
// Setting by channel number
- if ((wrq->m > 14) || (wrq->e > 0))
+ if ((wrq->m > 14) || (wrq->e > 0)) {
rc = -EOPNOTSUPP;
- else {
+ } else {
int channel = wrq->m;
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);
pDevice->uChannel = channel;
}
}
-
return rc;
}
case IW_MODE_ADHOC:
if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
pDevice->bCommit = TRUE;
- }
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
break;
case IW_MODE_INFRA:
if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
pDevice->bCommit = TRUE;
- }
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
break;
if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
pMgmt->eConfigMode = WMAC_CONFIG_AP;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
pDevice->bCommit = TRUE;
- }
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
break;
}
}
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
pDevice->bCommit = TRUE;
- }
}
return rc;
}
if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
memset(wrq->sa_data, 0, 6);
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
- }
wrq->sa_family = ARPHRD_ETHER;
return 0;
if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
if (wrq->length>0)
pItemSSID->len = wrq->length - 1;
- }
- else
+ } else {
pItemSSID->len = wrq->length;
+ }
PRINT_K("set essid to %s \n", pItemSSID->abySSID);
// mike: need clear desiredBSSID
bScheduleCommand((void *)pDevice,
WLAN_CMD_SSID,
pMgmt->abyDesireSSID);
- }
- else { // mike: to find out if that desired SSID is a
+ } 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 ?
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
}
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
pDevice->bCommit = TRUE;
- }
+
return 0;
}
pDevice->bFixRate = TRUE;
if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
pDevice->uConnectionRate = 3;
- }
- else {
+ } else {
pDevice->uConnectionRate = brate;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
}
if (pDevice->uConnectionRate < 13) {
brate = abySupportedRates[pDevice->uConnectionRate];
- }else {
+ } else {
if (pDevice->byBBType == BB_TYPE_11B)
brate = 0x16;
if (pDevice->byBBType == BB_TYPE_11G)
if (pDevice->byBBType == BB_TYPE_11A)
brate = 0x6C;
}
-
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
if (pDevice->byBBType == BB_TYPE_11B)
brate = 0x16;
fthr = 2312;
if ((fthr < 256) || (fthr > 2312)) {
rc = -EINVAL;
- }else {
+ } else {
fthr &= ~0x1; // Get an even value
pDevice->wFragmentationThreshold = (u16)fthr;
}
}
if (wrq->flags & IW_RETRY_LIMIT) {
- if (wrq->flags & IW_RETRY_MAX)
+ if (wrq->flags & IW_RETRY_MAX) {
pDevice->byLongRetryLimit = wrq->value;
- else if (wrq->flags & IW_RETRY_MIN)
+ } else if (wrq->flags & IW_RETRY_MIN) {
pDevice->byShortRetryLimit = wrq->value;
- else {
+ } else {
// No modifier : set both
pDevice->byShortRetryLimit = wrq->value;
pDevice->byLongRetryLimit = wrq->value;
}
}
- if (wrq->flags & IW_RETRY_LIFETIME) {
+ if (wrq->flags & IW_RETRY_LIFETIME)
pDevice->wMaxTransmitMSDULifetime = wrq->value;
- }
return rc;
}
if (wrq->length == WLAN_WEP232_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ } else if (wrq->length == WLAN_WEP104_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- 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);
}
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
memcpy(pDevice->abyKey, extra, wrq->length);
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]);
- }
if (pDevice->flags & DEVICE_FLAGS_OPENED) {
spin_lock_irq(&pDevice->lock);
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
// Do we want to just set the transmit key index?
- if ( index < 4 ) {
+ if (index < 4) {
pDevice->byKeyIndex = index;
} else if (!(wrq->flags & IW_ENCODE_MODE)) {
rc = -EINVAL;
}
}
// 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");
pMgmt->bShareKeyAlgorithm = FALSE;
pDevice->bEncryptionEnable = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
- if (index > WLAN_WEP_NKEYS) {
+ if (index > WLAN_WEP_NKEYS)
return -EINVAL;
- }
if (index < 1) { // get default key
- if (pDevice->byKeyIndex < WLAN_WEP_NKEYS){
+ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS)
index = pDevice->byKeyIndex;
- } else
+ else
index = 0;
- }else
+ } else {
index--;
+ }
memset(abyKey, 0, WLAN_WEP232_KEYLEN);
// Check encryption mode
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
}
- } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)){
+ } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)) {
wrq->length = pKey->uKeyLength;
memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
if (pDevice->bLinkPass == TRUE) {
RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
wrq->value = ldBm;
- }
- else {
+ } else {
wrq->value = 0;
}
wrq->disabled = (wrq->value == 0);
wpa_version = wrq->value;
if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
- }
- 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");
- }
- else {
+ } else {
PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
}
break;
PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise);
if (pairwise == IW_AUTH_CIPHER_CCMP){
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }else if (pairwise == IW_AUTH_CIPHER_TKIP){
+ } else if (pairwise == IW_AUTH_CIPHER_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
} else if (pairwise == IW_AUTH_CIPHER_WEP40 ||
pairwise == IW_AUTH_CIPHER_WEP104) {
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- }else if (pairwise == IW_AUTH_CIPHER_NONE){
+ } else if (pairwise == IW_AUTH_CIPHER_NONE) {
// do nothing, einsn liu
- } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
-
+ } else {
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ }
break;
case IW_AUTH_CIPHER_GROUP:
PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value);
if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
break;
- if (pairwise == IW_AUTH_CIPHER_NONE){
- if (wrq->value == IW_AUTH_CIPHER_CCMP){
+ if (pairwise == IW_AUTH_CIPHER_NONE) {
+ if (wrq->value == IW_AUTH_CIPHER_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
}else {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
} else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
if (wrq->value == 0){
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;
- else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
+ } else {
+ pMgmt->eAuthenMode = WMAC_AUTH_WPA;
}
break;
case IW_AUTH_TKIP_COUNTERMEASURES:
break;
case IW_AUTH_80211_AUTH_ALG:
PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value);
- if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
+ if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM)
pMgmt->bShareKeyAlgorithm = FALSE;
- } else if (wrq->value==IW_AUTH_ALG_SHARED_KEY) {
- pMgmt->bShareKeyAlgorithm=TRUE;
- }
+ else if (wrq->value == IW_AUTH_ALG_SHARED_KEY)
+ pMgmt->bShareKeyAlgorithm = TRUE;
break;
case IW_AUTH_WPA_ENABLED:
break;
break;
case IW_AUTH_PRIVACY_INVOKED:
pDevice->bEncryptionEnable = !!wrq->value;
- if (pDevice->bEncryptionEnable == FALSE){
+ if (pDevice->bEncryptionEnable == FALSE) {
wpa_version = 0;
pairwise = 0;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
int space = wrq->length;
wrq->length = 0;
- if (pMgmt->wWPAIELen > 0){
+ if (pMgmt->wWPAIELen > 0) {
wrq->length = pMgmt->wWPAIELen;
if (pMgmt->wWPAIELen <= space) {
if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
struct iw_mlme *mlme = (struct iw_mlme *)extra;
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;
return ret;
}
switch (mlme->cmd){
case IW_MLME_DEAUTH:
case IW_MLME_DISASSOC:
- if (pDevice->bLinkPass == TRUE){
+ if (pDevice->bLinkPass == TRUE) {
PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
bScheduleCommand((void *)pDevice,
WLAN_CMD_DISASSOCIATE,