diff options
Diffstat (limited to 'drivers/staging/vt6655/hostap.c')
-rw-r--r-- | drivers/staging/vt6655/hostap.c | 73 |
1 files changed, 11 insertions, 62 deletions
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index 6eecd5358916..317c2a8ee162 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c @@ -48,7 +48,6 @@ /*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Variables --------------------------*/ -//static int msglevel =MSG_LEVEL_DEBUG; static int msglevel = MSG_LEVEL_INFO; /*--------------------- Static Functions --------------------------*/ @@ -207,11 +206,11 @@ static int hostap_remove_sta(PSDevice pDevice, { unsigned int uNodeIndex; - if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) { + if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) BSSvRemoveOneNode(pDevice, uNodeIndex); - } else { + else return -ENOENT; - } + return 0; } @@ -234,14 +233,13 @@ static int hostap_add_sta(PSDevice pDevice, PSMgmtObject pMgmt = pDevice->pMgmt; unsigned int uNodeIndex; - if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { + if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex); - } + memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC; pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability; // TODO listenInterval -// pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1; pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false; pMgmt->sNodeDBTable[uNodeIndex].bySuppRate = param->u.add_sta.tx_supp_rates; @@ -296,8 +294,6 @@ static int hostap_get_info_sta(PSDevice pDevice, if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { param->u.get_info_sta.inactive_sec = (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ; - - //param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts; } else { return -ENOENT; } @@ -307,37 +303,6 @@ static int hostap_get_info_sta(PSDevice pDevice, /* * Description: - * reset txexec - * - * Parameters: - * In: - * pDevice - - * param - - * Out: - * true, false - * - * Return Value: - * - */ -/* - static int hostap_reset_txexc_sta(PSDevice pDevice, - struct viawget_hostapd_param *param) - { - PSMgmtObject pMgmt = pDevice->pMgmt; - unsigned int uNodeIndex; - - if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) { - pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0; - } else { - return -ENOENT; - } - - return 0; - } -*/ - -/* - * Description: * set station flag * * Parameters: @@ -456,19 +421,12 @@ static int hostap_set_encryption(PSDevice pDevice, unsigned char abySeq[MAX_KEY_LEN]; unsigned long long KeyRSC; unsigned char byKeyDecMode = KEY_CTL_WEP; - int ret = 0; int iNodeIndex = -1; int ii; bool bKeyTableFull = false; unsigned short wKeyCtl = 0; param->u.crypt.err = 0; -/* - if (param_len != - (int) ((char *) param->u.crypt.key - (char *) param) + - param->u.crypt.key_len) - return -EINVAL; -*/ if (param->u.crypt.alg > WPA_ALG_CCMP) return -EINVAL; @@ -516,7 +474,7 @@ static int hostap_set_encryption(PSDevice pDevice, MAX_KEY_LEN ); - return ret; + return 0; } memcpy(abyKey, param->u.crypt.key, param->u.crypt.key_len); @@ -572,7 +530,7 @@ static int hostap_set_encryption(PSDevice pDevice, pMgmt->byCSSGK = KEY_CTL_WEP; pMgmt->sNodeDBTable[iNodeIndex].byCipherSuite = KEY_CTL_WEP; pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex = dwKeyIndex; - return ret; + return 0; } if (param->u.crypt.seq) { @@ -663,7 +621,7 @@ static int hostap_set_encryption(PSDevice pDevice, pMgmt->sNodeDBTable[iNodeIndex].dwTSC47_16 = 0; pMgmt->sNodeDBTable[iNodeIndex].wTSC15_0 = 0; - return ret; + return 0; } /* @@ -684,7 +642,6 @@ static int hostap_get_encryption(PSDevice pDevice, int param_len) { PSMgmtObject pMgmt = pDevice->pMgmt; - int ret = 0; int ii; int iNodeIndex = 0; @@ -701,11 +658,10 @@ static int hostap_get_encryption(PSDevice pDevice, } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "hostap_get_encryption: %d\n", iNodeIndex); memset(param->u.crypt.seq, 0, 8); - for (ii = 0; ii < 8; ii++) { + for (ii = 0; ii < 8; ii++) param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8); - } - return ret; + return 0; } /* @@ -780,12 +736,6 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) ret = hostap_get_info_sta(pDevice, param); ap_ioctl = 1; break; -/* - case VIAWGET_HOSTAPD_RESET_TXEXC_STA: - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n"); - ret = hostap_reset_txexc_sta(pDevice, param); - break; -*/ case VIAWGET_HOSTAPD_SET_FLAGS_STA: DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n"); ret = hostap_set_flags_sta(pDevice, param); @@ -814,9 +764,8 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p) } if ((ret == 0) && ap_ioctl) { - if (copy_to_user(p->pointer, param, p->length)) { + if (copy_to_user(p->pointer, param, p->length)) ret = -EFAULT; - } } out: |