* fix BSSID/MAC check when receiving packets
* safeguard AP auth/deauth so local MP doesn't trigger it
This commit is contained in:
StapleButter 2017-12-19 00:33:09 +01:00
parent 141e2a7ab0
commit 5fe30d306f
2 changed files with 16 additions and 3 deletions

View File

@ -848,10 +848,11 @@ bool CheckRX(bool block)
continue; // oops. we received a packet we just sent.
bssidmatch = MACEqual(&RXBuffer[12 + a_bss], (u8*)&IOPORT(W_BSSID0));
if (!(IOPORT(W_BSSID0) & 0x0001) && !(RXBuffer[12 + a_bss] & 0x01) &&
!bssidmatch)
//if (!(IOPORT(W_BSSID0) & 0x0001) && !(RXBuffer[12 + a_bss] & 0x01) &&
if (!MACEqual(&RXBuffer[12 + a_dst], (u8*)&IOPORT(W_MACAddr0)) &&
!(RXBuffer[12 + a_dst] & 0x01))
{
printf("received packet %04X but it didn't pass the BSSID check\n", framectl);
printf("received packet %04X but it didn't pass the MAC check\n", framectl);
continue;
}

View File

@ -150,6 +150,9 @@ int HandleManagementFrame(u8* data, int len)
{
case 0x0: // assoc request
{
if (!MACEqual(&data[16], (u8*)APMac)) // check BSSID
return 0;
if (ClientStatus != 1)
{
printf("wifiAP: bad assoc request, needs auth prior\n");
@ -203,6 +206,9 @@ int HandleManagementFrame(u8* data, int len)
case 0xA: // deassoc
{
if (!MACEqual(&data[16], (u8*)APMac)) // check BSSID
return 0;
ClientStatus = 1;
printf("wifiAP: client deassociated\n");
@ -222,6 +228,9 @@ int HandleManagementFrame(u8* data, int len)
case 0xB: // auth
{
if (!MACEqual(&data[16], (u8*)APMac)) // check BSSID
return 0;
ClientStatus = 1;
printf("wifiAP: client authenticated\n");
@ -243,6 +252,9 @@ int HandleManagementFrame(u8* data, int len)
case 0xC: // deauth
{
if (!MACEqual(&data[16], (u8*)APMac)) // check BSSID
return 0;
ClientStatus = 0;
printf("wifiAP: client deauthenticated\n");