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

📄 dot11smeaplib.c

📁 PNE 3.3 wlan source code, running at more than vxworks6.x version
💻 C
📖 第 1 页 / 共 5 页
字号:
/* dot11SmeApLib.c - Implements Station Management Entity for AP mode *//*  * Copyright (c) 2004-2006 Wind River Systems, Inc.  * * The right to copy, distribute, modify or otherwise make use  * of this software may be licensed only pursuant to the terms  * of an applicable Wind River license agreement.  *//* Modification History--------------------04r,16mar06,rb  Fix Coverity issues (SPR 119148)04q,15mar06,rb  Fix for SPR 118966 - ACL and WPA/RSN do not work together04p,01mar06,rb  Merge from 2.1.2 bugfix branch04o,26jan06,rb  Fix to SPR 117213 - WPAv2 should use AES04n,02jan06,rb  Further fix to SPR 115951 - Broadcom interoperability issues04m,21dec05,rb  Further fix to SPR 115951 - Broadcom interoperability issues04l,15dec05,rb  Fix for SPR 114960 - Invalid duration calculations04k,14dec05,rb  Fix for SPR 115961 - Exlcude DS IE from OFDM frames04j,14dec05,rb  Fix for SPR 115959 - WEP not checking IV padding04i,13dec05,rb  Fix for SPR 115957 - Incorrect error checking during                 authentication04h,13dec05,rb  Fix for SPR 115956 - Incorrect response to unsolicited PS-Poll04g,13dec05,rb  Fix for SPR 115265 - Variables reset on AP reset04f,27feb06,rb  Changes from code inspection04e,17feb06,rb  Code cleanup and warning removal04d,11nov05,rb  Added mSSID feature04c,05oct05,rb  Fix to B0229 - WIOCSRADIOMODE crashes AP04b,28sep05,rb  Update header comments and copyright04a,23sep05,rb  Fix to B0174 - Station does not leave RSN/WPA cleanly03z,23sep05,rb  Fix for B0171 - AP keyslot corruption03y,12sep05,rb  Removed defaultCountry references03x,25aug05,rb  802.11d implementation03w,02aug05,rb  Fix for flipper bug B0074: Multicast packets do not go between                 wireless stations when using WEP03v,25jul05,rb  Removed pmCount; replaced with dot11SmeApPmActive()03u,21jul05,rb  Fix for SPR 110809 - txRates not advertised correctly03t,20jul05,rb  Flush KSL pool on mode exit03s,04jul05,rb  Power management fixes03r,29jun05,rb  Fix for SPR 110084 : SKA not disallowed when WPA/RSN enabled03q,29jun05,rb  Fix to ensure EAPOL timers are shut down before exiting mode03p,29jun05,rb  Fix for SPR 110441 -  stations cannot reassociate when AP                 reboots03o,28jun05,rb  Fix for SPR 110403 - WEP does not work with keyIndex > 003n,28jun05,rb  Fix for SPR#110426 - data abort when ar52DtimPacketAdd() fails03m,23jun05,rb  Allow Network-EAP to interoperate with OSA03l,10jun05,rb  Added RSN passphrase caching03l,16jun05,dxb  Updated refgen tags to exclude dot11SmeApLibInit()03k,01jun05,rb  Fix for bug B0398: Ping fails between legacy WEP and TKIP sta03j,20may05,rb  Demoted ERROR in dot11SmeApAuthReceive03i,06may05,rb  Partial fix for bug B0258 - legacy mode connectivity issues03h,27apr05,rb  Updated routines with APIGEN tags03g,22apr05,rb  Changed to new authCallback.03f,29mar05,rb  Fix for bug B0169: Michael failure causes exception03e,09mar05,rb  Re-fix bug communicating between TKIP and AES stations03d,09mar05,rb  Changes to reduce the number of unnecessary stations added to                 the KSL03c,08mar05,rb  Fix for B0043: DTIM queue not flushed03b,08mar05,rb  Demoted log messages03a,03mar05,rb  Security code review changes02z,21feb05,rb  Fix vxWorks 6.1 compile errors02y,11feb05,rb  Fixed NULL pointer in ERP IE generation02x,04feb05,rb  Added B/G compatibility mode02w,01feb05,rb  Fix bug B0031 - Stations using power managment cannot connect                 to RSN AP02v,27jan05,rb  Enforce 802.11i rules on SKA (not allowed)02u,26jan05,rb  Fix for  SPR 105676 - Wireless Driver AP does not support SKA02t,25jan05,rb  Made security component optionally buildable02s,10jan05,rb  Moved WIOCSAUTHCALLBACK to dot11SmeLib.c02r,05jan05,rb  Fix for SPR 103854 - Need to update reference in TXD to use                 MBlks02q,04jan05,rb  Adding RSN 802.1X Support, WIOCSPMK call02p,20dec04,rb  Improved TSN Handling02o,04nov04,rb  Added RSN/WPA IE Processing02n,29oct04,rb  Fix for SPR 101332: AP looses track of stations in PM mode02m,29oct04,rb  Fix for SPR 102974: AP not shutting down correctly02l,25oct04,rb  Fix for SPR 102852: Incorrect handling of reassoc02k,07oct04,rb  Fixes for SPR 102354: Station under PM cannot ping and SPR                 101332: AP looses track of # stations under PM02j,07oct04,rb  Fix for SPR 102322: Random AP cluster overwrites02i,01oct04,rb  Changes from code review02h,24sep04,rb  Added dot11SmeApAclShow()02g,22sep04,rb  Fix for problems associating with adv security on02f,21sep04,rb  Fix for SPR 101931 - AP Drops blasterUDP for 3 min intervals02e,20sep04,rb  Fix for SPR 101906 - WIOCSADVSECURITY not implemented02d,20sep04,rb  Added WIOCSADVSECURITY feature02c,02sep04,rb  Implemented WIOCSTXRATE - SPR 10146702b,30aug04,eja  Add support for WIOCGBEACONRATE02a,23aug04,rb  Wind River Wireless Ethernet Driver 2.0 FCS*//*DESCRIPTIONThis module implements the SME module for Access Point mode.Access Point mode does not have a specific state machine associated with it,since each connected station must maintain its own state.  There is one KSLentry for each attached station - the state information is kept there.  Thereis also an 802.11 Data Frame reception hook is this module, to ensure thatthe KSL entry for the sending station is checked for authentication andassociation.SEE ALSOWind Net 802.11 Station 2.0 High Level Design Document*/#include <vxWorks.h>#include <muxLib.h>#include <stdio.h>#include <drv/wlan/dot11Lib.h>#include <drv/wlan/dot11SmeLib.h>#include <drv/wlan/dot11SmeApLib.h>#include <drv/wlan/dot11TimerLib.h>#include <endLib.h>#include <end.h>#include <tickLib.h>/* Local prototypes */LOCAL STATUS dot11SmeApShow(DOT11_FW * pDot11);LOCAL STATUS dot11SmeApFree(DOT11_FW * pDot11);LOCAL STATUS dot11SmeApReset(DOT11_FW * pDot11);LOCAL STATUS dot11SmeApRxMapInit(DOT11_FW * pDot11);LOCAL int dot11SmeApIoctl(DOT11_FW * pDot11, unsigned int cmd, caddr_t data);LOCAL STATUS dot11SmeApBeaconStart(DOT11_FW * pDot11, int lastBeacon);LOCAL STATUS dot11SmeApBeaconStop(DOT11_FW * pDot11);LOCAL STATUS dot11SmeApBeaconUpdate(DOT11_FW * pDot11, DOT11_BSS * pBss);LOCAL STATUS dot11SmeApBeaconFree(DOT11_FW * pDot11);LOCAL DOT11_KSL_ENTRY * dot11SmeApKslUpdate(DOT11_FW * pDot11,                                             UINT8 * pDstAddr,                                             DOT11_BSS * pBss);LOCAL STATUS dot11SmeApRawSend(DOT11_FW * pDot11, M_BLK_ID pMBlk, int rate,                               int keyIndex);LOCAL STATUS dot11SmeApDataReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                       UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApProbeReqReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                         UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApAuthReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                        UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApDeauthReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                        UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApAssocReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                         UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApDisassocReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                        UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApReassocReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                         UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApNullDataReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                         UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApPsPollReceive(DOT11_FW * pDot11, M_BLK_ID pMblk,                                       UINT32 rate, UINT8 ssi);LOCAL STATUS dot11SmeApProbeRespSend(DOT11_FW *, UINT8 * macAddr,                                      DOT11_BSS * pBss);LOCAL INT32 dot11SmeApBeaconCreate(DOT11_FW * pDot11, UINT8 * pPacket,                                    UINT16 frameType, DOT11_BSS * pBss);LOCAL UINT16 dot11SmeApAidGet(DOT11_FW * pDot11);LOCAL STATUS dot11SmeApTivbChange(DOT11_FW * pDot11, int aid, BOOL set,                                   DOT11_BSS * pBss);LOCAL INT32 dot11SmeApPmFlush(DOT11_FW * pDot11, DOT11_KSL_ENTRY * pKsl,                              BOOL flush);LOCAL STATUS dot11SmeApDisassocSend(DOT11_FW * pDot11, UINT8 * pDstAddr,                                    UINT16 reason, DOT11_BSS * pBss);LOCAL STATUS dot11SmeApReassocRspSend(DOT11_FW * pDot11, UINT8 * pDstMacAddr,                                      DOT11_CAPABILITIES * pCap,UINT16 status,                                      UINT16 aid, DOT11_RATES * pRates,                                       DOT11_BSS * pBss);LOCAL STATUS dot11SmeAp11gParamRecalc(DOT11_FW * pDot11, DOT11_BSS * pBss);LOCAL BOOL dot11SmeApPmActive(DOT11_FW * pDot11);const char * dot11ACLName[] = {"DISABLED", "ALLOW", "DENY"};IMPORT const char * DOT11_IFNAME;/***************************************************************************** dot11SmeApInit - Initialize the SME structure for an AP** This routine initializes the device to operate as a station in AP mode.** RETURNS: OK or ERROR** ERRNO: N/A** \NOMANUAL**/STATUS dot11SmeApInit    (    DOT11_FW *  pDot11           /* Pointer to device structure */    )    {    DOT11_AP_OBJ * pAp;    int i;    int oldBss;    /* Ensure than the necessary conditions are met for starting AP mode */    if ((pDot11->desiredSsid[0] == 0x00) ||         (pDot11->desiredSsid[0] == DOT11_SSID_NONE) ||         (pDot11->defaultChannel == 0) ||         (pDot11->radioMode == DOT11_RADIO_NONE))        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeApInit: Must have SSID specified to start AP\n",                   0,0,0,0,0,0));        return ERROR;        }    if (pDot11->countryCode == DOT11_COUNTRY_NONE)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeApInit: An AP must have a country specified\n",                   0,0,0,0,0,0));        return ERROR;        }    DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME,              ("dot11SmeApInit: Called.  SSID = \"%s\" Default channel = "               "(%d, %s) Country Code = %d\n",                (int)pDot11->desiredSsid, pDot11->defaultChannel,                (int)dot11ModeStr[pDot11->radioMode],               (int)pDot11->countryCode, 0, 0));    /* Get the pointer to the DOT11_AP_OBJ structure for simple access */    pAp = &pDot11->sme->type.ap;    /* Clean out the KSL - old entries are not going to do us any good here */    if (pDot11->sme->ksl.flush(pDot11) != OK)        {        DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                  ("dot11SmeApInit: Cannot flush KSL\n",                   0,0,0,0,0,0));        }          /* Place the free routine for this module where the SME generic calls can    find it */    pDot11->sme->reset = dot11SmeApReset;    pDot11->sme->modeFree = dot11SmeApFree;    pDot11->sme->modeShow = dot11SmeApShow;    pDot11->sme->beaconUpdate = dot11SmeApBeaconUpdate;    pDot11->sme->linkEventNotify = NULL;    /* Hook in our own trap so that we can free PM info on disassociation.    This command will be reset in the sme mode stop routine. */    pDot11->sme->disassocSend = dot11SmeApDisassocSend;    /* Hook up an AP-specific IOCTL handler function */    pDot11->sme->smeSpecificIoctl = dot11SmeApIoctl;    /* Initialize all BSSs with default parameters */    for (i=0; i < DOT11_BSS_MAX; i++)        {        /* Initialize the ERP information, based on the wireless mode */        if ((pDot11->hdd->curMode & DOT11_RADIO_11g) != 0)            {            pDot11->sme->bss[i].nonErpPresent = FALSE;            pDot11->sme->bss[i].useProtection = FALSE;            pDot11->sme->bss[i].useShortTimeslot = TRUE;            pDot11->sme->bss[i].useLongPreamble = FALSE;            }        /* A count of the number of stations in power management */        pDot11->sme->bss[i].tivbStart = 0;        pDot11->sme->bss[i].tivbStop = 1;        pDot11->sme->bss[i].dtimCount = 0;        /* Erase the TIVB in case there was a previous instance of AP */        bzero((char *)pDot11->sme->bss[i].tivb, DOT11_MAX_PVB);        /* Create a mutex semaphore to guard the Traffic Indication Virtual         Bitmap */        if ((pDot11->sme->bss[i].tivbSem =              semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE)) == NULL)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeApInit: Error creating tivbSem\n",                       0,0,0,0,0,0));            return ERROR;            }                /* Choose a starting broadcast rate */        pDot11->sme->bss[i].bcastRate =             DOT11_RATE_MASK(pDot11->sme->suppRates.rates[0]);             /* Set the clBlk allocated for the beacon to NULL.  Hence, the         dot11SmeApBeaconUpdate() will know that it needs to allocate one */        pDot11->sme->bss[i].pMblkBeacon = NULL;        }    /* This only has to be done for BSS 0, since the other modes won't     overwrite the SSID of any BSS other than 0 */    bcopy(pDot11->desiredSsid, pDot11->sme->bss[0].currentSsid,           DOT11_SSID_LEN+1);    /* The same reasoning applies to the BSSID */    DOT11_ADDR_COPY((char *)pDot11->macAddr,                     (char *)pDot11->sme->bss[0].bssid);    pAp->lastAid = 0;    /* Switch to the current default channel */    if ((pDot11->defaultChannel != 0) && (pDot11->radioMode != 0))        {        if (pDot11->hdd->channelSet(pDot11, pDot11->defaultChannel,                                     pDot11->radioMode) != OK)            {            DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME,                      ("dot11SmeApInit: Invalid initial channel.  Aborting.\n",                       0,0,0,0,0,0));            for (i=0; i < DOT11_BSS_MAX; i++)                {                (void) semDelete(pDot11->sme->bss[i].tivbSem);                }            return ERROR;            }        }    /* We also need to update the supported rates */    if (pDot11->hdd->suppRatesGet(pDot11, 

⌨️ 快捷键说明

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