From ca1b59e4c6b13cc2181293abd885d9d70f615635 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 22 Nov 2021 12:43:16 +0100 Subject: [PATCH] Choose and set addresses to packet --- handler/textPacketHandler.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/handler/textPacketHandler.hpp b/handler/textPacketHandler.hpp index a13c2c7..c963612 100644 --- a/handler/textPacketHandler.hpp +++ b/handler/textPacketHandler.hpp @@ -54,7 +54,15 @@ void textPacketHandler(std::vector textPacket){ int raIndex = findContains(headerData, "RA:", 1); std::string rAddr = (raIndex != -1) ? headerData[raIndex].substr("RA:"s.length()) : ""; - + + // Depending of when which address-fields are actually set, choose which ones to use + if(sAddr == "" && tAddr != "") sAddr = tAddr; + if(dAddr == "" && rAddr != "") dAddr = rAddr; + + // Set addresses to packet + packet.srcMac = sAddr; + packet.dstMac = dAddr; + packet.bssid = bssidAddr; } #endif /* EE781A91_6D07_47AC_B3C4_F99E29F3731F */