From fd289dd446df0ff52cccb9e203ee377c46e210ff Mon Sep 17 00:00:00 2001 From: medusalix Date: Fri, 20 Mar 2020 15:27:56 +0100 Subject: [PATCH] Fix 1537 double-association when pairing --- dongle/mt76.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dongle/mt76.cpp b/dongle/mt76.cpp index 6227082..6a6dd7b 100644 --- a/dongle/mt76.cpp +++ b/dongle/mt76.cpp @@ -60,6 +60,7 @@ bool Mt76::beforeClose() void Mt76::handleWlanPacket(const Bytes &packet) { + const RxWi *rxWi = packet.toStruct(); const WlanFrame *wlanFrame = packet.toStruct(sizeof(RxWi)); const Bytes source( @@ -104,6 +105,26 @@ void Mt76::handleWlanPacket(const Bytes &packet) clientConnected(wcid, source); } + // Only kept for compatibility with 1537 controllers + // They associate, disassociate and associate again during pairing + // Disassociations happen without triggering EVT_CLIENT_LOST + else if (subtype == MT_WLAN_DISASSOC) + { + Log::debug( + "Client disassociating: %s", + Log::formatBytes(source).c_str() + ); + + if (!removeClient(rxWi->wcid)) + { + Log::error("Failed to remove client"); + + return; + } + + clientDisconnected(rxWi->wcid); + } + // Reserved frames are used for different purposes // Most of them are yet to be discovered else if (subtype == MT_WLAN_RESERVED)