diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 57c41c907..d4fbfbf11 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -1773,8 +1773,7 @@ ApWifiMac::Receive(Ptr mpdu, uint8_t linkId) packet->PeekHeader(reassocReq); frame = reassocReq; } - ReceiveAssocRequest(frame, from, linkId); - if (GetNLinks() > 1) + if (ReceiveAssocRequest(frame, from, linkId) && GetNLinks() > 1) { ParseReportedStaInfo(frame, from, linkId); } diff --git a/src/wifi/model/sta-wifi-mac.cc b/src/wifi/model/sta-wifi-mac.cc index efee4fb69..1a4749451 100644 --- a/src/wifi/model/sta-wifi-mac.cc +++ b/src/wifi/model/sta-wifi-mac.cc @@ -1248,6 +1248,18 @@ StaWifiMac::ReceiveAssocResp(Ptr mpdu, uint8_t linkId) m_linkUp(); } } + else + { + // If the link on which the (Re)Association Request frame was received cannot be + // accepted by the AP MLD, the AP MLD shall treat the multi-link (re)setup as a + // failure and shall not accept any requested links. If the link on which the + // (Re)Association Request frame was received is accepted by the AP MLD, the + // multi-link (re)setup is successful. (Sec. 35.3.5.1 of 802.11be D3.1) + NS_LOG_DEBUG("association refused"); + SetState(REFUSED); + StartScanning(); + return; + } // if this is an MLD, check if we can setup (other) links if (GetNLinks() > 1) @@ -1325,11 +1337,7 @@ StaWifiMac::ReceiveAssocResp(Ptr mpdu, uint8_t linkId) for (const auto& id : setupLinks) { GetLink(id).bssid = std::nullopt; - // if at least one link was setup, disable the links that were not setup (if any) - if (m_state == ASSOCIATED) - { - GetLink(id).phy->SetOffMode(); - } + GetLink(id).phy->SetOffMode(); } if (apMldAddress) { @@ -1338,15 +1346,6 @@ StaWifiMac::ReceiveAssocResp(Ptr mpdu, uint8_t linkId) } } - if (m_state == WAIT_ASSOC_RESP) - { - // if we didn't transition to ASSOCIATED, the request was refused - NS_LOG_DEBUG("association refused"); - SetState(REFUSED); - StartScanning(); - return; - } - SetPmModeAfterAssociation(linkId); }