From 127ee2ea4212f44a42e4f61a3c4d45458a3358e5 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Tue, 5 Jul 2022 10:20:43 +0200 Subject: [PATCH] wifi: StaWifiMac stores information on links to setup --- src/wifi/model/sta-wifi-mac.cc | 15 +++++++++++++++ src/wifi/model/sta-wifi-mac.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index a7d640180..1bc050a4e 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -443,6 +443,21 @@ StaWifiMac::ScanningTimeout (const std::optional& bestAp) NS_LOG_DEBUG ("Attempting to associate with AP: " << *bestAp); UpdateApInfo (bestAp->m_frame, bestAp->m_apAddr, bestAp->m_bssid, bestAp->m_linkId); + // reset info on links to setup + for (uint8_t linkId = 0; linkId < GetNLinks (); linkId++) + { + auto& link = GetLink (linkId); + link.apLinkId = std::nullopt; + link.sendAssocReq = false; + } + // send Association Request on the link where the Beacon/Probe Response was received + GetLink (bestAp->m_linkId).sendAssocReq = true; + // update info on links to setup + for (const auto& [localLinkId, apLinkid] : bestAp->m_setupLinks) + { + NS_LOG_DEBUG ("Setting up link (local ID=" << +localLinkId << ", AP ID=" << +apLinkid << ")"); + GetLink (localLinkId).apLinkId = apLinkid; + } // lambda to get beacon interval from Beacon or Probe Response auto getBeaconInterval = [](auto&& frame) diff --git a/src/wifi/model/sta-wifi-mac.h b/src/wifi/model/sta-wifi-mac.h index fe214d140..a958be861 100644 --- a/src/wifi/model/sta-wifi-mac.h +++ b/src/wifi/model/sta-wifi-mac.h @@ -236,6 +236,7 @@ protected: std::optional apLinkId; //!< ID (as set by the AP) of the link we have //!< setup or are setting up + bool sendAssocReq; //!< whether this link is used to send the Association Request }; /**