Staging: rt28x0: run sta/*.c files through Lindent
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Родитель
96b3c83dc2
Коммит
0f65bec15b
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,27 +55,35 @@
|
|||
==========================================================================
|
||||
*/
|
||||
|
||||
void AuthStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE *Sm,
|
||||
OUT STATE_MACHINE_FUNC Trans[])
|
||||
void AuthStateMachineInit(IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE * Sm, OUT STATE_MACHINE_FUNC Trans[])
|
||||
{
|
||||
StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_REQ_IDLE, AUTH_MACHINE_BASE);
|
||||
StateMachineInit(Sm, Trans, MAX_AUTH_STATE, MAX_AUTH_MSG,
|
||||
(STATE_MACHINE_FUNC) Drop, AUTH_REQ_IDLE,
|
||||
AUTH_MACHINE_BASE);
|
||||
|
||||
// the first column
|
||||
StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)MlmeAuthReqAction);
|
||||
// the first column
|
||||
StateMachineSetAction(Sm, AUTH_REQ_IDLE, MT2_MLME_AUTH_REQ,
|
||||
(STATE_MACHINE_FUNC) MlmeAuthReqAction);
|
||||
|
||||
// the second column
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq2Action);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction);
|
||||
// the second column
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_MLME_AUTH_REQ,
|
||||
(STATE_MACHINE_FUNC) InvalidStateWhenAuth);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_PEER_AUTH_EVEN,
|
||||
(STATE_MACHINE_FUNC) PeerAuthRspAtSeq2Action);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ2, MT2_AUTH_TIMEOUT,
|
||||
(STATE_MACHINE_FUNC) AuthTimeoutAction);
|
||||
|
||||
// the third column
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ, (STATE_MACHINE_FUNC)InvalidStateWhenAuth);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN, (STATE_MACHINE_FUNC)PeerAuthRspAtSeq4Action);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_AUTH_TIMEOUT, (STATE_MACHINE_FUNC)AuthTimeoutAction);
|
||||
// the third column
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_MLME_AUTH_REQ,
|
||||
(STATE_MACHINE_FUNC) InvalidStateWhenAuth);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_PEER_AUTH_EVEN,
|
||||
(STATE_MACHINE_FUNC) PeerAuthRspAtSeq4Action);
|
||||
StateMachineSetAction(Sm, AUTH_WAIT_SEQ4, MT2_AUTH_TIMEOUT,
|
||||
(STATE_MACHINE_FUNC) AuthTimeoutAction);
|
||||
|
||||
RTMPInitTimer(pAd, &pAd->MlmeAux.AuthTimer, GET_TIMER_FUNCTION(AuthTimeout), pAd, FALSE);
|
||||
RTMPInitTimer(pAd, &pAd->MlmeAux.AuthTimer,
|
||||
GET_TIMER_FUNCTION(AuthTimeout), pAd, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -87,31 +95,28 @@ void AuthStateMachineInit(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID AuthTimeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
VOID AuthTimeout(IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2, IN PVOID SystemSpecific3)
|
||||
{
|
||||
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext;
|
||||
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *) FunctionContext;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE,("AUTH - AuthTimeout\n"));
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeout\n"));
|
||||
|
||||
// Do nothing if the driver is starting halt state.
|
||||
// This might happen when timer already been fired before cancel timer with mlmehalt
|
||||
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
if (RTMP_TEST_FLAG
|
||||
(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS | fRTMP_ADAPTER_NIC_NOT_EXIST))
|
||||
return;
|
||||
|
||||
// send a de-auth to reset AP's state machine (Patch AP-Dir635)
|
||||
if (pAd->Mlme.AuthMachine.CurrState == AUTH_WAIT_SEQ2)
|
||||
Cls2errAction(pAd, pAd->MlmeAux.Bssid);
|
||||
|
||||
|
||||
MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL);
|
||||
RTMP_MLME_HANDLER(pAd);
|
||||
MlmeEnqueue(pAd, AUTH_STATE_MACHINE, MT2_AUTH_TIMEOUT, 0, NULL);
|
||||
RTMP_MLME_HANDLER(pAd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
|
@ -120,20 +125,19 @@ VOID AuthTimeout(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID MlmeAuthReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID MlmeAuthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
if (AUTH_ReqSend(pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0))
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2;
|
||||
else
|
||||
{
|
||||
if (AUTH_ReqSend
|
||||
(pAd, Elem, &pAd->MlmeAux.AuthTimer, "AUTH", 1, NULL, 0))
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ2;
|
||||
else {
|
||||
USHORT Status;
|
||||
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_INVALID_FORMAT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_INVALID_FORMAT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2,
|
||||
&Status);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -144,101 +148,130 @@ VOID MlmeAuthReqAction(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID PeerAuthRspAtSeq2Action(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID PeerAuthRspAtSeq2Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Seq, Status, RemoteStatus, Alg;
|
||||
UCHAR ChlgText[CIPHER_TEXT_LEN];
|
||||
UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8];
|
||||
UCHAR Element[2];
|
||||
HEADER_802_11 AuthHdr;
|
||||
BOOLEAN TimerCancelled;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Status2;
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Seq, Status, RemoteStatus, Alg;
|
||||
UCHAR ChlgText[CIPHER_TEXT_LEN];
|
||||
UCHAR CyperChlgText[CIPHER_TEXT_LEN + 8 + 8];
|
||||
UCHAR Element[2];
|
||||
HEADER_802_11 AuthHdr;
|
||||
BOOLEAN TimerCancelled;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Status2;
|
||||
|
||||
if (PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, (PCHAR)ChlgText))
|
||||
{
|
||||
if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n", Alg, Status));
|
||||
RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled);
|
||||
if (PeerAuthSanity
|
||||
(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status,
|
||||
(PCHAR) ChlgText)) {
|
||||
if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 2) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - Receive AUTH_RSP seq#2 to me (Alg=%d, Status=%d)\n",
|
||||
Alg, Status));
|
||||
RTMPCancelTimer(&pAd->MlmeAux.AuthTimer,
|
||||
&TimerCancelled);
|
||||
|
||||
if (Status == MLME_SUCCESS)
|
||||
{
|
||||
// Authentication Mode "LEAP" has allow for CCX 1.X
|
||||
if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen)
|
||||
{
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. shared key, need to be challenged
|
||||
Seq++;
|
||||
RemoteStatus = MLME_SUCCESS;
|
||||
if (Status == MLME_SUCCESS) {
|
||||
// Authentication Mode "LEAP" has allow for CCX 1.X
|
||||
if (pAd->MlmeAux.Alg == Ndis802_11AuthModeOpen) {
|
||||
pAd->Mlme.AuthMachine.CurrState =
|
||||
AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd,
|
||||
MLME_CNTL_STATE_MACHINE,
|
||||
MT2_AUTH_CONF, 2, &Status);
|
||||
} else {
|
||||
// 2. shared key, need to be challenged
|
||||
Seq++;
|
||||
RemoteStatus = MLME_SUCCESS;
|
||||
|
||||
// Get an unused nonpaged memory
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);
|
||||
if(NStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq2Action() allocate memory fail\n"));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status2 = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status2);
|
||||
return;
|
||||
}
|
||||
NStatus =
|
||||
MlmeAllocateMemory(pAd,
|
||||
&pOutBuffer);
|
||||
if (NStatus != NDIS_STATUS_SUCCESS) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - PeerAuthRspAtSeq2Action() allocate memory fail\n"));
|
||||
pAd->Mlme.AuthMachine.
|
||||
CurrState = AUTH_REQ_IDLE;
|
||||
Status2 = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd,
|
||||
MLME_CNTL_STATE_MACHINE,
|
||||
MT2_AUTH_CONF, 2,
|
||||
&Status2);
|
||||
return;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send AUTH request seq#3...\n"));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr2, pAd->MlmeAux.Bssid);
|
||||
AuthHdr.FC.Wep = 1;
|
||||
// Encrypt challenge text & auth information
|
||||
RTMPInitWepEngine(
|
||||
pAd,
|
||||
pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key,
|
||||
pAd->StaCfg.DefaultKeyId,
|
||||
pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].KeyLen,
|
||||
CyperChlgText);
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - Send AUTH request seq#3...\n"));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr,
|
||||
SUBTYPE_AUTH, 0, Addr2,
|
||||
pAd->MlmeAux.Bssid);
|
||||
AuthHdr.FC.Wep = 1;
|
||||
// Encrypt challenge text & auth information
|
||||
RTMPInitWepEngine(pAd,
|
||||
pAd->
|
||||
SharedKey[BSS0][pAd->
|
||||
StaCfg.
|
||||
DefaultKeyId].
|
||||
Key,
|
||||
pAd->StaCfg.
|
||||
DefaultKeyId,
|
||||
pAd->
|
||||
SharedKey[BSS0][pAd->
|
||||
StaCfg.
|
||||
DefaultKeyId].
|
||||
KeyLen,
|
||||
CyperChlgText);
|
||||
|
||||
Alg = cpu2le16(*(USHORT *)&Alg);
|
||||
Seq = cpu2le16(*(USHORT *)&Seq);
|
||||
RemoteStatus= cpu2le16(*(USHORT *)&RemoteStatus);
|
||||
Alg = cpu2le16(*(USHORT *) & Alg);
|
||||
Seq = cpu2le16(*(USHORT *) & Seq);
|
||||
RemoteStatus =
|
||||
cpu2le16(*(USHORT *) &
|
||||
RemoteStatus);
|
||||
|
||||
RTMPEncryptData(pAd, (PUCHAR) &Alg, CyperChlgText + 4, 2);
|
||||
RTMPEncryptData(pAd, (PUCHAR) &Seq, CyperChlgText + 6, 2);
|
||||
RTMPEncryptData(pAd, (PUCHAR) &RemoteStatus, CyperChlgText + 8, 2);
|
||||
RTMPEncryptData(pAd, (PUCHAR) & Alg,
|
||||
CyperChlgText + 4, 2);
|
||||
RTMPEncryptData(pAd, (PUCHAR) & Seq,
|
||||
CyperChlgText + 6, 2);
|
||||
RTMPEncryptData(pAd,
|
||||
(PUCHAR) & RemoteStatus,
|
||||
CyperChlgText + 8, 2);
|
||||
Element[0] = 16;
|
||||
Element[1] = 128;
|
||||
RTMPEncryptData(pAd, Element, CyperChlgText + 10, 2);
|
||||
RTMPEncryptData(pAd, ChlgText, CyperChlgText + 12, 128);
|
||||
RTMPEncryptData(pAd, Element,
|
||||
CyperChlgText + 10, 2);
|
||||
RTMPEncryptData(pAd, ChlgText,
|
||||
CyperChlgText + 12,
|
||||
128);
|
||||
RTMPSetICV(pAd, CyperChlgText + 140);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11), &AuthHdr,
|
||||
CIPHER_TEXT_LEN + 16, CyperChlgText,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11),
|
||||
&AuthHdr,
|
||||
CIPHER_TEXT_LEN + 16,
|
||||
CyperChlgText,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer,
|
||||
FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
|
||||
RTMPSetTimer(&pAd->MlmeAux.AuthTimer, AUTH_TIMEOUT);
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_WAIT_SEQ4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pAd->StaCfg.AuthFailReason = Status;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2);
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthSanity() sanity check fail\n"));
|
||||
}
|
||||
RTMPSetTimer(&pAd->MlmeAux.AuthTimer,
|
||||
AUTH_TIMEOUT);
|
||||
pAd->Mlme.AuthMachine.CurrState =
|
||||
AUTH_WAIT_SEQ4;
|
||||
}
|
||||
} else {
|
||||
pAd->StaCfg.AuthFailReason = Status;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2);
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE,
|
||||
MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - PeerAuthSanity() sanity check fail\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -249,36 +282,35 @@ VOID PeerAuthRspAtSeq2Action(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID PeerAuthRspAtSeq4Action(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID PeerAuthRspAtSeq4Action(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Alg, Seq, Status;
|
||||
CHAR ChlgText[CIPHER_TEXT_LEN];
|
||||
BOOLEAN TimerCancelled;
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Alg, Seq, Status;
|
||||
CHAR ChlgText[CIPHER_TEXT_LEN];
|
||||
BOOLEAN TimerCancelled;
|
||||
|
||||
if(PeerAuthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status, ChlgText))
|
||||
{
|
||||
if(MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Receive AUTH_RSP seq#4 to me\n"));
|
||||
RTMPCancelTimer(&pAd->MlmeAux.AuthTimer, &TimerCancelled);
|
||||
if (PeerAuthSanity
|
||||
(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Alg, &Seq, &Status,
|
||||
ChlgText)) {
|
||||
if (MAC_ADDR_EQUAL(pAd->MlmeAux.Bssid, Addr2) && Seq == 4) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - Receive AUTH_RSP seq#4 to me\n"));
|
||||
RTMPCancelTimer(&pAd->MlmeAux.AuthTimer,
|
||||
&TimerCancelled);
|
||||
|
||||
if (Status != MLME_SUCCESS)
|
||||
{
|
||||
pAd->StaCfg.AuthFailReason = Status;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2);
|
||||
}
|
||||
if (Status != MLME_SUCCESS) {
|
||||
pAd->StaCfg.AuthFailReason = Status;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.AuthFailSta, Addr2);
|
||||
}
|
||||
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n"));
|
||||
}
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF,
|
||||
2, &Status);
|
||||
}
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - PeerAuthRspAtSeq4Action() sanity check fail\n"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -289,47 +321,49 @@ VOID PeerAuthRspAtSeq4Action(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID MlmeDeauthReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID MlmeDeauthReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
MLME_DEAUTH_REQ_STRUCT *pInfo;
|
||||
HEADER_802_11 DeauthHdr;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Status;
|
||||
MLME_DEAUTH_REQ_STRUCT *pInfo;
|
||||
HEADER_802_11 DeauthHdr;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Status;
|
||||
|
||||
pInfo = (MLME_DEAUTH_REQ_STRUCT *)Elem->Msg;
|
||||
pInfo = (MLME_DEAUTH_REQ_STRUCT *) Elem->Msg;
|
||||
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - MlmeDeauthReqAction() allocate memory fail\n"));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status);
|
||||
return;
|
||||
}
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if (NStatus != NDIS_STATUS_SUCCESS) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - MlmeDeauthReqAction() allocate memory fail\n"));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2,
|
||||
&Status);
|
||||
return;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Send DE-AUTH request (Reason=%d)...\n", pInfo->Reason));
|
||||
MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr, pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11),&DeauthHdr,
|
||||
2, &pInfo->Reason,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - Send DE-AUTH request (Reason=%d)...\n",
|
||||
pInfo->Reason));
|
||||
MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pInfo->Addr,
|
||||
pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11),
|
||||
&DeauthHdr, 2, &pInfo->Reason, END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
|
||||
pAd->StaCfg.DeauthReason = pInfo->Reason;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pInfo->Addr);
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_SUCCESS;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status);
|
||||
pAd->StaCfg.DeauthReason = pInfo->Reason;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pInfo->Addr);
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_SUCCESS;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_DEAUTH_CONF, 2, &Status);
|
||||
|
||||
// send wireless event - for deauthentication
|
||||
if (pAd->CommonCfg.bWirelessEvent)
|
||||
RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
|
||||
RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG,
|
||||
pAd->MacTab.Content[BSSID_WCID].Addr,
|
||||
BSS0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -340,15 +374,13 @@ VOID MlmeDeauthReqAction(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID AuthTimeoutAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID AuthTimeoutAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
USHORT Status;
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n"));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_REJ_TIMEOUT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
USHORT Status;
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - AuthTimeoutAction\n"));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_REJ_TIMEOUT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -359,15 +391,15 @@ VOID AuthTimeoutAction(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID InvalidStateWhenAuth(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID InvalidStateWhenAuth(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
USHORT Status;
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n", pAd->Mlme.AuthMachine.CurrState));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_STATE_MACHINE_REJECT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
USHORT Status;
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - InvalidStateWhenAuth (state=%ld), reset AUTH state machine\n",
|
||||
pAd->Mlme.AuthMachine.CurrState));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_STATE_MACHINE_REJECT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -382,109 +414,104 @@ VOID InvalidStateWhenAuth(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID Cls2errAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr)
|
||||
VOID Cls2errAction(IN PRTMP_ADAPTER pAd, IN PUCHAR pAddr)
|
||||
{
|
||||
HEADER_802_11 DeauthHdr;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Reason = REASON_CLS2ERR;
|
||||
HEADER_802_11 DeauthHdr;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
ULONG FrameLen = 0;
|
||||
USHORT Reason = REASON_CLS2ERR;
|
||||
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
return;
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
return;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("AUTH - Class 2 error, Send DEAUTH frame...\n"));
|
||||
MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr, pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11),&DeauthHdr,
|
||||
2, &Reason,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH - Class 2 error, Send DEAUTH frame...\n"));
|
||||
MgtMacHeaderInit(pAd, &DeauthHdr, SUBTYPE_DEAUTH, 0, pAddr,
|
||||
pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11),
|
||||
&DeauthHdr, 2, &Reason, END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
|
||||
pAd->StaCfg.DeauthReason = Reason;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr);
|
||||
pAd->StaCfg.DeauthReason = Reason;
|
||||
COPY_MAC_ADDR(pAd->StaCfg.DeauthSta, pAddr);
|
||||
}
|
||||
|
||||
BOOLEAN AUTH_ReqSend(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PMLME_QUEUE_ELEM pElem,
|
||||
IN PRALINK_TIMER_STRUCT pAuthTimer,
|
||||
IN PSTRING pSMName,
|
||||
IN USHORT SeqNo,
|
||||
IN PUCHAR pNewElement,
|
||||
IN ULONG ElementLen)
|
||||
BOOLEAN AUTH_ReqSend(IN PRTMP_ADAPTER pAd,
|
||||
IN PMLME_QUEUE_ELEM pElem,
|
||||
IN PRALINK_TIMER_STRUCT pAuthTimer,
|
||||
IN PSTRING pSMName,
|
||||
IN USHORT SeqNo,
|
||||
IN PUCHAR pNewElement, IN ULONG ElementLen)
|
||||
{
|
||||
USHORT Alg, Seq, Status;
|
||||
UCHAR Addr[6];
|
||||
ULONG Timeout;
|
||||
HEADER_802_11 AuthHdr;
|
||||
BOOLEAN TimerCancelled;
|
||||
NDIS_STATUS NStatus;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
ULONG FrameLen = 0, tmp = 0;
|
||||
USHORT Alg, Seq, Status;
|
||||
UCHAR Addr[6];
|
||||
ULONG Timeout;
|
||||
HEADER_802_11 AuthHdr;
|
||||
BOOLEAN TimerCancelled;
|
||||
NDIS_STATUS NStatus;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
ULONG FrameLen = 0, tmp = 0;
|
||||
|
||||
// Block all authentication request durning WPA block period
|
||||
if (pAd->StaCfg.bBlockAssoc == TRUE)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s - Block Auth request durning WPA block period!\n", pSMName));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_STATE_MACHINE_REJECT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
}
|
||||
else if(MlmeAuthReqSanity(pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg))
|
||||
{
|
||||
/* reset timer */
|
||||
if (pAd->StaCfg.bBlockAssoc == TRUE) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("%s - Block Auth request durning WPA block period!\n",
|
||||
pSMName));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_STATE_MACHINE_REJECT;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2,
|
||||
&Status);
|
||||
} else
|
||||
if (MlmeAuthReqSanity
|
||||
(pAd, pElem->Msg, pElem->MsgLen, Addr, &Timeout, &Alg)) {
|
||||
/* reset timer */
|
||||
RTMPCancelTimer(pAuthTimer, &TimerCancelled);
|
||||
|
||||
COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr);
|
||||
pAd->MlmeAux.Alg = Alg;
|
||||
Seq = SeqNo;
|
||||
Status = MLME_SUCCESS;
|
||||
COPY_MAC_ADDR(pAd->MlmeAux.Bssid, Addr);
|
||||
pAd->MlmeAux.Alg = Alg;
|
||||
Seq = SeqNo;
|
||||
Status = MLME_SUCCESS;
|
||||
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if(NStatus != NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n", pSMName, Alg));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF, 2, &Status);
|
||||
return FALSE;
|
||||
}
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
|
||||
if (NStatus != NDIS_STATUS_SUCCESS) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("%s - MlmeAuthReqAction(Alg:%d) allocate memory failed\n",
|
||||
pSMName, Alg));
|
||||
pAd->Mlme.AuthMachine.CurrState = AUTH_REQ_IDLE;
|
||||
Status = MLME_FAIL_NO_RESOURCE;
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_AUTH_CONF,
|
||||
2, &Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName, Alg));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr, pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11),&AuthHdr,
|
||||
2, &Alg,
|
||||
2, &Seq,
|
||||
2, &Status,
|
||||
END_OF_ARGS);
|
||||
|
||||
if (pNewElement && ElementLen)
|
||||
{
|
||||
MakeOutgoingFrame(pOutBuffer+FrameLen, &tmp,
|
||||
ElementLen, pNewElement,
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("%s - Send AUTH request seq#1 (Alg=%d)...\n", pSMName,
|
||||
Alg));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, Addr,
|
||||
pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11),
|
||||
&AuthHdr, 2, &Alg, 2, &Seq, 2, &Status,
|
||||
END_OF_ARGS);
|
||||
|
||||
if (pNewElement && ElementLen) {
|
||||
MakeOutgoingFrame(pOutBuffer + FrameLen, &tmp,
|
||||
ElementLen, pNewElement, END_OF_ARGS);
|
||||
FrameLen += tmp;
|
||||
}
|
||||
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
|
||||
RTMPSetTimer(pAuthTimer, Timeout);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n", pSMName));
|
||||
} else {
|
||||
DBGPRINT_ERR(("%s - MlmeAuthReqAction() sanity check failed\n",
|
||||
pSMName));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -47,18 +47,21 @@
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID AuthRspStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PSTATE_MACHINE Sm,
|
||||
IN STATE_MACHINE_FUNC Trans[])
|
||||
VOID AuthRspStateMachineInit(IN PRTMP_ADAPTER pAd,
|
||||
IN PSTATE_MACHINE Sm,
|
||||
IN STATE_MACHINE_FUNC Trans[])
|
||||
{
|
||||
StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG, (STATE_MACHINE_FUNC)Drop, AUTH_RSP_IDLE, AUTH_RSP_MACHINE_BASE);
|
||||
StateMachineInit(Sm, Trans, MAX_AUTH_RSP_STATE, MAX_AUTH_RSP_MSG,
|
||||
(STATE_MACHINE_FUNC) Drop, AUTH_RSP_IDLE,
|
||||
AUTH_RSP_MACHINE_BASE);
|
||||
|
||||
// column 1
|
||||
StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction);
|
||||
// column 1
|
||||
StateMachineSetAction(Sm, AUTH_RSP_IDLE, MT2_PEER_DEAUTH,
|
||||
(STATE_MACHINE_FUNC) PeerDeauthAction);
|
||||
|
||||
// column 2
|
||||
StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH, (STATE_MACHINE_FUNC)PeerDeauthAction);
|
||||
// column 2
|
||||
StateMachineSetAction(Sm, AUTH_RSP_WAIT_CHAL, MT2_PEER_DEAUTH,
|
||||
(STATE_MACHINE_FUNC) PeerDeauthAction);
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,39 +73,32 @@ VOID AuthRspStateMachineInit(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID PeerAuthSimpleRspGenAndSend(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PHEADER_802_11 pHdr80211,
|
||||
IN USHORT Alg,
|
||||
IN USHORT Seq,
|
||||
IN USHORT Reason,
|
||||
IN USHORT Status)
|
||||
VOID PeerAuthSimpleRspGenAndSend(IN PRTMP_ADAPTER pAd,
|
||||
IN PHEADER_802_11 pHdr80211,
|
||||
IN USHORT Alg,
|
||||
IN USHORT Seq,
|
||||
IN USHORT Reason, IN USHORT Status)
|
||||
{
|
||||
HEADER_802_11 AuthHdr;
|
||||
ULONG FrameLen = 0;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
|
||||
if (Reason != MLME_SUCCESS)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n"));
|
||||
return;
|
||||
}
|
||||
HEADER_802_11 AuthHdr;
|
||||
ULONG FrameLen = 0;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
NDIS_STATUS NStatus;
|
||||
|
||||
if (Reason != MLME_SUCCESS) {
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Peer AUTH fail...\n"));
|
||||
return;
|
||||
}
|
||||
//Get an unused nonpaged memory
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
return;
|
||||
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer);
|
||||
if (NStatus != NDIS_STATUS_SUCCESS)
|
||||
return;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n"));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2, pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
sizeof(HEADER_802_11), &AuthHdr,
|
||||
2, &Alg,
|
||||
2, &Seq,
|
||||
2, &Reason,
|
||||
END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("Send AUTH response (seq#2)...\n"));
|
||||
MgtMacHeaderInit(pAd, &AuthHdr, SUBTYPE_AUTH, 0, pHdr80211->Addr2,
|
||||
pAd->MlmeAux.Bssid);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen, sizeof(HEADER_802_11),
|
||||
&AuthHdr, 2, &Alg, 2, &Seq, 2, &Reason, END_OF_ARGS);
|
||||
MiniportMMRequest(pAd, 0, pOutBuffer, FrameLen);
|
||||
MlmeFreeMemory(pAd, pOutBuffer);
|
||||
}
|
||||
|
||||
|
@ -114,35 +110,33 @@ VOID PeerAuthSimpleRspGenAndSend(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
VOID PeerDeauthAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PMLME_QUEUE_ELEM Elem)
|
||||
VOID PeerDeauthAction(IN PRTMP_ADAPTER pAd, IN PMLME_QUEUE_ELEM Elem)
|
||||
{
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Reason;
|
||||
UCHAR Addr2[MAC_ADDR_LEN];
|
||||
USHORT Reason;
|
||||
|
||||
if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason))
|
||||
{
|
||||
if (INFRA_ON(pAd)
|
||||
&& MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid)
|
||||
)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n", Reason));
|
||||
|
||||
|
||||
RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0);
|
||||
if (PeerDeauthSanity(pAd, Elem->Msg, Elem->MsgLen, Addr2, &Reason)) {
|
||||
if (INFRA_ON(pAd)
|
||||
&& MAC_ADDR_EQUAL(Addr2, pAd->CommonCfg.Bssid)
|
||||
) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH_RSP - receive DE-AUTH from our AP (Reason=%d)\n",
|
||||
Reason));
|
||||
|
||||
RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL,
|
||||
0);
|
||||
|
||||
// send wireless event - for deauthentication
|
||||
if (pAd->CommonCfg.bWirelessEvent)
|
||||
RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
|
||||
RTMPSendWirelessEvent(pAd, IW_DEAUTH_EVENT_FLAG,
|
||||
pAd->MacTab.
|
||||
Content[BSSID_WCID].Addr,
|
||||
BSS0, 0);
|
||||
|
||||
LinkDown(pAd, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE,("AUTH_RSP - PeerDeauthAction() sanity check fail\n"));
|
||||
}
|
||||
LinkDown(pAd, TRUE);
|
||||
}
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("AUTH_RSP - PeerDeauthAction() sanity check fail\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -36,15 +36,15 @@
|
|||
*/
|
||||
#include "../rt_config.h"
|
||||
|
||||
extern UCHAR CISCO_OUI[];
|
||||
extern UCHAR CISCO_OUI[];
|
||||
|
||||
extern UCHAR WPA_OUI[];
|
||||
extern UCHAR RSN_OUI[];
|
||||
extern UCHAR WME_INFO_ELEM[];
|
||||
extern UCHAR WME_PARM_ELEM[];
|
||||
extern UCHAR Ccx2QosInfo[];
|
||||
extern UCHAR RALINK_OUI[];
|
||||
extern UCHAR BROADCOM_OUI[];
|
||||
extern UCHAR WPA_OUI[];
|
||||
extern UCHAR RSN_OUI[];
|
||||
extern UCHAR WME_INFO_ELEM[];
|
||||
extern UCHAR WME_PARM_ELEM[];
|
||||
extern UCHAR Ccx2QosInfo[];
|
||||
extern UCHAR RALINK_OUI[];
|
||||
extern UCHAR BROADCOM_OUI[];
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
|
@ -54,27 +54,25 @@ extern UCHAR BROADCOM_OUI[];
|
|||
TRUE if all parameters are OK, FALSE otherwise
|
||||
==========================================================================
|
||||
*/
|
||||
BOOLEAN MlmeStartReqSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT CHAR Ssid[],
|
||||
OUT UCHAR *pSsidLen)
|
||||
BOOLEAN MlmeStartReqSanity(IN PRTMP_ADAPTER pAd,
|
||||
IN VOID * Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT CHAR Ssid[], OUT UCHAR * pSsidLen)
|
||||
{
|
||||
MLME_START_REQ_STRUCT *Info;
|
||||
MLME_START_REQ_STRUCT *Info;
|
||||
|
||||
Info = (MLME_START_REQ_STRUCT *)(Msg);
|
||||
Info = (MLME_START_REQ_STRUCT *) (Msg);
|
||||
|
||||
if (Info->SsidLen > MAX_LEN_OF_SSID)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("MlmeStartReqSanity fail - wrong SSID length\n"));
|
||||
return FALSE;
|
||||
}
|
||||
if (Info->SsidLen > MAX_LEN_OF_SSID) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("MlmeStartReqSanity fail - wrong SSID length\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pSsidLen = Info->SsidLen;
|
||||
NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen);
|
||||
*pSsidLen = Info->SsidLen;
|
||||
NdisMoveMemory(Ssid, Info->Ssid, *pSsidLen);
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -88,171 +86,161 @@ BOOLEAN MlmeStartReqSanity(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
BOOLEAN PeerAssocRspSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *pMsg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT USHORT *pCapabilityInfo,
|
||||
OUT USHORT *pStatus,
|
||||
OUT USHORT *pAid,
|
||||
OUT UCHAR SupRate[],
|
||||
OUT UCHAR *pSupRateLen,
|
||||
OUT UCHAR ExtRate[],
|
||||
OUT UCHAR *pExtRateLen,
|
||||
OUT HT_CAPABILITY_IE *pHtCapability,
|
||||
OUT ADD_HT_INFO_IE *pAddHtInfo, // AP might use this additional ht info IE
|
||||
OUT UCHAR *pHtCapabilityLen,
|
||||
OUT UCHAR *pAddHtInfoLen,
|
||||
OUT UCHAR *pNewExtChannelOffset,
|
||||
OUT PEDCA_PARM pEdcaParm,
|
||||
OUT UCHAR *pCkipFlag)
|
||||
BOOLEAN PeerAssocRspSanity(IN PRTMP_ADAPTER pAd, IN VOID * pMsg, IN ULONG MsgLen, OUT PUCHAR pAddr2, OUT USHORT * pCapabilityInfo, OUT USHORT * pStatus, OUT USHORT * pAid, OUT UCHAR SupRate[], OUT UCHAR * pSupRateLen, OUT UCHAR ExtRate[], OUT UCHAR * pExtRateLen, OUT HT_CAPABILITY_IE * pHtCapability, OUT ADD_HT_INFO_IE * pAddHtInfo, // AP might use this additional ht info IE
|
||||
OUT UCHAR * pHtCapabilityLen,
|
||||
OUT UCHAR * pAddHtInfoLen,
|
||||
OUT UCHAR * pNewExtChannelOffset,
|
||||
OUT PEDCA_PARM pEdcaParm, OUT UCHAR * pCkipFlag)
|
||||
{
|
||||
CHAR IeType, *Ptr;
|
||||
PFRAME_802_11 pFrame = (PFRAME_802_11)pMsg;
|
||||
PEID_STRUCT pEid;
|
||||
ULONG Length = 0;
|
||||
CHAR IeType, *Ptr;
|
||||
PFRAME_802_11 pFrame = (PFRAME_802_11) pMsg;
|
||||
PEID_STRUCT pEid;
|
||||
ULONG Length = 0;
|
||||
|
||||
*pNewExtChannelOffset = 0xff;
|
||||
*pHtCapabilityLen = 0;
|
||||
*pAddHtInfoLen = 0;
|
||||
COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2);
|
||||
Ptr = (PCHAR)pFrame->Octet;
|
||||
Length += LENGTH_802_11;
|
||||
COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2);
|
||||
Ptr = (PCHAR) pFrame->Octet;
|
||||
Length += LENGTH_802_11;
|
||||
|
||||
NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2);
|
||||
Length += 2;
|
||||
NdisMoveMemory(pStatus, &pFrame->Octet[2], 2);
|
||||
Length += 2;
|
||||
*pCkipFlag = 0;
|
||||
*pExtRateLen = 0;
|
||||
pEdcaParm->bValid = FALSE;
|
||||
NdisMoveMemory(pCapabilityInfo, &pFrame->Octet[0], 2);
|
||||
Length += 2;
|
||||
NdisMoveMemory(pStatus, &pFrame->Octet[2], 2);
|
||||
Length += 2;
|
||||
*pCkipFlag = 0;
|
||||
*pExtRateLen = 0;
|
||||
pEdcaParm->bValid = FALSE;
|
||||
|
||||
if (*pStatus != MLME_SUCCESS)
|
||||
return TRUE;
|
||||
if (*pStatus != MLME_SUCCESS)
|
||||
return TRUE;
|
||||
|
||||
NdisMoveMemory(pAid, &pFrame->Octet[4], 2);
|
||||
Length += 2;
|
||||
NdisMoveMemory(pAid, &pFrame->Octet[4], 2);
|
||||
Length += 2;
|
||||
|
||||
// Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform
|
||||
*pAid = (*pAid) & 0x3fff; // AID is low 14-bit
|
||||
// Aid already swaped byte order in RTMPFrameEndianChange() for big endian platform
|
||||
*pAid = (*pAid) & 0x3fff; // AID is low 14-bit
|
||||
|
||||
// -- get supported rates from payload and advance the pointer
|
||||
IeType = pFrame->Octet[6];
|
||||
*pSupRateLen = pFrame->Octet[7];
|
||||
if ((IeType != IE_SUPP_RATES) || (*pSupRateLen > MAX_LEN_OF_SUPPORTED_RATES))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity fail - wrong SupportedRates IE\n"));
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
NdisMoveMemory(SupRate, &pFrame->Octet[8], *pSupRateLen);
|
||||
// -- get supported rates from payload and advance the pointer
|
||||
IeType = pFrame->Octet[6];
|
||||
*pSupRateLen = pFrame->Octet[7];
|
||||
if ((IeType != IE_SUPP_RATES)
|
||||
|| (*pSupRateLen > MAX_LEN_OF_SUPPORTED_RATES)) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("PeerAssocRspSanity fail - wrong SupportedRates IE\n"));
|
||||
return FALSE;
|
||||
} else
|
||||
NdisMoveMemory(SupRate, &pFrame->Octet[8], *pSupRateLen);
|
||||
|
||||
Length = Length + 2 + *pSupRateLen;
|
||||
Length = Length + 2 + *pSupRateLen;
|
||||
|
||||
// many AP implement proprietary IEs in non-standard order, we'd better
|
||||
// tolerate mis-ordered IEs to get best compatibility
|
||||
pEid = (PEID_STRUCT) &pFrame->Octet[8 + (*pSupRateLen)];
|
||||
// many AP implement proprietary IEs in non-standard order, we'd better
|
||||
// tolerate mis-ordered IEs to get best compatibility
|
||||
pEid = (PEID_STRUCT) & pFrame->Octet[8 + (*pSupRateLen)];
|
||||
|
||||
// get variable fields from payload and advance the pointer
|
||||
while ((Length + 2 + pEid->Len) <= MsgLen)
|
||||
{
|
||||
switch (pEid->Eid)
|
||||
{
|
||||
case IE_EXT_SUPP_RATES:
|
||||
if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES)
|
||||
{
|
||||
NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len);
|
||||
*pExtRateLen = pEid->Len;
|
||||
}
|
||||
break;
|
||||
// get variable fields from payload and advance the pointer
|
||||
while ((Length + 2 + pEid->Len) <= MsgLen) {
|
||||
switch (pEid->Eid) {
|
||||
case IE_EXT_SUPP_RATES:
|
||||
if (pEid->Len <= MAX_LEN_OF_SUPPORTED_RATES) {
|
||||
NdisMoveMemory(ExtRate, pEid->Octet, pEid->Len);
|
||||
*pExtRateLen = pEid->Len;
|
||||
}
|
||||
break;
|
||||
|
||||
case IE_HT_CAP:
|
||||
case IE_HT_CAP2:
|
||||
if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!!
|
||||
case IE_HT_CAP:
|
||||
case IE_HT_CAP2:
|
||||
if (pEid->Len >= SIZE_HT_CAP_IE) //Note: allow extension.!!
|
||||
{
|
||||
NdisMoveMemory(pHtCapability, pEid->Octet, SIZE_HT_CAP_IE);
|
||||
NdisMoveMemory(pHtCapability, pEid->Octet,
|
||||
SIZE_HT_CAP_IE);
|
||||
|
||||
*(USHORT *)(&pHtCapability->HtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->HtCapInfo));
|
||||
*(USHORT *)(&pHtCapability->ExtHtCapInfo) = cpu2le16(*(USHORT *)(&pHtCapability->ExtHtCapInfo));
|
||||
*(USHORT *) (&pHtCapability->HtCapInfo) =
|
||||
cpu2le16(*(USHORT *)
|
||||
(&pHtCapability->HtCapInfo));
|
||||
*(USHORT *) (&pHtCapability->ExtHtCapInfo) =
|
||||
cpu2le16(*(USHORT *)
|
||||
(&pHtCapability->ExtHtCapInfo));
|
||||
|
||||
*pHtCapabilityLen = SIZE_HT_CAP_IE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_HT_CAP. \n"));
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_WARN,
|
||||
("PeerAssocRspSanity - wrong IE_HT_CAP. \n"));
|
||||
}
|
||||
|
||||
break;
|
||||
case IE_ADD_HT:
|
||||
case IE_ADD_HT2:
|
||||
if (pEid->Len >= sizeof(ADD_HT_INFO_IE))
|
||||
{
|
||||
break;
|
||||
case IE_ADD_HT:
|
||||
case IE_ADD_HT2:
|
||||
if (pEid->Len >= sizeof(ADD_HT_INFO_IE)) {
|
||||
// This IE allows extension, but we can ignore extra bytes beyond our knowledge , so only
|
||||
// copy first sizeof(ADD_HT_INFO_IE)
|
||||
NdisMoveMemory(pAddHtInfo, pEid->Octet, sizeof(ADD_HT_INFO_IE));
|
||||
NdisMoveMemory(pAddHtInfo, pEid->Octet,
|
||||
sizeof(ADD_HT_INFO_IE));
|
||||
|
||||
*(USHORT *)(&pAddHtInfo->AddHtInfo2) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo2));
|
||||
*(USHORT *)(&pAddHtInfo->AddHtInfo3) = cpu2le16(*(USHORT *)(&pAddHtInfo->AddHtInfo3));
|
||||
*(USHORT *) (&pAddHtInfo->AddHtInfo2) =
|
||||
cpu2le16(*(USHORT *)
|
||||
(&pAddHtInfo->AddHtInfo2));
|
||||
*(USHORT *) (&pAddHtInfo->AddHtInfo3) =
|
||||
cpu2le16(*(USHORT *)
|
||||
(&pAddHtInfo->AddHtInfo3));
|
||||
|
||||
*pAddHtInfoLen = SIZE_ADD_HT_INFO_IE;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_ADD_HT. \n"));
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_WARN,
|
||||
("PeerAssocRspSanity - wrong IE_ADD_HT. \n"));
|
||||
}
|
||||
|
||||
break;
|
||||
case IE_SECONDARY_CH_OFFSET:
|
||||
if (pEid->Len == 1)
|
||||
{
|
||||
break;
|
||||
case IE_SECONDARY_CH_OFFSET:
|
||||
if (pEid->Len == 1) {
|
||||
*pNewExtChannelOffset = pEid->Octet[0];
|
||||
} else {
|
||||
DBGPRINT(RT_DEBUG_WARN,
|
||||
("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_WARN, ("PeerAssocRspSanity - wrong IE_SECONDARY_CH_OFFSET. \n"));
|
||||
break;
|
||||
|
||||
case IE_VENDOR_SPECIFIC:
|
||||
// handle WME PARAMTER ELEMENT
|
||||
if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6)
|
||||
&& (pEid->Len == 24)) {
|
||||
PUCHAR ptr;
|
||||
int i;
|
||||
|
||||
// parsing EDCA parameters
|
||||
pEdcaParm->bValid = TRUE;
|
||||
pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10;
|
||||
pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20;
|
||||
pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40;
|
||||
//pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80;
|
||||
pEdcaParm->EdcaUpdateCount =
|
||||
pEid->Octet[6] & 0x0f;
|
||||
pEdcaParm->bAPSDCapable =
|
||||
(pEid->Octet[6] & 0x80) ? 1 : 0;
|
||||
ptr = (PUCHAR) & pEid->Octet[8];
|
||||
for (i = 0; i < 4; i++) {
|
||||
UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX
|
||||
pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM
|
||||
pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN
|
||||
pEdcaParm->Cwmin[aci] = *(ptr + 1) & 0x0f; // b0~4 is Cwmin
|
||||
pEdcaParm->Cwmax[aci] = *(ptr + 1) >> 4; // b5~8 is Cwmax
|
||||
pEdcaParm->Txop[aci] = *(ptr + 2) + 256 * (*(ptr + 3)); // in unit of 32-us
|
||||
ptr += 4; // point to next AC
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("PeerAssocRspSanity - ignore unrecognized EID = %d\n",
|
||||
pEid->Eid));
|
||||
break;
|
||||
}
|
||||
|
||||
case IE_VENDOR_SPECIFIC:
|
||||
// handle WME PARAMTER ELEMENT
|
||||
if (NdisEqualMemory(pEid->Octet, WME_PARM_ELEM, 6) && (pEid->Len == 24))
|
||||
{
|
||||
PUCHAR ptr;
|
||||
int i;
|
||||
Length = Length + 2 + pEid->Len;
|
||||
pEid = (PEID_STRUCT) ((UCHAR *) pEid + 2 + pEid->Len);
|
||||
}
|
||||
|
||||
// parsing EDCA parameters
|
||||
pEdcaParm->bValid = TRUE;
|
||||
pEdcaParm->bQAck = FALSE; // pEid->Octet[0] & 0x10;
|
||||
pEdcaParm->bQueueRequest = FALSE; // pEid->Octet[0] & 0x20;
|
||||
pEdcaParm->bTxopRequest = FALSE; // pEid->Octet[0] & 0x40;
|
||||
//pEdcaParm->bMoreDataAck = FALSE; // pEid->Octet[0] & 0x80;
|
||||
pEdcaParm->EdcaUpdateCount = pEid->Octet[6] & 0x0f;
|
||||
pEdcaParm->bAPSDCapable = (pEid->Octet[6] & 0x80) ? 1 : 0;
|
||||
ptr = (PUCHAR)&pEid->Octet[8];
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
UCHAR aci = (*ptr & 0x60) >> 5; // b5~6 is AC INDEX
|
||||
pEdcaParm->bACM[aci] = (((*ptr) & 0x10) == 0x10); // b5 is ACM
|
||||
pEdcaParm->Aifsn[aci] = (*ptr) & 0x0f; // b0~3 is AIFSN
|
||||
pEdcaParm->Cwmin[aci] = *(ptr+1) & 0x0f; // b0~4 is Cwmin
|
||||
pEdcaParm->Cwmax[aci] = *(ptr+1) >> 4; // b5~8 is Cwmax
|
||||
pEdcaParm->Txop[aci] = *(ptr+2) + 256 * (*(ptr+3)); // in unit of 32-us
|
||||
ptr += 4; // point to next AC
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("PeerAssocRspSanity - ignore unrecognized EID = %d\n", pEid->Eid));
|
||||
break;
|
||||
}
|
||||
|
||||
Length = Length + 2 + pEid->Len;
|
||||
pEid = (PEID_STRUCT)((UCHAR*)pEid + 2 + pEid->Len);
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -266,47 +254,46 @@ BOOLEAN PeerAssocRspSanity(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
BOOLEAN PeerProbeReqSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT CHAR Ssid[],
|
||||
OUT UCHAR *pSsidLen)
|
||||
BOOLEAN PeerProbeReqSanity(IN PRTMP_ADAPTER pAd,
|
||||
IN VOID * Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT CHAR Ssid[], OUT UCHAR * pSsidLen)
|
||||
{
|
||||
UCHAR Idx;
|
||||
UCHAR RateLen;
|
||||
CHAR IeType;
|
||||
PFRAME_802_11 pFrame = (PFRAME_802_11)Msg;
|
||||
UCHAR Idx;
|
||||
UCHAR RateLen;
|
||||
CHAR IeType;
|
||||
PFRAME_802_11 pFrame = (PFRAME_802_11) Msg;
|
||||
|
||||
COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2);
|
||||
COPY_MAC_ADDR(pAddr2, pFrame->Hdr.Addr2);
|
||||
|
||||
if ((pFrame->Octet[0] != IE_SSID) || (pFrame->Octet[1] > MAX_LEN_OF_SSID))
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SSID IE(Type=%d,Len=%d)\n",pFrame->Octet[0],pFrame->Octet[1]));
|
||||
return FALSE;
|
||||
}
|
||||
if ((pFrame->Octet[0] != IE_SSID)
|
||||
|| (pFrame->Octet[1] > MAX_LEN_OF_SSID)) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("PeerProbeReqSanity fail - wrong SSID IE(Type=%d,Len=%d)\n",
|
||||
pFrame->Octet[0], pFrame->Octet[1]));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*pSsidLen = pFrame->Octet[1];
|
||||
NdisMoveMemory(Ssid, &pFrame->Octet[2], *pSsidLen);
|
||||
*pSsidLen = pFrame->Octet[1];
|
||||
NdisMoveMemory(Ssid, &pFrame->Octet[2], *pSsidLen);
|
||||
|
||||
Idx = *pSsidLen + 2;
|
||||
Idx = *pSsidLen + 2;
|
||||
|
||||
// -- get supported rates from payload and advance the pointer
|
||||
IeType = pFrame->Octet[Idx];
|
||||
RateLen = pFrame->Octet[Idx + 1];
|
||||
if (IeType != IE_SUPP_RATES)
|
||||
{
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("PeerProbeReqSanity fail - wrong SupportRates IE(Type=%d,Len=%d)\n",pFrame->Octet[Idx],pFrame->Octet[Idx+1]));
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((pAd->CommonCfg.PhyMode == PHY_11G) && (RateLen < 8))
|
||||
return (FALSE);
|
||||
}
|
||||
// -- get supported rates from payload and advance the pointer
|
||||
IeType = pFrame->Octet[Idx];
|
||||
RateLen = pFrame->Octet[Idx + 1];
|
||||
if (IeType != IE_SUPP_RATES) {
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("PeerProbeReqSanity fail - wrong SupportRates IE(Type=%d,Len=%d)\n",
|
||||
pFrame->Octet[Idx], pFrame->Octet[Idx + 1]));
|
||||
return FALSE;
|
||||
} else {
|
||||
if ((pAd->CommonCfg.PhyMode == PHY_11G) && (RateLen < 8))
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -317,62 +304,58 @@ BOOLEAN PeerProbeReqSanity(
|
|||
|
||||
==========================================================================
|
||||
*/
|
||||
BOOLEAN GetTimBit(
|
||||
IN CHAR *Ptr,
|
||||
IN USHORT Aid,
|
||||
OUT UCHAR *TimLen,
|
||||
OUT UCHAR *BcastFlag,
|
||||
OUT UCHAR *DtimCount,
|
||||
OUT UCHAR *DtimPeriod,
|
||||
OUT UCHAR *MessageToMe)
|
||||
BOOLEAN GetTimBit(IN CHAR * Ptr,
|
||||
IN USHORT Aid,
|
||||
OUT UCHAR * TimLen,
|
||||
OUT UCHAR * BcastFlag,
|
||||
OUT UCHAR * DtimCount,
|
||||
OUT UCHAR * DtimPeriod, OUT UCHAR * MessageToMe)
|
||||
{
|
||||
UCHAR BitCntl, N1, N2, MyByte, MyBit;
|
||||
CHAR *IdxPtr;
|
||||
UCHAR BitCntl, N1, N2, MyByte, MyBit;
|
||||
CHAR *IdxPtr;
|
||||
|
||||
IdxPtr = Ptr;
|
||||
IdxPtr = Ptr;
|
||||
|
||||
IdxPtr ++;
|
||||
*TimLen = *IdxPtr;
|
||||
IdxPtr++;
|
||||
*TimLen = *IdxPtr;
|
||||
|
||||
// get DTIM Count from TIM element
|
||||
IdxPtr ++;
|
||||
*DtimCount = *IdxPtr;
|
||||
// get DTIM Count from TIM element
|
||||
IdxPtr++;
|
||||
*DtimCount = *IdxPtr;
|
||||
|
||||
// get DTIM Period from TIM element
|
||||
IdxPtr++;
|
||||
*DtimPeriod = *IdxPtr;
|
||||
// get DTIM Period from TIM element
|
||||
IdxPtr++;
|
||||
*DtimPeriod = *IdxPtr;
|
||||
|
||||
// get Bitmap Control from TIM element
|
||||
IdxPtr++;
|
||||
BitCntl = *IdxPtr;
|
||||
// get Bitmap Control from TIM element
|
||||
IdxPtr++;
|
||||
BitCntl = *IdxPtr;
|
||||
|
||||
if ((*DtimCount == 0) && (BitCntl & 0x01))
|
||||
*BcastFlag = TRUE;
|
||||
else
|
||||
*BcastFlag = FALSE;
|
||||
if ((*DtimCount == 0) && (BitCntl & 0x01))
|
||||
*BcastFlag = TRUE;
|
||||
else
|
||||
*BcastFlag = FALSE;
|
||||
|
||||
// Parse Partial Virtual Bitmap from TIM element
|
||||
N1 = BitCntl & 0xfe; // N1 is the first bitmap byte#
|
||||
N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte#
|
||||
// Parse Partial Virtual Bitmap from TIM element
|
||||
N1 = BitCntl & 0xfe; // N1 is the first bitmap byte#
|
||||
N2 = *TimLen - 4 + N1; // N2 is the last bitmap byte#
|
||||
|
||||
if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3)))
|
||||
*MessageToMe = FALSE;
|
||||
else
|
||||
{
|
||||
MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream
|
||||
MyBit = Aid % 16 - ((MyByte & 0x01)? 8:0);
|
||||
if ((Aid < (N1 << 3)) || (Aid >= ((N2 + 1) << 3)))
|
||||
*MessageToMe = FALSE;
|
||||
else {
|
||||
MyByte = (Aid >> 3) - N1; // my byte position in the bitmap byte-stream
|
||||
MyBit = Aid % 16 - ((MyByte & 0x01) ? 8 : 0);
|
||||
|
||||
IdxPtr += (MyByte + 1);
|
||||
IdxPtr += (MyByte + 1);
|
||||
|
||||
//if (*IdxPtr)
|
||||
// DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr));
|
||||
//if (*IdxPtr)
|
||||
// DBGPRINT(RT_DEBUG_WARN, ("TIM bitmap = 0x%02x\n", *IdxPtr));
|
||||
|
||||
if (*IdxPtr & (0x01 << MyBit))
|
||||
*MessageToMe = TRUE;
|
||||
else
|
||||
*MessageToMe = FALSE;
|
||||
}
|
||||
if (*IdxPtr & (0x01 << MyBit))
|
||||
*MessageToMe = TRUE;
|
||||
else
|
||||
*MessageToMe = FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
#include "../rt_config.h"
|
||||
|
||||
void inc_byte_array(UCHAR *counter, int len);
|
||||
void inc_byte_array(UCHAR * counter, int len);
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
@ -58,33 +58,29 @@ void inc_byte_array(UCHAR *counter, int len);
|
|||
|
||||
========================================================================
|
||||
*/
|
||||
VOID RTMPReportMicError(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PCIPHER_KEY pWpaKey)
|
||||
VOID RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey)
|
||||
{
|
||||
ULONG Now;
|
||||
UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1:0);
|
||||
ULONG Now;
|
||||
UCHAR unicastKey = (pWpaKey->Type == PAIRWISE_KEY ? 1 : 0);
|
||||
|
||||
// Record Last MIC error time and count
|
||||
NdisGetSystemUpTime(&Now);
|
||||
if (pAd->StaCfg.MicErrCnt == 0)
|
||||
{
|
||||
if (pAd->StaCfg.MicErrCnt == 0) {
|
||||
pAd->StaCfg.MicErrCnt++;
|
||||
pAd->StaCfg.LastMicErrorTime = Now;
|
||||
NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8);
|
||||
}
|
||||
else if (pAd->StaCfg.MicErrCnt == 1)
|
||||
{
|
||||
if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now)
|
||||
{
|
||||
NdisZeroMemory(pAd->StaCfg.ReplayCounter, 8);
|
||||
} else if (pAd->StaCfg.MicErrCnt == 1) {
|
||||
if ((pAd->StaCfg.LastMicErrorTime + (60 * OS_HZ)) < Now) {
|
||||
// Update Last MIC error time, this did not violate two MIC errors within 60 seconds
|
||||
pAd->StaCfg.LastMicErrorTime = Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
|
||||
if (pAd->CommonCfg.bWirelessEvent)
|
||||
RTMPSendWirelessEvent(pAd, IW_COUNTER_MEASURES_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
|
||||
RTMPSendWirelessEvent(pAd,
|
||||
IW_COUNTER_MEASURES_EVENT_FLAG,
|
||||
pAd->MacTab.
|
||||
Content[BSSID_WCID].Addr,
|
||||
BSS0, 0);
|
||||
|
||||
pAd->StaCfg.LastMicErrorTime = Now;
|
||||
// Violate MIC error counts, MIC countermeasures kicks in
|
||||
|
@ -101,154 +97,139 @@ VOID RTMPReportMicError(
|
|||
// RTMPRingCleanUp(pAd, QID_AC_VO);
|
||||
// RTMPRingCleanUp(pAd, QID_HCCA);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// MIC error count >= 2
|
||||
// This should not happen
|
||||
;
|
||||
}
|
||||
MlmeEnqueue(pAd,
|
||||
MLME_CNTL_STATE_MACHINE,
|
||||
OID_802_11_MIC_FAILURE_REPORT_FRAME,
|
||||
1,
|
||||
&unicastKey);
|
||||
MlmeEnqueue(pAd,
|
||||
MLME_CNTL_STATE_MACHINE,
|
||||
OID_802_11_MIC_FAILURE_REPORT_FRAME, 1, &unicastKey);
|
||||
|
||||
if (pAd->StaCfg.MicErrCnt == 2)
|
||||
{
|
||||
RTMPSetTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, 100);
|
||||
}
|
||||
if (pAd->StaCfg.MicErrCnt == 2) {
|
||||
RTMPSetTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, 100);
|
||||
}
|
||||
}
|
||||
|
||||
#define LENGTH_EAP_H 4
|
||||
// If the received frame is EAP-Packet ,find out its EAP-Code (Request(0x01), Response(0x02), Success(0x03), Failure(0x04)).
|
||||
INT WpaCheckEapCode(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pFrame,
|
||||
IN USHORT FrameLen,
|
||||
IN USHORT OffSet)
|
||||
INT WpaCheckEapCode(IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pFrame, IN USHORT FrameLen, IN USHORT OffSet)
|
||||
{
|
||||
|
||||
PUCHAR pData;
|
||||
INT result = 0;
|
||||
PUCHAR pData;
|
||||
INT result = 0;
|
||||
|
||||
if( FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H )
|
||||
if (FrameLen < OffSet + LENGTH_EAPOL_H + LENGTH_EAP_H)
|
||||
return result;
|
||||
|
||||
pData = pFrame + OffSet; // skip offset bytes
|
||||
pData = pFrame + OffSet; // skip offset bytes
|
||||
|
||||
if(*(pData+1) == EAPPacket) // 802.1x header - Packet Type
|
||||
if (*(pData + 1) == EAPPacket) // 802.1x header - Packet Type
|
||||
{
|
||||
result = *(pData+4); // EAP header - Code
|
||||
result = *(pData + 4); // EAP header - Code
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
VOID WpaSendMicFailureToWpaSupplicant(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN BOOLEAN bUnicast)
|
||||
VOID WpaSendMicFailureToWpaSupplicant(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUnicast)
|
||||
{
|
||||
char custom[IW_CUSTOM_MAX] = {0};
|
||||
char custom[IW_CUSTOM_MAX] = { 0 };
|
||||
|
||||
sprintf(custom, "MLME-MICHAELMICFAILURE.indication");
|
||||
if(bUnicast)
|
||||
sprintf(custom, "%s unicast", custom);
|
||||
sprintf(custom, "MLME-MICHAELMICFAILURE.indication");
|
||||
if (bUnicast)
|
||||
sprintf(custom, "%s unicast", custom);
|
||||
|
||||
RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR)custom, strlen(custom));
|
||||
RtmpOSWrielessEventSend(pAd, IWEVCUSTOM, -1, NULL, (PUCHAR) custom,
|
||||
strlen(custom));
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
VOID WpaMicFailureReportFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem)
|
||||
VOID WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
|
||||
{
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
UCHAR Header802_3[14];
|
||||
ULONG FrameLen = 0;
|
||||
EAPOL_PACKET Packet;
|
||||
UCHAR Mic[16];
|
||||
BOOLEAN bUnicast;
|
||||
PUCHAR pOutBuffer = NULL;
|
||||
UCHAR Header802_3[14];
|
||||
ULONG FrameLen = 0;
|
||||
EAPOL_PACKET Packet;
|
||||
UCHAR Mic[16];
|
||||
BOOLEAN bUnicast;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame ----->\n"));
|
||||
|
||||
bUnicast = (Elem->Msg[0] == 1 ? TRUE:FALSE);
|
||||
bUnicast = (Elem->Msg[0] == 1 ? TRUE : FALSE);
|
||||
pAd->Sequence = ((pAd->Sequence) + 1) & (MAX_SEQ_NUMBER);
|
||||
|
||||
// init 802.3 header and Fill Packet
|
||||
MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid, pAd->CurrentAddress, EAPOL);
|
||||
MAKE_802_3_HEADER(Header802_3, pAd->CommonCfg.Bssid,
|
||||
pAd->CurrentAddress, EAPOL);
|
||||
|
||||
NdisZeroMemory(&Packet, sizeof(Packet));
|
||||
Packet.ProVer = EAPOL_VER;
|
||||
Packet.ProType = EAPOLKey;
|
||||
Packet.ProVer = EAPOL_VER;
|
||||
Packet.ProType = EAPOLKey;
|
||||
|
||||
Packet.KeyDesc.Type = WPA1_KEY_DESC;
|
||||
|
||||
// Request field presented
|
||||
Packet.KeyDesc.KeyInfo.Request = 1;
|
||||
// Request field presented
|
||||
Packet.KeyDesc.KeyInfo.Request = 1;
|
||||
|
||||
if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
|
||||
{
|
||||
if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) {
|
||||
Packet.KeyDesc.KeyInfo.KeyDescVer = 2;
|
||||
}
|
||||
else // TKIP
|
||||
} else // TKIP
|
||||
{
|
||||
Packet.KeyDesc.KeyInfo.KeyDescVer = 1;
|
||||
}
|
||||
|
||||
Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY);
|
||||
Packet.KeyDesc.KeyInfo.KeyType = (bUnicast ? PAIRWISEKEY : GROUPKEY);
|
||||
|
||||
// KeyMic field presented
|
||||
Packet.KeyDesc.KeyInfo.KeyMic = 1;
|
||||
Packet.KeyDesc.KeyInfo.KeyMic = 1;
|
||||
|
||||
// Error field presented
|
||||
Packet.KeyDesc.KeyInfo.Error = 1;
|
||||
// Error field presented
|
||||
Packet.KeyDesc.KeyInfo.Error = 1;
|
||||
|
||||
// Update packet length after decide Key data payload
|
||||
SET_UINT16_TO_ARRARY(Packet.Body_Len, LEN_EAPOL_KEY_MSG)
|
||||
|
||||
// Key Replay Count
|
||||
NdisMoveMemory(Packet.KeyDesc.ReplayCounter, pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY);
|
||||
inc_byte_array(pAd->StaCfg.ReplayCounter, 8);
|
||||
// Key Replay Count
|
||||
NdisMoveMemory(Packet.KeyDesc.ReplayCounter,
|
||||
pAd->StaCfg.ReplayCounter, LEN_KEY_DESC_REPLAY);
|
||||
inc_byte_array(pAd->StaCfg.ReplayCounter, 8);
|
||||
|
||||
// Convert to little-endian format.
|
||||
*((USHORT *)&Packet.KeyDesc.KeyInfo) = cpu2le16(*((USHORT *)&Packet.KeyDesc.KeyInfo));
|
||||
*((USHORT *) & Packet.KeyDesc.KeyInfo) =
|
||||
cpu2le16(*((USHORT *) & Packet.KeyDesc.KeyInfo));
|
||||
|
||||
|
||||
MlmeAllocateMemory(pAd, (PUCHAR *)&pOutBuffer); // allocate memory
|
||||
if(pOutBuffer == NULL)
|
||||
{
|
||||
MlmeAllocateMemory(pAd, (PUCHAR *) & pOutBuffer); // allocate memory
|
||||
if (pOutBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prepare EAPOL frame for MIC calculation
|
||||
// Be careful, only EAPOL frame is counted for MIC calculation
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet,
|
||||
END_OF_ARGS);
|
||||
MakeOutgoingFrame(pOutBuffer, &FrameLen,
|
||||
CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, &Packet,
|
||||
END_OF_ARGS);
|
||||
|
||||
// Prepare and Fill MIC value
|
||||
NdisZeroMemory(Mic, sizeof(Mic));
|
||||
if(pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled)
|
||||
{ // AES
|
||||
UCHAR digest[20] = {0};
|
||||
HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, digest, SHA1_DIGEST_SIZE);
|
||||
if (pAd->StaCfg.WepStatus == Ndis802_11Encryption3Enabled) { // AES
|
||||
UCHAR digest[20] = { 0 };
|
||||
HMAC_SHA1(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen,
|
||||
digest, SHA1_DIGEST_SIZE);
|
||||
NdisMoveMemory(Mic, digest, LEN_KEY_DESC_MIC);
|
||||
}
|
||||
else
|
||||
{ // TKIP
|
||||
HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen, Mic, MD5_DIGEST_SIZE);
|
||||
} else { // TKIP
|
||||
HMAC_MD5(pAd->StaCfg.PTK, LEN_EAP_MICK, pOutBuffer, FrameLen,
|
||||
Mic, MD5_DIGEST_SIZE);
|
||||
}
|
||||
NdisMoveMemory(Packet.KeyDesc.KeyMic, Mic, LEN_KEY_DESC_MIC);
|
||||
|
||||
// copy frame to Tx ring and send MIC failure report frame to authenticator
|
||||
RTMPToWirelessSta(pAd, &pAd->MacTab.Content[BSSID_WCID],
|
||||
Header802_3, LENGTH_802_3,
|
||||
(PUCHAR)&Packet,
|
||||
CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE);
|
||||
Header802_3, LENGTH_802_3,
|
||||
(PUCHAR) & Packet,
|
||||
CONV_ARRARY_TO_UINT16(Packet.Body_Len) + 4, FALSE);
|
||||
|
||||
MlmeFreeMemory(pAd, (PUCHAR)pOutBuffer);
|
||||
MlmeFreeMemory(pAd, (PUCHAR) pOutBuffer);
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("WpaMicFailureReportFrame <-----\n"));
|
||||
}
|
||||
|
@ -262,7 +243,7 @@ VOID WpaMicFailureReportFrame(
|
|||
* rolling over to more significant bytes if the byte was incremented from
|
||||
* 0xff to 0x00.
|
||||
*/
|
||||
void inc_byte_array(UCHAR *counter, int len)
|
||||
void inc_byte_array(UCHAR * counter, int len)
|
||||
{
|
||||
int pos = len - 1;
|
||||
while (pos >= 0) {
|
||||
|
@ -273,26 +254,27 @@ void inc_byte_array(UCHAR *counter, int len)
|
|||
}
|
||||
}
|
||||
|
||||
VOID WpaDisassocApAndBlockAssoc(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
VOID WpaDisassocApAndBlockAssoc(IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3)
|
||||
{
|
||||
RTMP_ADAPTER *pAd = (PRTMP_ADAPTER)FunctionContext;
|
||||
MLME_DISASSOC_REQ_STRUCT DisassocReq;
|
||||
RTMP_ADAPTER *pAd = (PRTMP_ADAPTER) FunctionContext;
|
||||
MLME_DISASSOC_REQ_STRUCT DisassocReq;
|
||||
|
||||
// disassoc from current AP first
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n"));
|
||||
DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid, REASON_MIC_FAILURE);
|
||||
MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ, sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq);
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("RTMPReportMicError - disassociate with current AP after sending second continuous EAPOL frame\n"));
|
||||
DisassocParmFill(pAd, &DisassocReq, pAd->CommonCfg.Bssid,
|
||||
REASON_MIC_FAILURE);
|
||||
MlmeEnqueue(pAd, ASSOC_STATE_MACHINE, MT2_MLME_DISASSOC_REQ,
|
||||
sizeof(MLME_DISASSOC_REQ_STRUCT), &DisassocReq);
|
||||
|
||||
pAd->Mlme.CntlMachine.CurrState = CNTL_WAIT_DISASSOC;
|
||||
pAd->StaCfg.bBlockAssoc = TRUE;
|
||||
}
|
||||
|
||||
VOID WpaStaPairwiseKeySetting(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PCIPHER_KEY pSharedKey;
|
||||
PMAC_TABLE_ENTRY pEntry;
|
||||
|
@ -307,9 +289,11 @@ VOID WpaStaPairwiseKeySetting(
|
|||
// Prepare pair-wise key information into shared key table
|
||||
NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY));
|
||||
pSharedKey->KeyLen = LEN_TKIP_EK;
|
||||
NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK);
|
||||
NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK);
|
||||
NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK);
|
||||
NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48],
|
||||
LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pSharedKey->TxMic,
|
||||
&pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK);
|
||||
|
||||
// Decide its ChiperAlg
|
||||
if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled)
|
||||
|
@ -320,37 +304,35 @@ VOID WpaStaPairwiseKeySetting(
|
|||
pSharedKey->CipherAlg = CIPHER_NONE;
|
||||
|
||||
// Update these related information to MAC_TABLE_ENTRY
|
||||
NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TKIP_EK);
|
||||
NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_RXMICK], LEN_TKIP_TXMICK);
|
||||
NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32],
|
||||
LEN_TKIP_EK);
|
||||
NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48],
|
||||
LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pEntry->PairwiseKey.TxMic,
|
||||
&pAd->StaCfg.PTK[48 + LEN_TKIP_RXMICK], LEN_TKIP_TXMICK);
|
||||
pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg;
|
||||
|
||||
// Update pairwise key information to ASIC Shared Key Table
|
||||
AsicAddSharedKeyEntry(pAd,
|
||||
BSS0,
|
||||
0,
|
||||
pSharedKey->CipherAlg,
|
||||
pSharedKey->Key,
|
||||
pSharedKey->TxMic,
|
||||
pSharedKey->RxMic);
|
||||
BSS0,
|
||||
0,
|
||||
pSharedKey->CipherAlg,
|
||||
pSharedKey->Key,
|
||||
pSharedKey->TxMic, pSharedKey->RxMic);
|
||||
|
||||
// Update ASIC WCID attribute table and IVEIV table
|
||||
RTMPAddWcidAttributeEntry(pAd,
|
||||
BSS0,
|
||||
0,
|
||||
pSharedKey->CipherAlg,
|
||||
pEntry);
|
||||
RTMPAddWcidAttributeEntry(pAd, BSS0, 0, pSharedKey->CipherAlg, pEntry);
|
||||
STA_PORT_SECURED(pAd);
|
||||
pAd->IndicateMediaState = NdisMediaStateConnected;
|
||||
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("%s : AID(%d) port secured\n", __func__, pEntry->Aid));
|
||||
DBGPRINT(RT_DEBUG_TRACE,
|
||||
("%s : AID(%d) port secured\n", __func__, pEntry->Aid));
|
||||
|
||||
}
|
||||
|
||||
VOID WpaStaGroupKeySetting(
|
||||
IN PRTMP_ADAPTER pAd)
|
||||
VOID WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd)
|
||||
{
|
||||
PCIPHER_KEY pSharedKey;
|
||||
PCIPHER_KEY pSharedKey;
|
||||
|
||||
pSharedKey = &pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId];
|
||||
|
||||
|
@ -358,8 +340,10 @@ VOID WpaStaGroupKeySetting(
|
|||
NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY));
|
||||
pSharedKey->KeyLen = LEN_TKIP_EK;
|
||||
NdisMoveMemory(pSharedKey->Key, pAd->StaCfg.GTK, LEN_TKIP_EK);
|
||||
NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16], LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24], LEN_TKIP_TXMICK);
|
||||
NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.GTK[16],
|
||||
LEN_TKIP_RXMICK);
|
||||
NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.GTK[24],
|
||||
LEN_TKIP_TXMICK);
|
||||
|
||||
// Update Shared Key CipherAlg
|
||||
pSharedKey->CipherAlg = CIPHER_NONE;
|
||||
|
@ -374,18 +358,16 @@ VOID WpaStaGroupKeySetting(
|
|||
|
||||
// Update group key information to ASIC Shared Key Table
|
||||
AsicAddSharedKeyEntry(pAd,
|
||||
BSS0,
|
||||
pAd->StaCfg.DefaultKeyId,
|
||||
pSharedKey->CipherAlg,
|
||||
pSharedKey->Key,
|
||||
pSharedKey->TxMic,
|
||||
pSharedKey->RxMic);
|
||||
BSS0,
|
||||
pAd->StaCfg.DefaultKeyId,
|
||||
pSharedKey->CipherAlg,
|
||||
pSharedKey->Key,
|
||||
pSharedKey->TxMic, pSharedKey->RxMic);
|
||||
|
||||
// Update ASIC WCID attribute table and IVEIV table
|
||||
RTMPAddWcidAttributeEntry(pAd,
|
||||
BSS0,
|
||||
pAd->StaCfg.DefaultKeyId,
|
||||
pSharedKey->CipherAlg,
|
||||
NULL);
|
||||
BSS0,
|
||||
pAd->StaCfg.DefaultKeyId,
|
||||
pSharedKey->CipherAlg, NULL);
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче