# HG changeset patch # User Junling Bu # Date 1379905007 25200 # Node ID 8bdf35df4bf12a3a0138f725641c64d746e67208 # Parent 17e79c1772cd331f59d8cc1115dc94cb390c2eed avoid crash when packets sent by higher layer cause no RTS/CTS operation diff -r 17e79c1772cd -r 8bdf35df4bf1 src/wifi/model/mac-low.cc --- a/src/wifi/model/mac-low.cc Sun Sep 22 18:02:07 2013 -0700 +++ b/src/wifi/model/mac-low.cc Sun Sep 22 19:56:47 2013 -0700 @@ -1053,21 +1053,27 @@ { WifiPreamble preamble; Time txTime = Seconds (0); - WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr); - WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); - //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 - if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) - preamble= WIFI_PREAMBLE_HT_GF; - else if (rtsTxVector.GetMode().GetModulationClass () == WIFI_MOD_CLASS_HT) - preamble= WIFI_PREAMBLE_HT_MF; - else - preamble=WIFI_PREAMBLE_LONG; if (params.MustSendRts ()) { + WifiTxVector rtsTxVector = GetRtsTxVector (packet, hdr); + //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 + if (m_phy->GetGreenfield () && m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) + { + preamble = WIFI_PREAMBLE_HT_GF; + } + else if (rtsTxVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_HT) + { + preamble = WIFI_PREAMBLE_HT_MF; + } + else + { + preamble = WIFI_PREAMBLE_LONG; + } txTime += m_phy->CalculateTxDuration (GetRtsSize (), rtsTxVector, preamble); txTime += GetCtsDuration (hdr->GetAddr1 (), rtsTxVector); txTime += Time (GetSifs () * 2); } + WifiTxVector dataTxVector = GetDataTxVector (packet, hdr); //standard says RTS packets can have GF format sec 9.6.0e.1 page 110 bullet b 2 if ( m_phy->GetGreenfield()&& m_stationManager->GetGreenfieldSupported (m_currentHdr.GetAddr1 ())) preamble= WIFI_PREAMBLE_HT_GF;