📄 dot11smelib.c
字号:
{ status = ERROR; break; } *(UINT32 *)data = pDot11->defaultChannel; status = OK; break; /******************************************************************** * WIOCGSTATS - Returns the current statitics structure ********************************************************************/ case WIOCGSTATS: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL " "0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } bcopy((char *)&pDot11->stats, (char *)data, sizeof(DOT11_STATS)); break; /************************************************************** * WIOCSAUTHTYPE - Set authentication protocol **************************************************************/ case WIOCSAUTHTYPE: if (((UINT32)data == DOT11_AUTH_OPEN + 1) || ((UINT32)data == DOT11_AUTH_SHARED_KEY + 1) || ((UINT32)data == DOT11_AUTH_ALL + 1)) { if (((UINT32)data == DOT11_AUTH_SHARED_KEY + 1) && (pBss->secPol != DOT11_SECPOL_NONE)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCSAUTHTYPE: SKA not allowed" " when WPA/RSN is enabled\n",0, 0, 0, 0, 0, 0)); return ERROR; } pBss->authType = (UINT32)data - 1; status = OK; } else { status = ERROR; } break; /************************************************************** * WIOCSTXRATE: Sets the allowed transmit rates **************************************************************/ case WIOCSTXRATE: if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } taskLock(); /* Copy the new allowed rates over */ bcopy((char*)((DOT11_RATES *)data)->rates, (char*)pBss->allowedRates.rates, min(((DOT11_RATES *)data)->length, DOT11_MAX_RATES)); pBss->allowedRates.length = ((DOT11_RATES *)data)->length; taskUnlock(); status = OK; break; /******************************************************************** * WIOCGCONNECTEDBSSID - Get connected BSSID ********************************************************************/ case WIOCGCONNECTEDBSSID: /* Get connected BSSID */ /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { status = ERROR; DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); break; } status = OK; DOT11_ADDR_COPY((char *)pBss->bssid, (char *)data); break; /******************************************************************** * WIOCGCARDTYPE: Returns the type of card ********************************************************************/ case WIOCGCARDTYPE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL " "0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = pDot11->hdd->cardTypeGet(pDot11); break; /******************************************************************** * WIOCGWEPAVAIL: Returns WEP availability ********************************************************************/ case WIOCGWEPAVAIL: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL " "0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } /* WEP is always supported */ * (UINT32 *)data = TRUE; status = OK; break; /************************************************************** * WIOCGENCRYPTTYPE: Returns the current state of encryption **************************************************************/ case WIOCGENCRYPTTYPE: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32 *)data = pBss->multiEncryptType; status = OK; break; /************************************************************** * WIOCSENCRYPTTYPE: Sets the current encryption policy **************************************************************/ case WIOCSENCRYPTTYPE: if ((UINT32)data < DOT11_ENCRYPT_MAX) { taskLock(); pBss->multiEncryptType = (UINT32)data; taskUnlock(); status = OK; } else { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: Bad encrypt type in" " WIOCSENCRYPTTYPE\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; } break; /******************************************************************** * WIOCSWEPDEFAULTKEY: Sets the default keyslot for TX ********************************************************************/ case WIOCSWEPDEFAULTKEY: /* We need a pointer in <data>. Make sure it's not NULL */ if ((UINT32)data >= DOT11_MAX_DEFAULT_KEY) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: Bad key number in " "WIODSWEPDEFAULTKEY\n",0,0,0,0,0,0)); status = ERROR; break; } taskLock(); pBss->multiEncryptIndex = (UINT32) data; pBss->multiDecryptIndex = (UINT32) data; pBss->multiKeySlot = (UINT32) data; taskUnlock(); status = OK; break; /******************************************************************** * WIOCGWEPDEFAULTKEY: Gets the default keyslot for TX ********************************************************************/ case WIOCGWEPDEFAULTKEY: /* We need a pointer in <data>. Make sure it's not NULL */ if ( (char*)data == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeEssIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } *(UINT32*) data = pBss->multiKeySlot; status = OK; break; /******************************************************************** * WIOCSWEPKEY0 - WIOCSWEPKEY3 - Set WEP shared keys ********************************************************************/ case WIOCSWEPKEY0: case WIOCSWEPKEY1: case WIOCSWEPKEY2: case WIOCSWEPKEY3: /* We need a pointer in <data>. Make sure it's not NULL */ if (((char*)data == NULL) || (pDot11->hdd->hwEncryptionKeySet == NULL)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: NULL <data> pointer in IOCTL" " 0x%04x\n", cmd, 0, 0, 0, 0, 0)); status = ERROR; break; } if ((((DOT11_KEY *)data)->keyType >= DOT11_KEY_TYPE_MAX) || (((DOT11_KEY *)data)->keyType == DOT11_KEY_TYPE_NONE)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: Bad key record in " "WIODSWEPKEYx - keyType==%d not allowed\n", ((DOT11_KEY *)data)->keyType,0,0,0,0,0)); status = ERROR; break; } /* Determine which keyslot we're actually setting */ switch(cmd) { case WIOCSWEPKEY0: ((DOT11_KEY *)data)->keySlot = 0; break; case WIOCSWEPKEY1: ((DOT11_KEY *)data)->keySlot = 1; break; case WIOCSWEPKEY2: ((DOT11_KEY *)data)->keySlot = 2; break; case WIOCSWEPKEY3: ((DOT11_KEY *)data)->keySlot = 3; break; } /* Ensure that the MAC address is zero, so that this is recorded as a shared key */ ((DOT11_KEY *)data)->macAddr[0] = 0; ((DOT11_KEY *)data)->macAddr[1] = 0; ((DOT11_KEY *)data)->macAddr[2] = 0; ((DOT11_KEY *)data)->macAddr[3] = 0; ((DOT11_KEY *)data)->macAddr[4] = 0; ((DOT11_KEY *)data)->macAddr[5] = 0; status = pDot11->hdd->hwEncryptionKeySet(pDot11, (DOT11_KEY *)data); break; /******************************************************************** * WIOCAPAIRWISEKEY: Add a WEP key mapping key ********************************************************************/ case WIOCAPAIRWISEKEY: { DOT11_KEY * pKey; DOT11_KSL_ENTRY * pKsl; pKey = (DOT11_KEY *)data; if ((pKey->macAddr[0] | pKey->macAddr[1] | pKey->macAddr[2] | pKey->macAddr[3] | pKey->macAddr[4] | pKey->macAddr[5]) == 0) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCAPAIRWISEKEY must have a " "macAddress in the DOT11_KEY provided\n", 0,0,0,0,0,0)); status = ERROR; break; } if ((pKey->keyType != DOT11_KEY_TYPE_WEP40) && (pKey->keyType != DOT11_KEY_TYPE_WEP104)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCAPAIRWISEKEY can only be used" " with WEP key mapping keys\n", 0,0,0,0,0,0)); status = ERROR; break; } if (pDot11->sme->ksl.lock(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCAPAIRWISEKEY: Cannot get KSL" " lock\n",0,0,0,0,0,0)); status = ERROR; break; } if ((pKsl = pDot11->sme->ksl.lookup(pDot11, pKey->macAddr)) == NULL) { if ((pKsl = pDot11->sme->ksl.add(pDot11, pKey->macAddr)) == NULL) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeIoctl: WIOCAPAIRWISEKEY cannot create " "KSL entry\n", 0,0,0,0,0,0)); pDot11->sme->ksl.unlock(pDot11); status = ERROR; break; } } pKsl->wepKeyMapping = TRUE; /* If no keys have been set, then we need a new one */ if ((p
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -