pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
- if (req->essid_len>0)
+ if (req->essid_len > 0)
pItemSSID->len = req->essid_len - 1;
}
else
pItemSSID->len = req->essid_len;
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);
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
spin_unlock_irq(&pDevice->lock);
pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
iwe.u.data.length = pItemSSID->len;
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
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWMODE;
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);
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
// ADD frequency
pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
iwe.u.freq.m = pBSS->uChannel;
iwe.u.freq.e = 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);
{
int f = (int)pBSS->uChannel - 1;
if (f < 0)
iwe.u.freq.m = frequency_list[f] * 100000;
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
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVQUAL;
}else if (-ldBm > 90) {
iwe.u.qual.qual = 0;
}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;
- 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);
// ADD encryption
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = SIOCGIWENCODE;
iwe.u.data.length = 0;
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 {
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));
iwe.cmd = SIOCGIWRATE;
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
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)
break;
// Bit rate given in 500 kb/s units (+ 0x80)
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)
break;
// Bit rate given in 500 kb/s units (+ 0x80)
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)
iwe.cmd = IWEVCUSTOM;
sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
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)) {
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE;
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)) {
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE;
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);
}
-
}
} // for
wrq->length = current_ev - extra;
}
switch (*wmode) {
-
case IW_MODE_ADHOC:
if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
range->max_qual.noise = 0;
range->sensitivity = 255;
- for (i = 0 ; i < 13 ; i++) {
+ for (i = 0; i < 13; i++) {
range->bitrate[i] = abySupportedRates[i] * 500000;
if (range->bitrate[i] == 0)
break;
memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
// mike: add
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");
return rc;
}
pBSS = &(pMgmt->sBSSList[ii]);
if (!pBSS->bActive)
continue;
- if ( jj >= IW_MAX_AP)
+ if (jj >= IW_MAX_AP)
break;
memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
sock[jj].sa_family = ARPHRD_ETHER;
wrq->flags = 1; // Should be define'd
wrq->length = jj;
- memcpy(extra, sock, sizeof(struct sockaddr)*jj);
- memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj);
+ memcpy(extra, sock, sizeof(struct sockaddr) * jj);
+ memcpy(extra + sizeof(struct sockaddr) * jj, qual, sizeof(struct iw_quality) * jj);
}
return rc;
}
memset(pMgmt->abyDesireBSSID, 0xFF,6);
PRINT_K("set essid to 'any' \n");
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //Unknown desired AP,so here need not associate??
+ // Unknown desired AP, so here need not associate??
return 0;
#endif
} else {
}
else
pItemSSID->len = wrq->length;
- PRINT_K("set essid to %s \n",pItemSSID->abySSID);
+ PRINT_K("set essid to %s \n", pItemSSID->abySSID);
// mike: need clear desiredBSSID
if (pItemSSID->len==0) {
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
return 0;
}
unsigned ii;
unsigned uSameBssidNum = 0;
- memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
+ memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID));
pCurr = BSSpSearchBSSList(pDevice, NULL,
abyTmpDesireSSID,
- pDevice->eConfigPHYMode
- );
+ pDevice->eConfigPHYMode);
- if (pCurr == NULL){
+ if (pCurr == NULL) {
PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
vResetCommandTimer((void *)pDevice);
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
// Get the current SSID
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
+ memcpy(extra, pItemSSID->abySSID, pItemSSID->len);
extra[pItemSSID->len] = '\0';
wrq->length = pItemSSID->len;
// First: get a valid bit rate value
// Which type of value
- if ((wrq->value < 13) &&
- (wrq->value >= 0)) {
+ if ((wrq->value < 13) && (wrq->value >= 0)) {
// Setting by rate index
// Find value in the magic rate table
brate = wrq->value;
} else {
// Setting by frequency value
- u8 normvalue = (u8) (wrq->value/500000);
+ u8 normvalue = (u8)(wrq->value/500000);
// Check if rate is valid
- for (i = 0 ; i < 13 ; i++) {
+ for (i = 0; i < 13; i++) {
if (normvalue == abySupportedRates[i]) {
brate = i;
break;
// -1 designed the max rate (mostly auto mode)
if (wrq->value == -1) {
// Get the highest available rate
- for (i = 0 ; i < 13 ; i++) {
+ for (i = 0; i < 13; i++) {
if (abySupportedRates[i] == 0)
break;
}
// Fixed mode
// One rate, fixed
pDevice->bFixRate = TRUE;
- if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
+ if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
pDevice->uConnectionRate = 3;
}
else {
pDevice->uConnectionRate = brate;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
}
-
}
else {
pDevice->bFixRate = FALSE;
if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
wrq->flags |= IW_RETRY_MIN;
}
-
return 0;
}
if (pDevice->flags & DEVICE_FLAGS_OPENED) {
spin_lock_irq(&pDevice->lock);
- KeybSetDefaultKey( pDevice,
+ KeybSetDefaultKey(pDevice,
&(pDevice->sKey),
dwKeyIndex | (1 << 31),
- wrq->length,
- NULL,
+ wrq->length, NULL,
pDevice->abyKey,
KEY_CTL_WEP
);
}
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
#endif
return rc;
}
if (index > WLAN_WEP_NKEYS) {
return -EINVAL;
}
- if (index<1){ // get default key
- if (pDevice->byKeyIndex<WLAN_WEP_NKEYS){
- index=pDevice->byKeyIndex;
+ if (index < 1) { // get default key
+ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS){
+ index = pDevice->byKeyIndex;
} else
- index=0;
+ index = 0;
}else
index--;
wrq->flags = IW_ENCODE_NOKEY;
// Is WEP enabled ???
if (pDevice->bEncryptionEnable)
- wrq->flags |= IW_ENCODE_ENABLED;
+ wrq->flags |= IW_ENCODE_ENABLED;
else
- wrq->flags |= IW_ENCODE_DISABLED;
+ wrq->flags |= IW_ENCODE_DISABLED;
if (pMgmt->bShareKeyAlgorithm)
- wrq->flags |= IW_ENCODE_RESTRICTED;
+ wrq->flags |= IW_ENCODE_RESTRICTED;
else
- wrq->flags |= IW_ENCODE_OPEN;
- wrq->length=0;
+ wrq->flags |= IW_ENCODE_OPEN;
+ 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
- if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
+ if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) {
wrq->length = pKey->uKeyLength;
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);
+ memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+ memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
}
- wrq->flags |= index+1;
+ wrq->flags |= index + 1;
return 0;
}
break;
case IW_AUTH_CIPHER_PAIRWISE:
pairwise = wrq->value;
- PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise);
+ 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){
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
}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);
+ 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){
}
break;
case IW_AUTH_KEY_MGMT:
- PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value);
+ PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version,wrq->value);
if (wpa_version == IW_AUTH_WPA_VERSION_WPA2){
if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
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){
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
}else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
case IW_AUTH_DROP_UNENCRYPTED:
break;
case IW_AUTH_80211_AUTH_ALG:
- PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value);
+ PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value);
if (wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
- pMgmt->bShareKeyAlgorithm=FALSE;
- }else if (wrq->value==IW_AUTH_ALG_SHARED_KEY){
+ pMgmt->bShareKeyAlgorithm = FALSE;
+ } else if (wrq->value==IW_AUTH_ALG_SHARED_KEY) {
pMgmt->bShareKeyAlgorithm=TRUE;
}
break;
int ret = 0;
if (wrq->length){
- if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
+ if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) {
ret = -EINVAL;
goto out;
}
wrq->length = 0;
if (pMgmt->wWPAIELen > 0){
wrq->length = pMgmt->wWPAIELen;
- if (pMgmt->wWPAIELen <= space){
- if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
+ if (pMgmt->wWPAIELen <= space) {
+ if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
ret = -EFAULT;
}
- }else
+ } else
ret = -E2BIG;
}
return ret;
wpa_alg alg_name;
u8 addr[6];
int key_idx;
- int set_tx=0;
+ int set_tx = 0;
u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
u8 key[64];
size_t seq_len = 0;
}
// recover key,key_len
if (ext->key_len) {
- key_len=ext->key_len;
+ key_len = ext->key_len;
memcpy(key, &ext->key[0], key_len);
}
memset(key_array, 0, 64);
- if ( key_len > 0) {
+ if (key_len > 0) {
memcpy(key_array, key, key_len);
if (key_len == 32) {
// notice ! the oder
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = TRUE;
}
- if ((pDevice->bwextstep2 == TRUE)&&(param->u.wpa_key.key_index == 3)) {
+ if ((pDevice->bwextstep2 == TRUE) && (param->u.wpa_key.key_index == 3)) {
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = TRUE;
}
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = FALSE;
pDevice->bWPASuppWextEnabled = TRUE;
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- KeyvInitTable(pDevice,&pDevice->sKey);
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ KeyvInitTable(pDevice, &pDevice->sKey);
}
/*******/
spin_lock_irq(&pDevice->lock);
};
struct iw_priv_args iwctl_private_args[] = {
- { IOCTL_CMD_SET,
- IW_PRIV_TYPE_CHAR | 1024, 0,
- "set"},
+ { IOCTL_CMD_SET, IW_PRIV_TYPE_CHAR | 1024, 0, "set" },
};
const struct iw_handler_def iwctl_handler_def = {
- .get_wireless_stats = &iwctl_get_wireless_stats,
- .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler),
- .num_private = 0,
- .num_private_args = 0,
- .standard = (iw_handler *)iwctl_handler,
- .private = NULL,
- .private_args = NULL,
+ .get_wireless_stats = &iwctl_get_wireless_stats,
+ .num_standard = sizeof(iwctl_handler) / sizeof(iw_handler),
+ .num_private = 0,
+ .num_private_args = 0,
+ .standard = (iw_handler *)iwctl_handler,
+ .private = NULL,
+ .private_args = NULL,
};