⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dot11smeesslib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
        /**************************************************************        * WIOCGBEACONRATE:        **************************************************************/        case WIOCGBEACONRATE:            /* Not implemented in ESS mode */            status = EINVAL;            break;        /**************************************************************        * WIOCSADVSECURITY - Set advanced security options         **************************************************************/        case WIOCSADVSECURITY:                 /* Not implemented in ESS mode */            status = EINVAL;            break;        /**************************************************************        * WIOCGADVSECURITY - Get advanced security options         **************************************************************/        case WIOCGADVSECURITY:                 /* Not implemented in ESS mode */            status = EINVAL;            break;        /**************************************************************        * WIOCGDTIMRATE: Get the DTIM rate in number of beacons        **************************************************************/        case WIOCGDTIMRATE:            /* Not implemented in ESS mode */            status = EINVAL;            break;        /**************************************************************        * WIOCSDTIMRATE: Set the DTIM rate in number of beacons        **************************************************************/        case WIOCSDTIMRATE:            /* Not implemented in ESS mode */            status = EINVAL;            break;        /**************************************************************        * WIOCSAUTHCALLBACK - Sets the authentication callback        **************************************************************/        case WIOCSAUTHCALLBACK:            pDot11->sme->dot1xAuthCallback = (void *)*(UINT32 *)data;            pDot11->sme->dot1xAuthCallbackParam = *((UINT32 *)data + 1);                         /* Check if we're already associated.  If so, call the callback */            if ((pEss->pKslAp != NULL) &&                 (pEss->sm.currentState == SME_ESS_CONNECTED))                {                (void) pDot11->sme->assocCallback(pDot11, NULL,                                                 DOT1X_CALLBACK_ASSOC);                 }            status = OK;            break;        default:            status = EINVAL;            break;        }    return status;    }/**************************************************************************** * dot11SmeEssAssocReceive - Processes an ingress association response frame * * This function is called for ingress assocation response packets.  It * must check that we are in a state in which these packets make sense,  * cancel the association timeout timer, and check the status of our request. * * RETURNS: OK or ERROR, in either case the packet is freed. * * ERRNO: N/A */LOCAL STATUS dot11SmeEssAssocReceive    (    DOT11_FW * pDot11,            /* Pointer to dot11 Framework */    M_BLK_ID pMblk,             /* clBlk containing the ingress packet*/    UINT32 rate,                  /* Rate at which packet was RX in kbps */    UINT8  SSI                    /* Signal level of received packet 0-100 */    )    {    UINT8 * pCluster;                /* Cluster containing data */    DOT11_ASSOC_RESP_PACKET * pAssoc;/* 802.11 Assoc Resp packet */    DOT11_IE_EXT_RATES *      pExt;  /* Ptr to extended rates if present */    DOT11_KSL_ENTRY *         pKsl;  /* POinter to KSL Entry */    DOT11_CAPABILITIES        cap;    pCluster = (UINT8*)pMblk->mBlkHdr.mData;    pAssoc = (DOT11_ASSOC_RESP_PACKET *)pCluster;        /* Check if this packet is for us, drop it if not */    if (bcmp((char *)pAssoc->header.addr1, (char *)pDot11->macAddr,              DOT11_ADDR_LEN) != 0)        {        DOT11_LOG(DOT11_DEBUG_FLOOD, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Not for us\n",0,0,0,0,0,0));        netMblkClChainFree(pMblk);        return ERROR;        }   /* The only time we should receive this type of packet is during     association */    if (pDot11->sme->type.ess.sm.currentState != SME_ESS_ASSOCIATING)        {        DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Unexpected association packet "                   "dropped!\n", 0, 0, 0, 0, 0, 0));        netMblkClChainFree(pMblk);        return ERROR;        }    /* Cancel the timer since we got a valid response */    dot11TimerDel(pDot11->sme->type.ess.authTimer);    pDot11->sme->type.ess.authTimer = 0;    /* Check to see if there's room in the packet for an extended rates IE */    if (pMblk->mBlkHdr.mLen > (sizeof(DOT11_HEADER) +                                sizeof(DOT11_CAPABILITIES) +                               sizeof(DOT11_STATUS) + sizeof(DOT11_AID) +                                DOT11_IE_HEADER_SIZE + pAssoc->rates.length))        {        DOT11_LOG(DOT11_DEBUG_FLOOD, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Extended rates found.\n",                    0, 0, 0, 0, 0, 0));        pExt = (DOT11_IE_EXT_RATES *)(pCluster + sizeof(DOT11_HEADER) +                                       sizeof(DOT11_CAPABILITIES) +                                      sizeof(DOT11_STATUS) +                                       sizeof(DOT11_AID) +                                       DOT11_IE_HEADER_SIZE +                                       pAssoc->rates.length);        /* Check our assumption that this is an extended rates IE - it could         be something else for another standard */        if (pExt->elementId != DOT11_ELEMID_EXT_RATES)            {            pExt = NULL;            }        }    else        {        pExt = NULL;        }    /* Get the mutex for the KSL so that we can update it with     the info in this packet without it being affected by other tasks */    if (pDot11->sme->ksl.lock(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Cannot get lock.\n", 0, 0, 0, 0,                   0, 0));        netMblkClChainFree(pMblk);        return ERROR;        }    /* Check the status, and send off the appropriate event */    if (DOT11_LE_TO_CPU_16(pAssoc->status) != DOT11_STATUS_OK)        {        DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Assoc Reply-ERROR %d!\n"                   ,(int)DOT11_LE_TO_CPU_16(pAssoc->status),0,0,0,0,0));        netMblkClChainFree(pMblk);        pDot11->sme->linkEventNotify(pDot11, DOT11_ESS_ASSOC_FAIL);        return pDot11->sme->ksl.unlock(pDot11);        }        DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeEssAssocReceive: Assoc Reply -OK\n",0,0,0,0,0,0));    /* Update the KSL table with the SSID, rate information, etc that this stn    sent */    /* Set the broadcast rate to the highest basic rate offered by the AP */    cap = pAssoc->capabilities;    if (((pKsl = dot11SmeEssKslApUpdate(pDot11, pAssoc->header.addr2,                                        &cap,                                        NULL, &pAssoc->rates, pExt)) == NULL) ||        (pDot11->sme->txMultiRateSet(pDot11,                                      DOT11_DEFAULT_BSS->desiredBcastRate,                                     DOT11_DEFAULT_BSS)          != OK))        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Failed basic rates!\n"                   ,0,0,0,0,0,0));        pDot11->sme->linkEventNotify(pDot11, DOT11_ESS_ASSOC_FAIL);        netMblkClChainFree(pMblk);        return OK;        }        /* Check if there is a currently set unicast key policy.  If not, delete    any previous keys.  If there is, the new policy will use the keyslots    from the old policy */    if (pKsl->uniEncryptType != DOT11_KEY_TYPE_NONE)        {         /* Remove any existing unicast keys */        if ((pKsl->uniDecryptIndex !=              pKsl->uniEncryptIndex) &&             (pKsl->uniDecryptIndex != DOT11_KEYINDEX_NONE) &&            (pKsl->uniEncryptType != DOT11_KEY_TYPE_WEP40) &&            (pKsl->uniEncryptType != DOT11_KEY_TYPE_WEP104) &&            (pKsl->uniDecryptIndex >= DOT11_MAX_DEFAULT_KEY))            {            if (pDot11->hdd->hwEncryptionKeyDel(pDot11,                                                 pKsl->uniDecryptIndex) != OK)                {                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                           ("dot11SmeEssAssocReceive: Unable to free key "                           "%d\n", pKsl->uniEncryptIndex,                            0,0,0,0,0));                }            pKsl->uniDecryptIndex = DOT11_KEYINDEX_NONE;            }                if ((pKsl->uniEncryptIndex != DOT11_KEYINDEX_NONE) &&            (pKsl->uniEncryptType != DOT11_KEY_TYPE_WEP40) &&            (pKsl->uniEncryptType != DOT11_KEY_TYPE_WEP104) &&            (pKsl->uniEncryptIndex >= DOT11_MAX_DEFAULT_KEY))            {            if (pDot11->hdd->hwEncryptionKeyDel(pDot11,                                                 pKsl->uniEncryptIndex) != OK)                {                DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                           ("dot11SmeEssAssocReceive: Unable to free key "                           "%d\n", pKsl->uniEncryptIndex,                            0,0,0,0,0));                }            pKsl->uniEncryptType = DOT11_KEY_TYPE_NONE;            pKsl->uniDecryptIndex = DOT11_KEYINDEX_NONE;            pKsl->uniEncryptIndex = DOT11_KEYINDEX_NONE;            }        }    /* Store the AID for future use */    pKsl->type.ap.aid = (DOT11_LE_TO_CPU_16(pAssoc->aid)) & DOT11_AID_MASK;    /* Given the TIM offset, calculate the timByteOffset, in bytes since the    start of the packet.  Convert the AID into a Partial Virtual Bitmap entry    as per 7.3.2.6 of IEEE 802.11(2003). The timeByteOffset is the offset     from the start of the virtual bitmap, while the timMask is the mask     exposing the particular bit belonging to this station.  */    pKsl->type.ap.timByteOffset = (pKsl->type.ap.aid >> 3);    pKsl->type.ap.timMask = 1 << (pKsl->type.ap.aid & 0x7);    /* Notify the HDD about the association */    if (pDot11->hdd->bssidSet(pDot11, DOT11_DEFAULT_BSS->bssid, pAssoc->aid,                               pKsl->type.ap.timIeOffset) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Failed BSSID Set!\n"                   ,0,0,0,0,0,0));        pDot11->sme->linkEventNotify(pDot11, DOT11_ESS_ASSOC_FAIL);        netMblkClChainFree(pMblk);        return OK;        }    /* Implement the currently selected power management mode */    (void)pDot11->hdd->pmStateSet(pDot11, pDot11->sme->powerManagement);    pKsl->localNonceValid = FALSE;    pKsl->remoteNonceValid = FALSE;    pKsl->derivedKeysValid = FALSE;    pKsl->dot1xControlled = FALSE;    pKsl->dot1xAllowed = FALSE;    /* Enforce the chosen group policy */    if (pKsl->negSecPol != DOT11_SECPOL_NONE)        {        DOT11_DEFAULT_BSS->multiEncryptType = pKsl->groupPol;                /* Setup the port's 802.1X status depending on the authentication type         used */        if (pKsl->negAuthPol == DOT11_AUTHPOL_8021X)            {            /* If the negAuthPol was 802.1X, then make the port controlled and             closed, until the 802.1X component has time to authenticate it */                        pKsl->dot1xControlled = TRUE;            pKsl->dot1xAllowed = FALSE;                        /* Start the 4-way timer.  Since 802.1X is in use, the fourway             handshake should not start immediately.  This timer uses a longer             timeout to ensure that the 802.1X conversation does not hang.  The             timer is reset when 802.1X sets the keys */            pKsl->fourWayGlobalTimer=dot11TimerAdd(DOT11_FOURWAY_8021X_TIMEOUT,                                     (FUNCPTR)pDot11->sme->rsn.fourwayTimeout,                                     (int)pDot11, (int)pKsl);            }        else            {            /* If the negAuthPol was not 802.1X, then make the port uncontrolled */            pKsl->dot1xControlled = FALSE;            pKsl->dot1xAllowed = FALSE;                        /* Start the 4-way timer.  Since 802.1X is not in use, the fourway             handshake should start immediately.  */            pKsl->fourWayGlobalTimer=dot11TimerAdd(DOT11_FOURWAY_GLOBAL_TIMEOUT,                                      (FUNCPTR)pDot11->sme->rsn.fourwayTimeout,                                        (int)pDot11, (int)pKsl);            }        }    pDot11->sme->linkEventNotify(pDot11, DOT11_ESS_ASSOC_SUCCESS);        /* Release the KSL lock after we've finished updating the KSL */    if (pDot11->sme->ksl.unlock(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_SME,                  ("dot11SmeEssAssocReceive: Failed to free KSL lock!\n"                   ,0,0,0,0,0,0));        netMblkClChainFree(pMblk);        return ERROR;        }    netMblkClChainFree(pMblk);    return OK;    }/***************************************************************************** dot11SmeEssAuthReceive - Processes a received Authentication packet** This routine is called when an authentication packet is received.  It * must perform the following steps:*    1. Ensure that the packet is from an AP we're trying to auth with*    2. Ensure that the sequence and status are correct*    3. Post the appropriate event

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -