···11-/*22- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.33- * All rights reserved.44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License as published by77- * the Free Software Foundation; either version 2 of the License, or88- * (at your option) any later version.99- *1010- * This program is distributed in the hope that it will be useful,1111- * but WITHOUT ANY WARRANTY; without even the implied warranty of1212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313- * GNU General Public License for more details.1414- *1515- * You should have received a copy of the GNU General Public License along1616- * with this program; if not, write to the Free Software Foundation, Inc.,1717- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.1818- *1919- * File: ioctl.c2020- *2121- * Purpose: private ioctl functions2222- *2323- * Author: Lyndon Chen2424- *2525- * Date: Auguest 20, 20032626- *2727- * Functions:2828- *2929- * Revision History:3030- *3131- */3232-3333-#include "ioctl.h"3434-#include "iocmd.h"3535-#include "mac.h"3636-#include "card.h"3737-#include "hostap.h"3838-#include "wpactl.h"3939-#include "rf.h"4040-4141-int private_ioctl(struct vnt_private *pDevice, struct ifreq *rq)4242-{4343- PSCmdRequest pReq = (PSCmdRequest)rq;4444- PSMgmtObject pMgmt = pDevice->pMgmt;4545- int result = 0;4646- PWLAN_IE_SSID pItemSSID;4747- SCmdBSSJoin sJoinCmd;4848- SCmdScan sScanCmd;4949- SCmdStartAP sStartAPCmd;5050- SCmdSetWEP sWEPCmd;5151- SCmdValue sValue;5252- SBSSIDList sList;5353- SNodeList sNodeList;5454- PSBSSIDList pList;5555- PSNodeList pNodeList;5656- unsigned int cbListCount;5757- PKnownBSS pBSS;5858- PKnownNodeDB pNode;5959- unsigned int ii, jj;6060- unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};6161- unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};6262- unsigned long dwKeyIndex = 0;6363- unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];6464- long ldBm;6565-6666- pReq->wResult = 0;6767-6868- switch (pReq->wCmdCode) {6969- case WLAN_CMD_BSS_SCAN:7070- pr_debug("WLAN_CMD_BSS_SCAN..begin\n");7171- if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {7272- result = -EFAULT;7373- break;7474- }7575-7676- pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid;7777- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)7878- return -EINVAL;7979- if (pItemSSID->len != 0) {8080- memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);8181- memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);8282- }8383-8484- if (pDevice->bMACSuspend == true) {8585- if (pDevice->bRadioOff == true)8686- CARDbRadioPowerOn(pDevice);8787- vMgrTimerInit(pDevice);8888- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);8989- add_timer(&pMgmt->sTimerSecondCallback);9090- pDevice->bMACSuspend = false;9191- }9292- spin_lock_irq(&pDevice->lock);9393- if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0)9494- BSSvClearBSSList((void *)pDevice, false);9595- else9696- BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);9797-9898- if (pItemSSID->len != 0)9999- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);100100- else101101- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);102102- spin_unlock_irq(&pDevice->lock);103103- break;104104-105105- case WLAN_CMD_ZONETYPE_SET:106106- /* mike add :can't support. */107107- result = -EOPNOTSUPP;108108- break;109109-110110- case WLAN_CMD_BSS_JOIN:111111- if (pDevice->bMACSuspend == true) {112112- if (pDevice->bRadioOff == true)113113- CARDbRadioPowerOn(pDevice);114114- vMgrTimerInit(pDevice);115115- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);116116- add_timer(&pMgmt->sTimerSecondCallback);117117- pDevice->bMACSuspend = false;118118- }119119-120120- if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) {121121- result = -EFAULT;122122- break;123123- }124124-125125- pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid;126126- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)127127- return -EINVAL;128128- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);129129- memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);130130- if (sJoinCmd.wBSSType == ADHOC) {131131- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;132132- pr_debug("ioct set to adhoc mode\n");133133- } else {134134- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;135135- pr_debug("ioct set to STA mode\n");136136- }137137- if (sJoinCmd.bPSEnable == true) {138138- pDevice->ePSMode = WMAC_POWER_FAST;139139- pMgmt->wListenInterval = 2;140140- pr_debug("Power Saving On\n");141141- } else {142142- pDevice->ePSMode = WMAC_POWER_CAM;143143- pMgmt->wListenInterval = 1;144144- pr_debug("Power Saving Off\n");145145- }146146-147147- if (sJoinCmd.bShareKeyAuth == true) {148148- pMgmt->bShareKeyAlgorithm = true;149149- pr_debug("Share Key\n");150150- } else {151151- pMgmt->bShareKeyAlgorithm = false;152152- pr_debug("Open System\n");153153- }154154- pDevice->uChannel = sJoinCmd.uChannel;155155- netif_stop_queue(pDevice->dev);156156- spin_lock_irq(&pDevice->lock);157157- pMgmt->eCurrState = WMAC_STATE_IDLE;158158- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);159159- bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);160160- spin_unlock_irq(&pDevice->lock);161161- break;162162-163163- case WLAN_CMD_SET_WEP:164164- pr_debug("WLAN_CMD_SET_WEP Key\n");165165- memset(&sWEPCmd, 0, sizeof(SCmdSetWEP));166166- if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {167167- result = -EFAULT;168168- break;169169- }170170- if (sWEPCmd.bEnableWep != true) {171171- pDevice->bEncryptionEnable = false;172172- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;173173- MACvDisableDefaultKey(pDevice->PortOffset);174174- pr_debug("WEP function disable\n");175175- break;176176- }177177-178178- for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) {179179- if (sWEPCmd.bWepKeyAvailable[ii]) {180180- if (ii == sWEPCmd.byKeyIndex)181181- dwKeyIndex = ii | (1 << 31);182182- else183183- dwKeyIndex = ii;184184-185185- KeybSetDefaultKey(&(pDevice->sKey),186186- dwKeyIndex,187187- sWEPCmd.auWepKeyLength[ii],188188- NULL,189189- (unsigned char *)&sWEPCmd.abyWepKey[ii][0],190190- KEY_CTL_WEP,191191- pDevice->PortOffset,192192- pDevice->byLocalID);193193- }194194- }195195- pDevice->byKeyIndex = sWEPCmd.byKeyIndex;196196- pDevice->bTransmitKey = true;197197- pDevice->bEncryptionEnable = true;198198- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;199199- break;200200-201201- case WLAN_CMD_GET_LINK: {202202- SCmdLinkStatus sLinkStatus;203203-204204- pr_debug("WLAN_CMD_GET_LINK status\n");205205-206206- memset(&sLinkStatus, 0, sizeof(sLinkStatus));207207-208208- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)209209- sLinkStatus.wBSSType = ADHOC;210210- else211211- sLinkStatus.wBSSType = INFRA;212212-213213- if (pMgmt->eCurrState == WMAC_STATE_JOINTED)214214- sLinkStatus.byState = ADHOC_JOINTED;215215- else216216- sLinkStatus.byState = ADHOC_STARTED;217217-218218- sLinkStatus.uChannel = pMgmt->uCurrChannel;219219- if (pDevice->bLinkPass == true) {220220- sLinkStatus.bLink = true;221221- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;222222- memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);223223- memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);224224- sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;225225- pr_debug(" Link Success!\n");226226- } else {227227- sLinkStatus.bLink = false;228228- sLinkStatus.uLinkRate = 0;229229- }230230- if (copy_to_user(pReq->data, &sLinkStatus, sizeof(SCmdLinkStatus))) {231231- result = -EFAULT;232232- break;233233- }234234- break;235235- }236236- case WLAN_CMD_GET_LISTLEN:237237- cbListCount = 0;238238- pBSS = &(pMgmt->sBSSList[0]);239239- for (ii = 0; ii < MAX_BSS_NUM; ii++) {240240- pBSS = &(pMgmt->sBSSList[ii]);241241- if (!pBSS->bActive)242242- continue;243243- cbListCount++;244244- }245245- sList.uItem = cbListCount;246246- if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) {247247- result = -EFAULT;248248- break;249249- }250250- pReq->wResult = 0;251251- break;252252-253253- case WLAN_CMD_GET_LIST:254254- if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) {255255- result = -EFAULT;256256- break;257257- }258258- if (sList.uItem > (ULONG_MAX - sizeof(SBSSIDList)) / sizeof(SBSSIDItem)) {259259- result = -EINVAL;260260- break;261261- }262262- pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)),263263- GFP_ATOMIC);264264- if (pList == NULL) {265265- result = -ENOMEM;266266- break;267267- }268268- pList->uItem = sList.uItem;269269- pBSS = &(pMgmt->sBSSList[0]);270270- for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) {271271- pBSS = &(pMgmt->sBSSList[jj]);272272- if (pBSS->bActive) {273273- pList->sBSSIDList[ii].uChannel = pBSS->uChannel;274274- pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval;275275- pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo;276276- RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm);277277- pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm;278278- memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN);279279- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;280280- memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1);281281- memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len);282282- if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo))283283- pList->sBSSIDList[ii].byNetType = INFRA;284284- else285285- pList->sBSSIDList[ii].byNetType = ADHOC;286286-287287- if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo))288288- pList->sBSSIDList[ii].bWEPOn = true;289289- else290290- pList->sBSSIDList[ii].bWEPOn = false;291291-292292- ii++;293293- if (ii >= pList->uItem)294294- break;295295- }296296- }297297-298298- if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) {299299- result = -EFAULT;300300- break;301301- }302302- kfree(pList);303303- pReq->wResult = 0;304304- break;305305-306306- case WLAN_CMD_GET_MIB:307307- if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) {308308- result = -EFAULT;309309- break;310310- }311311- break;312312-313313- case WLAN_CMD_GET_STAT:314314- if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) {315315- result = -EFAULT;316316- break;317317- }318318- break;319319-320320- case WLAN_CMD_STOP_MAC:321321- pr_debug("WLAN_CMD_STOP_MAC\n");322322- netif_stop_queue(pDevice->dev);323323-324324- spin_lock_irq(&pDevice->lock);325325- if (pDevice->bRadioOff == false)326326- CARDbRadioPowerOff(pDevice);327327-328328- pDevice->bLinkPass = false;329329- memset(pMgmt->abyCurrBSSID, 0, 6);330330- pMgmt->eCurrState = WMAC_STATE_IDLE;331331- del_timer(&pDevice->sTimerCommand);332332- del_timer(&pMgmt->sTimerSecondCallback);333333- pDevice->bCmdRunning = false;334334- pDevice->bMACSuspend = true;335335- MACvIntDisable(pDevice->PortOffset);336336- spin_unlock_irq(&pDevice->lock);337337- break;338338-339339- case WLAN_CMD_START_MAC:340340- pr_debug("WLAN_CMD_START_MAC\n");341341-342342- if (pDevice->bMACSuspend == true) {343343- if (pDevice->bRadioOff == true)344344- CARDbRadioPowerOn(pDevice);345345- vMgrTimerInit(pDevice);346346- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);347347- add_timer(&pMgmt->sTimerSecondCallback);348348- pDevice->bMACSuspend = false;349349- }350350- break;351351-352352- case WLAN_CMD_SET_HOSTAPD:353353- pr_debug("WLAN_CMD_SET_HOSTAPD\n");354354-355355- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {356356- result = -EFAULT;357357- break;358358- }359359- if (sValue.dwValue == 1) {360360- if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) {361361- pr_debug("Enable HOSTAP\n");362362- } else {363363- result = -EFAULT;364364- break;365365- }366366- } else {367367- vt6655_hostap_set_hostapd(pDevice, 0, 1);368368- pr_debug("Disable HOSTAP\n");369369- }370370- break;371371-372372- case WLAN_CMD_SET_HOSTAPD_STA:373373- pr_debug("WLAN_CMD_SET_HOSTAPD_STA\n");374374- break;375375-376376- case WLAN_CMD_SET_802_1X:377377- pr_debug("WLAN_CMD_SET_802_1X\n");378378- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {379379- result = -EFAULT;380380- break;381381- }382382-383383- if (sValue.dwValue == 1) {384384- pDevice->bEnable8021x = true;385385- pr_debug("Enable 802.1x\n");386386- } else {387387- pDevice->bEnable8021x = false;388388- pr_debug("Disable 802.1x\n");389389- }390390- break;391391-392392- case WLAN_CMD_SET_HOST_WEP:393393- pr_debug("WLAN_CMD_SET_HOST_WEP\n");394394- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {395395- result = -EFAULT;396396- break;397397- }398398-399399- if (sValue.dwValue == 1) {400400- pDevice->bEnableHostWEP = true;401401- pr_debug("Enable HostWEP\n");402402- } else {403403- pDevice->bEnableHostWEP = false;404404- pr_debug("Disable HostWEP\n");405405- }406406- break;407407-408408- case WLAN_CMD_SET_WPA:409409- pr_debug("WLAN_CMD_SET_WPA\n");410410-411411- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {412412- result = -EFAULT;413413- break;414414- }415415- if (sValue.dwValue == 1) {416416- pr_debug("up wpadev\n");417417- eth_hw_addr_inherit(pDevice->wpadev, pDevice->dev);418418- pDevice->bWPADEVUp = true;419419- } else {420420- pr_debug("close wpadev\n");421421- pDevice->bWPADEVUp = false;422422- }423423- break;424424-425425- case WLAN_CMD_AP_START:426426- pr_debug("WLAN_CMD_AP_START\n");427427- if (pDevice->bRadioOff == true) {428428- CARDbRadioPowerOn(pDevice);429429- vMgrTimerInit(pDevice);430430- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);431431- add_timer(&pMgmt->sTimerSecondCallback);432432- }433433- if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) {434434- result = -EFAULT;435435- break;436436- }437437-438438- if (sStartAPCmd.wBSSType == AP) {439439- pMgmt->eConfigMode = WMAC_CONFIG_AP;440440- pr_debug("ioct set to AP mode\n");441441- } else {442442- pr_debug("ioct BSS type not set to AP mode\n");443443- result = -EFAULT;444444- break;445445- }446446-447447- if (sStartAPCmd.wBBPType == PHY80211g)448448- pMgmt->byAPBBType = PHY_TYPE_11G;449449- else if (sStartAPCmd.wBBPType == PHY80211a)450450- pMgmt->byAPBBType = PHY_TYPE_11A;451451- else452452- pMgmt->byAPBBType = PHY_TYPE_11B;453453-454454- pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid;455455- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)456456- return -EINVAL;457457- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);458458- memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);459459-460460- if ((sStartAPCmd.uChannel > 0) && (sStartAPCmd.uChannel <= 14))461461- pDevice->uChannel = sStartAPCmd.uChannel;462462-463463- if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000))464464- pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt;465465- else466466- pMgmt->wIBSSBeaconPeriod = 100;467467-468468- if (sStartAPCmd.bShareKeyAuth == true) {469469- pMgmt->bShareKeyAlgorithm = true;470470- pr_debug("Share Key\n");471471- } else {472472- pMgmt->bShareKeyAlgorithm = false;473473- pr_debug("Open System\n");474474- }475475- memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6);476476-477477- if (sStartAPCmd.byBasicRate & BIT3) {478478- pMgmt->abyIBSSSuppRates[2] |= BIT7;479479- pMgmt->abyIBSSSuppRates[3] |= BIT7;480480- pMgmt->abyIBSSSuppRates[4] |= BIT7;481481- pMgmt->abyIBSSSuppRates[5] |= BIT7;482482- } else if (sStartAPCmd.byBasicRate & BIT2) {483483- pMgmt->abyIBSSSuppRates[2] |= BIT7;484484- pMgmt->abyIBSSSuppRates[3] |= BIT7;485485- pMgmt->abyIBSSSuppRates[4] |= BIT7;486486- } else if (sStartAPCmd.byBasicRate & BIT1) {487487- pMgmt->abyIBSSSuppRates[2] |= BIT7;488488- pMgmt->abyIBSSSuppRates[3] |= BIT7;489489- } else if (sStartAPCmd.byBasicRate & BIT1) {490490- pMgmt->abyIBSSSuppRates[2] |= BIT7;491491- } else {492492- /* default 1,2M */493493- pMgmt->abyIBSSSuppRates[2] |= BIT7;494494- pMgmt->abyIBSSSuppRates[3] |= BIT7;495495- }496496-497497- pr_debug("Support Rate= %*ph\n",498498- 4, pMgmt->abyIBSSSuppRates + 2);499499-500500- netif_stop_queue(pDevice->dev);501501- spin_lock_irq(&pDevice->lock);502502- bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);503503- spin_unlock_irq(&pDevice->lock);504504- break;505505-506506- case WLAN_CMD_GET_NODE_CNT:507507- cbListCount = 0;508508- pNode = &(pMgmt->sNodeDBTable[0]);509509- for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {510510- pNode = &(pMgmt->sNodeDBTable[ii]);511511- if (!pNode->bActive)512512- continue;513513- cbListCount++;514514- }515515-516516- sNodeList.uItem = cbListCount;517517- if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) {518518- result = -EFAULT;519519- break;520520- }521521- pReq->wResult = 0;522522- break;523523-524524- case WLAN_CMD_GET_NODE_LIST:525525- if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) {526526- result = -EFAULT;527527- break;528528- }529529- if (sNodeList.uItem > (ULONG_MAX - sizeof(SNodeList)) / sizeof(SNodeItem)) {530530- result = -EINVAL;531531- break;532532- }533533- pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)),534534- GFP_ATOMIC);535535- if (pNodeList == NULL) {536536- result = -ENOMEM;537537- break;538538- }539539- pNodeList->uItem = sNodeList.uItem;540540- pNode = &(pMgmt->sNodeDBTable[0]);541541- for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) {542542- pNode = &(pMgmt->sNodeDBTable[ii]);543543- if (pNode->bActive) {544544- pNodeList->sNodeList[jj].wAID = pNode->wAID;545545- memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN);546546- pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate;547547- pNodeList->sNodeList[jj].wInActiveCount = (unsigned short)pNode->uInActiveCount;548548- pNodeList->sNodeList[jj].wEnQueueCnt = (unsigned short)pNode->wEnQueueCnt;549549- pNodeList->sNodeList[jj].wFlags = (unsigned short)pNode->dwFlags;550550- pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable;551551- pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex;552552- pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength;553553- memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN);554554- pr_debug("key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",555555- pNodeList->sNodeList[jj].abyWepKey[0],556556- pNodeList->sNodeList[jj].abyWepKey[1],557557- pNodeList->sNodeList[jj].abyWepKey[2],558558- pNodeList->sNodeList[jj].abyWepKey[3],559559- pNodeList->sNodeList[jj].abyWepKey[4]);560560- pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback;561561- pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures;562562- pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts;563563- pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio;564564- jj++;565565- if (jj >= pNodeList->uItem)566566- break;567567- }568568- }569569- if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {570570- result = -EFAULT;571571- break;572572- }573573- kfree(pNodeList);574574- pReq->wResult = 0;575575- break;576576-577577- default:578578- pr_debug("Private command not support..\n");579579- }580580-581581- return result;582582-}
-36
drivers/staging/vt6655/ioctl.h
···11-/*22- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.33- * All rights reserved.44- *55- * This program is free software; you can redistribute it and/or modify66- * it under the terms of the GNU General Public License as published by77- * the Free Software Foundation; either version 2 of the License, or88- * (at your option) any later version.99- *1010- * This program is distributed in the hope that it will be useful,1111- * but WITHOUT ANY WARRANTY; without even the implied warranty of1212- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313- * GNU General Public License for more details.1414- *1515- * You should have received a copy of the GNU General Public License along1616- * with this program; if not, write to the Free Software Foundation, Inc.,1717- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.1818- *1919- * File: hostap.h2020- *2121- * Purpose:2222- *2323- * Author: Lyndon Chen2424- *2525- * Date: May 21, 20032626- *2727- */2828-2929-#ifndef __IOCTL_H__3030-#define __IOCTL_H__3131-3232-#include "device.h"3333-3434-int private_ioctl(struct vnt_private *, struct ifreq *rq);3535-3636-#endif /* __IOCTL_H__ */