📄 connect.c
字号:
} else { AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); } } MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH; } } else { // 3. failed, try next BSS pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID CntlWaitStartProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { USHORT Result; if (Elem->MsgType == MT2_START_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); if (Result == MLME_SUCCESS) { // // 5G bands rules of Japan: // Ad hoc must be disabled in W53(ch52,56,60,64) channels. // if ( (pAd->CommonCfg.bIEEE80211H == 1) && ((pAd->CommonCfg.Channel==52) || (pAd->CommonCfg.Channel==56) || (pAd->CommonCfg.Channel==60) || (pAd->CommonCfg.Channel==64)) ) { pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Channel=%d, Start adhoc on W53(52,56,60,64) Channels are not accepted\n", pAd->CommonCfg.Channel)); return; } LinkUp(pAd, BSS_ADHOC); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; // Before send beacon, driver need do radar detection if ((pAd->CommonCfg.Channel > 14 ) && (pAd->CommonCfg.bIEEE80211H == 1) && RadarChannelCheck(pAd, pAd->CommonCfg.Channel)) { pAd->CommonCfg.RadarDetect.RDMode = RD_SILENCE_MODE; pAd->CommonCfg.RadarDetect.RDCount = 0;#ifdef DFS_SUPPORT BbpRadarDetectionStart(pAd);#endif // DFS_SUPPORT // } DBGPRINT(RT_DEBUG_TRACE, ("CNTL - start a new IBSS = %02x:%02x:%02x:%02x:%02x:%02x ...\n", pAd->CommonCfg.Bssid[0],pAd->CommonCfg.Bssid[1],pAd->CommonCfg.Bssid[2], pAd->CommonCfg.Bssid[3],pAd->CommonCfg.Bssid[4],pAd->CommonCfg.Bssid[5])); } else { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Start IBSS fail. BUG!!!!!\n")); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID CntlWaitAuthProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { USHORT Reason; MLME_ASSOC_REQ_STRUCT AssocReq; MLME_AUTH_REQ_STRUCT AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount);#ifdef LEAP_SUPPORT // // Cisco Leap CCKM supported Re-association. // if (LEAP_CCKM_ON(pAd) && (pAd->StaCfg.CCKMLinkUpFlag == TRUE)) { //if CCKM is turn on , that's mean Fast Reauthentication //Use CCKM Reassociation instead of normal association for Fast Roaming. MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_REASSOC_REQ, sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_REASSOC; } else#endif // LEAP_SUPPORT // { MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; } } else { // This fail may because of the AP already keep us in its MAC table without // ageing-out. The previous authentication attempt must have let it remove us. // so try Authentication again may help. For D-Link DWL-900AP+ compatibility. DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try again...\n"));#ifdef LEAP_SUPPORT //Add AuthMode "LEAP" for CCX 1.X if (pAd->StaCfg.LeapAuthMode == CISCO_AuthModeLEAP) { AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, CISCO_AuthModeLEAP); } else#endif // LEAP_SUPPORT // { if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeShared) || (pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch)) { // either Ndis802_11AuthModeShared or Ndis802_11AuthModeAutoSwitch, try shared key first AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeShared); } else { AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); } } MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID CntlWaitAuthProc2( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { USHORT Reason; MLME_ASSOC_REQ_STRUCT AssocReq; MLME_AUTH_REQ_STRUCT AuthReq; if (Elem->MsgType == MT2_AUTH_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); if (Reason == MLME_SUCCESS) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH OK\n")); AssocParmFill(pAd, &AssocReq, pAd->MlmeAux.Bssid, pAd->MlmeAux.CapabilityInfo, ASSOC_TIMEOUT, pAd->StaCfg.DefaultListenCount); MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_ASSOC_REQ, sizeof(MLME_ASSOC_REQ_STRUCT), &AssocReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_ASSOC; } else {#ifdef LEAP_SUPPORT // Process LEAP first, since it use different control variable // We don't want to affect other poven operation if (pAd->StaCfg.LeapAuthMode == CISCO_AuthModeLEAP) { // LEAP Auth not success, try next BSS DBGPRINT(RT_DEBUG_TRACE, ("CNTL - *LEAP* AUTH FAIL, give up; try next BSS\n")); DBGPRINT(RT_DEBUG_TRACE, ("Total match BSSID [=%d]\n", pAd->MlmeAux.SsidBssTab.BssNr)); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } else #endif // LEAP_SUPPORT // if ((pAd->StaCfg.AuthMode == Ndis802_11AuthModeAutoSwitch) && (pAd->MlmeAux.Alg == Ndis802_11AuthModeShared)) { DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, try OPEN system...\n")); AuthParmFill(pAd, &AuthReq, pAd->MlmeAux.Bssid, Ndis802_11AuthModeOpen); MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_MLME_AUTH_REQ, sizeof(MLME_AUTH_REQ_STRUCT), &AuthReq); pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_AUTH2; } else { // not success, try next BSS DBGPRINT(RT_DEBUG_TRACE, ("CNTL - AUTH FAIL, give up; try next BSS\n")); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; //??????? pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID CntlWaitAssocProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { USHORT Reason; if (Elem->MsgType == MT2_ASSOC_CONF) { NdisMoveMemory(&Reason, Elem->Msg, sizeof(USHORT)); if (Reason == MLME_SUCCESS) { LinkUp(pAd, BSS_INFRA); pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association successful on BSS #%ld\n",pAd->MlmeAux.BssIdx)); } else { // not success, try next BSS DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Association fails on BSS #%ld\n",pAd->MlmeAux.BssIdx)); pAd->MlmeAux.BssIdx++; IterateOnBssTab(pAd); } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID CntlWaitReassocProc( IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM *Elem) { USHORT Result; if (Elem->MsgType == MT2_REASSOC_CONF) { NdisMoveMemory(&Result, Elem->Msg, sizeof(USHORT)); if (Result == MLME_SUCCESS) { // // NDIS requires a new Link UP indication but no Link Down for RE-ASSOC // LinkUp(pAd, BSS_INFRA);#ifdef LEAP_SUPPORT if (LEAP_CCKM_ON(pAd)) { pAd->StaCfg.PortSecured = WPA_802_1X_PORT_SECURED; pAd->StaCfg.WpaState = SS_FINISH; }#endif // LEAP_SUPPORT // pAd->Mlme.CntlMachine.CurrState = CNTL_IDLE; DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition successful on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); } else { // reassoc failed, try to pick next BSS in the BSS Table DBGPRINT(RT_DEBUG_TRACE, ("CNTL - Re-assocition fails on BSS #%ld\n", pAd->MlmeAux.RoamIdx)); pAd->MlmeAux.RoamIdx++; IterateOnBssTab2(pAd); } }}/* ========================================================================== Description: IRQL = DISPATCH_LEVEL ==========================================================================*/VOID LinkUp( IN PRTMP_ADAPTER pAd, IN UCHAR BssType) { ULONG Now, Data; BOOLEAN Cancelled; //TX_STA_FIFO_STRUC NewTxRxCsr4, CurTxRxCsr4; UCHAR Value = 0, idx;// Value; MAC_TABLE_ENTRY *pEntry = NULL, *pCurrEntry; // // ASSOC - DisassocTimeoutAction // CNTL - Dis-associate successful // !!! LINK DOWN !!! // [88888] OID_802_11_SSID should have returned NDTEST_WEP_AP2(Returned: ) // // To prevent DisassocTimeoutAction to call Link down after we link up, // cancel the DisassocTimer no matter what it start or not. // RTMPCancelTimer(&pAd->MlmeAux.DisassocTimer, &Cancelled); COPY_SETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); COPY_HTSETTINGS_FROM_MLME_AUX_TO_ACTIVE_CFG(pAd); // It's quite difficult to tell if a newly added KEY is WEP or CKIP until a new BSS // is formed (either ASSOC/RE-ASSOC done or IBSS started. LinkUP should be a safe place // to examine if cipher algorithm switching is required. //rt2860b. Don't know why need this SwitchBetweenWepAndCkip(pAd); if (BssType == BSS_ADHOC) { OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON); OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON); pAd->CommonCfg.BBPCurrentBW = BW_40; AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE); AsicLockChannel(pAd, pAd->CommonCfg.Channel); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R4, &Value); Value &= (~0x18); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R4, Value); RTMP_IO_READ32(pAd, TX_BAND_CFG, &Data); Data &= 0xfffffffe; RTMP_IO_WRITE32(pAd, TX_BAND_CFG, Data); RTMP_BBP_IO_READ8_BY_REG_ID(pAd, BBP_R3, &Value); Value &= (~0x20); RTMP_BBP_IO_WRITE8_BY_REG_ID(pAd, BBP_R3, Value); if (pAd->MACVersion == 0x28600100) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -