📄 dot11smeaplib.c
字号:
&pDot11->sme->suppRates) != OK) { DOT11_LOG(DOT11_DEBUG_FATAL, DOT11_AREA_INIT, ("dot11SmeApInit: Cannot get supp rates\n", 0,0,0,0,0,0)); } /* Initialize the RX Map, so that receive packets go to our routines */ if (dot11SmeApRxMapInit(pDot11) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApInit: Error initializing RXMAP\n", 0,0,0,0,0,0)); for (i=0; i < DOT11_BSS_MAX; i++) { (void) semDelete(pDot11->sme->bss[i].tivbSem); } return ERROR; } /* The BSSID is this station's MAC address. This register does not affect multiple BSS operation, since the BSS mask is applied silently during hal reset. */ if (pDot11->hdd->bssidSet(pDot11, pDot11->sme->bss[0].bssid, 0,0) != OK) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApInit: Failed BSSID set\n", 0,0,0,0,0,0)); for (i=0; i < DOT11_BSS_MAX; i++) { (void) semDelete(pDot11->sme->bss[i].tivbSem); } return ERROR; } /* Swap out the HDD's raw send function for our wrapper routine, which will perform AP power management functions and then call the HDD's rawPacketSend() routine. */ taskLock(); pAp->origRawPacketSend = pDot11->hdd->rawPacketSend; pDot11->hdd->rawPacketSend = dot11SmeApRawSend; taskUnlock(); /* Mark the link as up */ pDot11->sme->bss[0].linkStatus = DOT11_LINK_UP; pDot11->sme->bss[0].inUse = TRUE; oldBss = pDot11->sme->curConfigBss; for (i=0; i < DOT11_BSS_MAX; i++) { pDot11->sme->curConfigBss = i; if (pDot11->sme->bss[i].inUse) { /* If we're using a passphrase, we should re-generate it, since the SSID could have changed when initializing this mode */ if ((( pDot11->sme->bss[i].authPol & DOT11_AUTHPOL_PSK) != 0) && (strlen( pDot11->sme->bss[i].rsnPassphrase) != 0) && (pDot11->sme->rsn.passphraseSet != NULL)) { if (pDot11->sme->rsn.passphraseSet(pDot11, (const char *) pDot11->sme->bss[i].rsnPassphrase) != OK) { DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME, ("dot11SmeApInit: Error setting PSK using " "passphrase \"%s\"\n", (int) pDot11->sme->bss[i].rsnPassphrase, 0, 0, 0, 0, 0)); } } /* Mark this BSS as UP */ pDot11->sme->bss[i].linkStatus = DOT11_LINK_UP; /* Recalculate the groupwise cipher */ if ((pDot11->sme->rsn.groupPolicyRecalc != NULL) && (pDot11->sme->bss[i].secPol != DOT11_SECPOL_NONE)) { pDot11->sme->bss[i].multiEncryptType = pDot11->sme->rsn.groupPolicyRecalc(pDot11, NULL, &pDot11->sme->bss[i]); } if (pDot11->sme->bss[i].secPol != DOT11_SECPOL_NONE) { pDot11->sme->bss[i].multiKeySlot = 1; } } } pDot11->sme->curConfigBss = oldBss; /* Since a beacon hasn't been allocated yet, this call will allocate a beacon and fill it in with default values. Start it. */ if ((dot11SmeApBeaconUpdate(pDot11, NULL) != OK) || (dot11SmeApBeaconStart(pDot11, 0) != OK)) { DOT11_LOG(DOT11_DEBUG_ERROR, DOT11_AREA_SME, ("dot11SmeApInit: Cannot start beacons\n", 0,0,0,0,0,0)); for (i=0; i < DOT11_BSS_MAX; i++) { (void) semDelete(pDot11->sme->bss[i].tivbSem); } return ERROR; } /* Set the RX filter to receve all relevent packets */ pDot11->hdd->rxFilterSet(pDot11, DOT11_RX_FILTER_UNI | DOT11_RX_FILTER_MULTI | DOT11_RX_FILTER_PROBE_REQ); return OK; }/***************************************************************************** dot11SmeApFree - De-initialize the SME structure for an AP** This routine de-initializes the device, releasing all memory allocated in* dot11SmeApInit(). It is typically called via dot11SmeModeStop().** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeApFree ( DOT11_FW * pDot11 /* Pointer to device structure */ ) { DOT11_AP_OBJ * pAp; STATUS status = OK; int i; DOT11_LOG(DOT11_DEBUG_INFO, DOT11_AREA_SME, ("dot11SmeApFree: Called\n", 0,0, 0, 0, 0, 0)); /* Get the pointer to the DOT11_AP_OBJ structure for simple access */ pAp = &pDot11->sme->type.ap; for (i=0; i < DOT11_BSS_MAX; i++) { (void) semDelete(pDot11->sme->bss[i].tivbSem); /* Mark the link as down, so that no packets are transmitted */ pDot11->sme->bss[i].linkStatus = DOT11_LINK_DOWN; } /* Stop beacons and free the cl-blk associated with them */ status |= dot11SmeApBeaconStop(pDot11); status |= dot11SmeApBeaconFree(pDot11); /* Restore the HDD's rawsend function */ taskLock(); pDot11->hdd->rawPacketSend = pAp->origRawPacketSend; taskUnlock(); pDot11->sme->reset = NULL; pDot11->sme->modeFree = NULL; pDot11->sme->modeShow = NULL; pDot11->sme->beaconUpdate = dot11SmeApBeaconUpdate; /* Hook up an AP-specific IOCTL handler function */ pDot11->sme->smeSpecificIoctl = NULL; /* 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, ("dot11SmeApFree: Cannot flush KSL\n", 0,0,0,0,0,0)); } return status; }/***************************************************************************** dot11SmeApShow - Show routine for AP values** This routine displays parameters that are unique to the AP module. It does* not provide a listing of the KSL entries currently associated - use * dot11KslShow() for that purpose. It also does not provide a listing of the* ACL - use dot11SmeApAclShow() for that.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeApShow ( DOT11_FW * pDot11 /* Pointer to device structure */ ) { DOT11_AP_OBJ * pAp; int i; /* Get the pointer to the DOT11_AP_OBJ structure for simple access */ pAp = &pDot11->sme->type.ap; for (i=0; i<DOT11_BSS_MAX; i++) { if (!pDot11->sme->bss[i].inUse) continue; printf(" AP%d: SSID=\"%s\" BSSID=" DOT11_MAC_ADDR_STR "\n", i, pDot11->sme->bss[i].currentSsid, DOT11_MAC_ADDR(pDot11->sme->bss[i].bssid)); if (pDot11->sme->vlanEnabled) { printf(" AP%d: VLAN ID = %d\n",i,pDot11->sme->bss[i].vlanId); } printf(" AP%d: Security Policies - %s\n", i, dot11SecPolNames[pDot11->sme->bss[i].secPol]); printf(" AP%d: Authentication Policy - %s\n", i, dot11AuthPolNames[pDot11->sme->bss[i].authPol]); printf(" AP%d: Cipher Policies - %s\n", i, dot11EncryptNames[pDot11->sme->bss[i].ciphPol]); printf(" AP%d: multiEncryptType=%s en/de/ks = %d/%d/%d\n", i, dot11EncryptNames[pDot11->sme->bss[i].multiEncryptType], pDot11->sme->bss[i].multiEncryptIndex, pDot11->sme->bss[i].multiDecryptIndex, pDot11->sme->bss[i].multiKeySlot); printf(" AP%d: Access Control Mode = %s\n", i, dot11ACLName[pDot11->sme->aclMode]); printf(" AP%d: Authentication type = %s\n",i, (pDot11->sme->bss[i].authType<4) ? (dot11AuthTypeStr[pDot11->sme->bss[i].authType]) : "ERROR"); printf(" AP%d: BI=%d DTIM=%d\n", i, pDot11->sme->beaconInterval, pDot11->sme->dtimPeriod); printf(" AP%d: RespondBcastSSID=%s showSsid=%s\n", i, pDot11->sme->bss[i].respondBcastSsid?"TRUE":"FALSE", pDot11->sme->bss[i].showSsidInBeacon?"TRUE":"FALSE"); printf(" AP%d: Power Management = %s\n", i, dot11SmeApPmActive(pDot11)?"TRUE":"FALSE"); if ((pDot11->hdd->curMode & DOT11_RADIO_11g) != 0) { printf(" AP%d: Use Protection = %s Short Time Slot = %s " "Long Preamble = %s\n", i, pDot11->sme->bss[i].useProtection?"TRUE":"FALSE", pDot11->sme->bss[i].useShortTimeslot?"TRUE":"FALSE", pDot11->sme->bss[i].useLongPreamble?"TRUE":"FALSE"); } } return OK; }/***************************************************************************** dot11SmeApRxMapInit - Initialize receive map** This routine fills in the receive map with the functions appropriate for * AP mode. Packets that are not suitable in an AP are discarded.** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeApRxMapInit ( DOT11_FW * pDot11 /* Pointer to device structure */ ) { DOT11_RX_FUNC rxMap[DOT11_RX_MAP_NUM]; /* zero out all of the non-implemented functions */ bzero((char *)rxMap, sizeof(DOT11_RX_FUNC) * DOT11_RX_MAP_NUM); rxMap[DOT11_RXMAP_ACK] = NULL; rxMap[DOT11_RXMAP_ASSOC_REQ] = dot11SmeApAssocReceive; rxMap[DOT11_RXMAP_ASSOC_RESP] = NULL; rxMap[DOT11_RXMAP_ATIM] = NULL; rxMap[DOT11_RXMAP_AUTH] = dot11SmeApAuthReceive; rxMap[DOT11_RXMAP_BEACON] = NULL; rxMap[DOT11_RXMAP_CFENDACK] = NULL; rxMap[DOT11_RXMAP_CFEND] = NULL; rxMap[DOT11_RXMAP_CF_ACK] = NULL; rxMap[DOT11_RXMAP_CF_ACK_POLL] = NULL; rxMap[DOT11_RXMAP_CF_POLL] = NULL; rxMap[DOT11_RXMAP_CTS] = NULL; rxMap[DOT11_RXMAP_DATA] = dot11SmeApDataReceive; rxMap[DOT11_RXMAP_DATA_CFACKPOLL] = NULL; rxMap[DOT11_RXMAP_DATA_CFACK] = NULL; rxMap[DOT11_RXMAP_DATA_CFPOLL] = NULL; rxMap[DOT11_RXMAP_DATA_NULL] = dot11SmeApNullDataReceive; rxMap[DOT11_RXMAP_DEAUTH] = dot11SmeApDeauthReceive; rxMap[DOT11_RXMAP_DISASSOC] = dot11SmeApDisassocReceive; rxMap[DOT11_RXMAP_PROBE_REQ] = dot11SmeApProbeReqReceive; rxMap[DOT11_RXMAP_PROBE_RESP] = NULL; rxMap[DOT11_RXMAP_PSPOLL] = dot11SmeApPsPollReceive; rxMap[DOT11_RXMAP_REASSOC_REQ] = dot11SmeApReassocReceive; rxMap[DOT11_RXMAP_REASSOC_RESP] = NULL; rxMap[DOT11_RXMAP_RTS] = NULL; return (pDot11->hdd->rxMapRegisterInit)(pDot11, rxMap); }/***************************************************************************** dot11SmeApReset - Resets the AP** This routine resets the AP by deauthenticating and disassociating all * stations in the KSL** RETURNS: OK or ERROR** ERRNO: N/A*/LOCAL STATUS dot11SmeApReset
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -