Bug 1848 - yans-wifi-phy can receive frames sent using unsupported mode
This commit is contained in:
@@ -452,7 +452,7 @@ YansWifiPhy::StartReceivePacket (Ptr<Packet> packet,
|
||||
rxPowerDbm += m_rxGainDb;
|
||||
double rxPowerW = DbmToW (rxPowerDbm);
|
||||
Time rxDuration = CalculateTxDuration (packet->GetSize (), txVector, preamble);
|
||||
WifiMode txMode=txVector.GetMode();
|
||||
WifiMode txMode = txVector.GetMode();
|
||||
Time endRx = Simulator::Now () + rxDuration;
|
||||
|
||||
Ptr<InterferenceHelper::Event> event;
|
||||
@@ -509,15 +509,24 @@ WifiMode txMode=txVector.GetMode();
|
||||
case YansWifiPhy::IDLE:
|
||||
if (rxPowerW > m_edThresholdW)
|
||||
{
|
||||
NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
|
||||
// sync to signal
|
||||
m_state->SwitchToRx (rxDuration);
|
||||
NS_ASSERT (m_endRxEvent.IsExpired ());
|
||||
NotifyRxBegin (packet);
|
||||
m_interference.NotifyRxStart ();
|
||||
m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
|
||||
packet,
|
||||
event);
|
||||
if (IsModeSupported (txMode))
|
||||
{
|
||||
NS_LOG_DEBUG ("sync to signal (power=" << rxPowerW << "W)");
|
||||
// sync to signal
|
||||
m_state->SwitchToRx (rxDuration);
|
||||
NS_ASSERT (m_endRxEvent.IsExpired ());
|
||||
NotifyRxBegin (packet);
|
||||
m_interference.NotifyRxStart ();
|
||||
m_endRxEvent = Simulator::Schedule (rxDuration, &YansWifiPhy::EndReceive, this,
|
||||
packet,
|
||||
event);
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_DEBUG ("drop packet because it was sent using an unsupported mode (" << txMode << ")");
|
||||
NotifyRxDrop (packet);
|
||||
goto maybeCcaBusy;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -580,6 +589,18 @@ YansWifiPhy::GetMode (uint32_t mode) const
|
||||
{
|
||||
return m_deviceRateSet[mode];
|
||||
}
|
||||
bool
|
||||
YansWifiPhy::IsModeSupported (WifiMode mode) const
|
||||
{
|
||||
for (uint32_t i = 0; i < GetNModes (); i++)
|
||||
{
|
||||
if (mode == GetMode (i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
uint32_t
|
||||
YansWifiPhy::GetNTxPower (void) const
|
||||
{
|
||||
|
||||
@@ -260,6 +260,7 @@ public:
|
||||
virtual Time GetLastRxStartTime (void) const;
|
||||
virtual uint32_t GetNModes (void) const;
|
||||
virtual WifiMode GetMode (uint32_t mode) const;
|
||||
virtual bool IsModeSupported (WifiMode mode) const;
|
||||
virtual double CalculateSnr (WifiMode txMode, double ber) const;
|
||||
virtual Ptr<WifiChannel> GetChannel (void) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user