wifi: Handle distinct per-link BSSIDs
Also, BSSID is now stored by the FEM instead of the MAC. This is because the link MAC address (which matches the BSSID for APs) is notified directly to and stored by the FEM.
This commit is contained in:
committed by
Stefano Avallone
parent
c6e88b8c37
commit
8a44424bb7
@@ -58,8 +58,6 @@ OcbWifiMac::OcbWifiMac (void)
|
||||
NS_LOG_FUNCTION (this);
|
||||
// Let the lower layers know that we are acting as an OCB node
|
||||
SetTypeOfStation (OCB);
|
||||
// BSSID is still needed in the low part of MAC
|
||||
WifiMac::SetBssid (WILDCARD_BSSID);
|
||||
}
|
||||
|
||||
OcbWifiMac::~OcbWifiMac (void)
|
||||
@@ -130,7 +128,7 @@ OcbWifiMac::SetBssid (Mac48Address bssid)
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
OcbWifiMac::GetBssid (void) const
|
||||
OcbWifiMac::GetBssid (uint8_t /* linkId */) const
|
||||
{
|
||||
NS_LOG_WARN ("in OCB mode we should not call GetBssid");
|
||||
return WILDCARD_BSSID;
|
||||
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
* here it will overloaded to log warn message
|
||||
* \return An invalid BSSID.
|
||||
*/
|
||||
virtual Mac48Address GetBssid (void) const;
|
||||
virtual Mac48Address GetBssid (uint8_t /* linkId */) const;
|
||||
/**
|
||||
* SetLinkUpCallback and SetLinkDownCallback will be overloaded
|
||||
* In OCB mode, stations can send packets directly whenever they want
|
||||
|
||||
@@ -58,20 +58,6 @@ AdhocWifiMac::~AdhocWifiMac ()
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
AdhocWifiMac::SetAddress (Mac48Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
//In an IBSS, the BSSID is supposed to be generated per Section
|
||||
//11.1.3 of IEEE 802.11. We don't currently do this - instead we
|
||||
//make an IBSS STA a bit like an AP, with the BSSID for frames
|
||||
//transmitted by each STA set to that STA's address.
|
||||
//
|
||||
//This is why we're overriding this method.
|
||||
WifiMac::SetAddress (address);
|
||||
WifiMac::SetBssid (address);
|
||||
}
|
||||
|
||||
bool
|
||||
AdhocWifiMac::CanForwardPacketsTo (Mac48Address to) const
|
||||
{
|
||||
@@ -150,7 +136,7 @@ AdhocWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
}
|
||||
hdr.SetAddr1 (to);
|
||||
hdr.SetAddr2 (GetAddress ());
|
||||
hdr.SetAddr3 (GetBssid ());
|
||||
hdr.SetAddr3 (GetBssid (0));
|
||||
hdr.SetDsNotFrom ();
|
||||
hdr.SetDsNotTo ();
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ public:
|
||||
AdhocWifiMac ();
|
||||
virtual ~AdhocWifiMac ();
|
||||
|
||||
void SetAddress (Mac48Address address) override;
|
||||
void SetLinkUpCallback (Callback<void> linkUp) override;
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
|
||||
bool CanForwardPacketsTo (Mac48Address to) const override;
|
||||
|
||||
@@ -148,16 +148,6 @@ ApWifiMac::GetLink (uint8_t linkId) const
|
||||
return static_cast<ApLinkEntity&> (WifiMac::GetLink (linkId));
|
||||
}
|
||||
|
||||
void
|
||||
ApWifiMac::SetAddress (Mac48Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
//As an AP, our MAC address is also the BSSID. Hence we are
|
||||
//overriding this function and setting both in our parent class.
|
||||
WifiMac::SetAddress (address);
|
||||
WifiMac::SetBssid (address);
|
||||
}
|
||||
|
||||
void
|
||||
ApWifiMac::ConfigureStandard (WifiStandard standard)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,6 @@ public:
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
|
||||
void Enqueue (Ptr<Packet> packet, Mac48Address to, Mac48Address from) override;
|
||||
bool SupportsSendFrom (void) const override;
|
||||
void SetAddress (Mac48Address address) override;
|
||||
Ptr<WifiMacQueue> GetTxopQueue (AcIndex ac) const override;
|
||||
void ConfigureStandard (WifiStandard standard) override;
|
||||
|
||||
|
||||
@@ -190,6 +190,9 @@ void
|
||||
FrameExchangeManager::SetAddress (Mac48Address address)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << address);
|
||||
// For APs, the BSSID is the MAC address. For STAs, the BSSID will be overwritten
|
||||
// when receiving Beacon frames or Probe Response frames
|
||||
SetBssid (address);
|
||||
m_self = address;
|
||||
}
|
||||
|
||||
@@ -206,6 +209,12 @@ FrameExchangeManager::SetBssid (Mac48Address bssid)
|
||||
m_bssid = bssid;
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
FrameExchangeManager::GetBssid (void) const
|
||||
{
|
||||
return m_bssid;
|
||||
}
|
||||
|
||||
void
|
||||
FrameExchangeManager::SetDroppedMpduCallback (DroppedMpdu callback)
|
||||
{
|
||||
|
||||
@@ -162,6 +162,12 @@ public:
|
||||
* \param bssid the BSSID
|
||||
*/
|
||||
virtual void SetBssid (Mac48Address bssid);
|
||||
/**
|
||||
* Get the Basic Service Set Identification.
|
||||
*
|
||||
* \return the BSSID
|
||||
*/
|
||||
Mac48Address GetBssid (void) const;
|
||||
/**
|
||||
* Set the callback to invoke when an MPDU is dropped.
|
||||
*
|
||||
|
||||
@@ -204,12 +204,12 @@ StaWifiMac::SendProbeRequest (void)
|
||||
void
|
||||
StaWifiMac::SendAssociationRequest (bool isReassoc)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << GetBssid () << isReassoc);
|
||||
NS_LOG_FUNCTION (this << GetBssid (0) << isReassoc); // TODO use appropriate linkId
|
||||
WifiMacHeader hdr;
|
||||
hdr.SetType (isReassoc ? WIFI_MAC_MGT_REASSOCIATION_REQUEST : WIFI_MAC_MGT_ASSOCIATION_REQUEST);
|
||||
hdr.SetAddr1 (GetBssid ());
|
||||
hdr.SetAddr1 (GetBssid (0)); // TODO use appropriate linkId
|
||||
hdr.SetAddr2 (GetAddress ());
|
||||
hdr.SetAddr3 (GetBssid ());
|
||||
hdr.SetAddr3 (GetBssid (0)); // TODO use appropriate linkId
|
||||
hdr.SetDsNotFrom ();
|
||||
hdr.SetDsNotTo ();
|
||||
Ptr<Packet> packet = Create<Packet> ();
|
||||
@@ -242,7 +242,7 @@ StaWifiMac::SendAssociationRequest (bool isReassoc)
|
||||
else
|
||||
{
|
||||
MgtReassocRequestHeader reassoc;
|
||||
reassoc.SetCurrentApAddress (GetBssid ());
|
||||
reassoc.SetCurrentApAddress (GetBssid (0)); // TODO use appropriate linkId
|
||||
reassoc.SetSsid (GetSsid ());
|
||||
reassoc.SetSupportedRates (GetSupportedRates ());
|
||||
reassoc.SetCapabilities (GetCapabilities ());
|
||||
@@ -278,7 +278,7 @@ StaWifiMac::SendAssociationRequest (bool isReassoc)
|
||||
// AC_BE should be selected.
|
||||
// — If category AC_BE was not selected by the previous step, category AC_VO
|
||||
// shall be selected." (Sec. 10.2.3.2 of 802.11-2020)
|
||||
else if (!GetWifiRemoteStationManager ()->GetQosSupported (GetBssid ()))
|
||||
else if (!GetWifiRemoteStationManager ()->GetQosSupported (GetBssid (0))) // TODO use appropriate linkId
|
||||
{
|
||||
GetBEQueue ()->Queue (packet, hdr);
|
||||
}
|
||||
@@ -531,7 +531,7 @@ StaWifiMac::Enqueue (Ptr<Packet> packet, Mac48Address to)
|
||||
hdr.SetNoOrder (); // explicitly set to 0 for the time being since HT control field is not yet implemented (set it to 1 when implemented)
|
||||
}
|
||||
|
||||
hdr.SetAddr1 (GetBssid ());
|
||||
hdr.SetAddr1 (GetBssid (0)); // TODO use appropriate linkId
|
||||
hdr.SetAddr2 (GetAddress ());
|
||||
hdr.SetAddr3 (to);
|
||||
hdr.SetDsNotFrom ();
|
||||
@@ -582,7 +582,7 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
NotifyRxDrop (packet);
|
||||
return;
|
||||
}
|
||||
if (hdr->GetAddr2 () != GetBssid ())
|
||||
if (hdr->GetAddr2 () != GetBssid (0)) // TODO use appropriate linkId
|
||||
{
|
||||
NS_LOG_LOGIC ("Received data frame not from the BSS we are associated with: ignore");
|
||||
NotifyRxDrop (packet);
|
||||
@@ -592,7 +592,7 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
{
|
||||
if (hdr->IsQosAmsdu ())
|
||||
{
|
||||
NS_ASSERT (hdr->GetAddr3 () == GetBssid ());
|
||||
NS_ASSERT (hdr->GetAddr3 () == GetBssid (0)); // TODO use appropriate linkId
|
||||
DeaggregateAmsduAndForward (mpdu);
|
||||
packet = 0;
|
||||
}
|
||||
@@ -646,7 +646,7 @@ StaWifiMac::Receive (Ptr<WifiMacQueueItem> mpdu, uint8_t linkId)
|
||||
NS_LOG_LOGIC ("No match for BSS membership selector");
|
||||
goodBeacon = false;
|
||||
}
|
||||
if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid ())
|
||||
if ((IsWaitAssocResp () || IsAssociated ()) && hdr->GetAddr3 () != GetBssid (linkId))
|
||||
{
|
||||
NS_LOG_LOGIC ("Beacon is not for us");
|
||||
goodBeacon = false;
|
||||
@@ -783,7 +783,7 @@ StaWifiMac::UpdateApInfoFromBeacon (MgtBeaconHeader beacon, Mac48Address apAddr,
|
||||
Mac48Address bssid, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << beacon << apAddr << bssid << +linkId);
|
||||
SetBssid (bssid);
|
||||
SetBssid (bssid, linkId);
|
||||
const CapabilityInformation& capabilities = beacon.GetCapabilities ();
|
||||
const SupportedRates& rates = beacon.GetSupportedRates ();
|
||||
for (const auto & mode : GetWifiPhy (linkId)->GetModeList ())
|
||||
@@ -967,7 +967,7 @@ StaWifiMac::UpdateApInfoFromProbeResp (MgtProbeResponseHeader probeResp, Mac48Ad
|
||||
}
|
||||
GetWifiRemoteStationManager (linkId)->SetShortPreambleEnabled (isShortPreambleEnabled);
|
||||
GetWifiRemoteStationManager (linkId)->SetShortSlotTimeEnabled (capabilities.IsShortSlotTime ());
|
||||
SetBssid (bssid);
|
||||
SetBssid (bssid, linkId);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1173,12 +1173,12 @@ StaWifiMac::SetState (MacState value)
|
||||
if (value == ASSOCIATED
|
||||
&& m_state != ASSOCIATED)
|
||||
{
|
||||
m_assocLogger (GetBssid ());
|
||||
m_assocLogger (GetBssid (0)); // TODO use appropriate linkId
|
||||
}
|
||||
else if (value != ASSOCIATED
|
||||
&& m_state == ASSOCIATED)
|
||||
{
|
||||
m_deAssocLogger (GetBssid ());
|
||||
m_deAssocLogger (GetBssid (0)); // TODO use appropriate linkId
|
||||
}
|
||||
m_state = value;
|
||||
}
|
||||
|
||||
@@ -422,20 +422,16 @@ WifiMac::GetSsid (void) const
|
||||
}
|
||||
|
||||
void
|
||||
WifiMac::SetBssid (Mac48Address bssid)
|
||||
WifiMac::SetBssid (Mac48Address bssid, uint8_t linkId)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << bssid);
|
||||
m_bssid = bssid;
|
||||
for (auto& link : m_links)
|
||||
{
|
||||
link->feManager->SetBssid (bssid);
|
||||
}
|
||||
NS_LOG_FUNCTION (this << bssid << +linkId);
|
||||
GetLink (linkId).feManager->SetBssid (bssid);
|
||||
}
|
||||
|
||||
Mac48Address
|
||||
WifiMac::GetBssid (void) const
|
||||
WifiMac::GetBssid (uint8_t linkId) const
|
||||
{
|
||||
return m_bssid;
|
||||
return GetLink (linkId).feManager->GetBssid ();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -763,7 +759,6 @@ WifiMac::SetupFrameExchangeManager (WifiStandard standard)
|
||||
feManager->SetMacTxMiddle (m_txMiddle);
|
||||
feManager->SetMacRxMiddle (m_rxMiddle);
|
||||
feManager->SetAddress (GetAddress ());
|
||||
feManager->SetBssid (GetBssid ());
|
||||
feManager->GetWifiTxTimer ().SetMpduResponseTimeoutCallback (MakeCallback (&MpduResponseTimeoutTracedCallback::operator(),
|
||||
&m_mpduResponseTimeoutCallback));
|
||||
feManager->GetWifiTxTimer ().SetPsduResponseTimeoutCallback (MakeCallback (&PsduResponseTimeoutTracedCallback::operator(),
|
||||
|
||||
@@ -223,13 +223,15 @@ public:
|
||||
*/
|
||||
virtual void SetAddress (Mac48Address address);
|
||||
/**
|
||||
* \return the BSSID of the network this device belongs to.
|
||||
* \return the BSSID of the network the given link belongs to.
|
||||
* \param linkId the ID of the given link
|
||||
*/
|
||||
Mac48Address GetBssid (void) const;
|
||||
Mac48Address GetBssid (uint8_t linkId) const;
|
||||
/**
|
||||
* \param bssid the BSSID of the network that this device belongs to.
|
||||
* \param bssid the BSSID of the network that the given link belongs to.
|
||||
* \param linkId the ID of the given link
|
||||
*/
|
||||
void SetBssid (Mac48Address bssid);
|
||||
void SetBssid (Mac48Address bssid, uint8_t linkId);
|
||||
|
||||
/**
|
||||
* Return true if packets can be forwarded to the given destination,
|
||||
@@ -752,7 +754,6 @@ private:
|
||||
|
||||
Mac48Address m_address; //!< MAC address of this station
|
||||
Ssid m_ssid; //!< Service Set ID (SSID)
|
||||
Mac48Address m_bssid; //!< the BSSID
|
||||
|
||||
/** This type defines a mapping between an Access Category index,
|
||||
and a pointer to the corresponding channel access function.
|
||||
|
||||
@@ -682,7 +682,7 @@ WifiPrimaryChannelsTest::SendDlSuPpdu (uint8_t bss, uint16_t txChannelWidth)
|
||||
hdr.SetQosTid (0);
|
||||
hdr.SetAddr1 (staDev->GetMac ()->GetAddress ());
|
||||
hdr.SetAddr2 (apDev->GetMac ()->GetAddress ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid (0));
|
||||
hdr.SetSequenceNumber (1);
|
||||
Ptr<WifiPsdu> psdu = Create<WifiPsdu> (Create<Packet> (1000), hdr);
|
||||
apDev->GetPhy ()->Send (WifiConstPsduMap ({std::make_pair (SU_STA_ID, psdu)}), txVector);
|
||||
@@ -703,7 +703,7 @@ WifiPrimaryChannelsTest::SendDlMuPpdu (uint8_t bss, uint16_t txChannelWidth, HeR
|
||||
hdr.SetType (WIFI_MAC_QOSDATA);
|
||||
hdr.SetQosTid (0);
|
||||
hdr.SetAddr2 (apDev->GetMac ()->GetAddress ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid (0));
|
||||
hdr.SetSequenceNumber (1);
|
||||
|
||||
WifiConstPsduMap psduMap;
|
||||
@@ -749,7 +749,7 @@ WifiPrimaryChannelsTest::DoSendHeTbPpdu (uint8_t bss, uint16_t txChannelWidth, H
|
||||
hdr.SetType (WIFI_MAC_QOSDATA);
|
||||
hdr.SetQosTid (0);
|
||||
hdr.SetAddr1 (apDev->GetMac ()->GetAddress ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid ());
|
||||
hdr.SetAddr3 (apDev->GetMac ()->GetBssid (0));
|
||||
hdr.SetSequenceNumber (1);
|
||||
|
||||
Time duration = Seconds (0);
|
||||
|
||||
Reference in New Issue
Block a user