Bug 371 - examples/wifi-ap.cc is broken in NS 3.2
examples/wifi-ap.cc is broken in NS 3.2
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3.2
All All
: P3 major
Assigned To: Mathieu Lacage
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-02 11:18 EDT by Gustavo J. A. M. Carneiro
Modified: 2008-10-16 06:25 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2008-10-02 11:18:18 EDT
A student turned to me for help saying "I upgraded to NS 3.2 and now my wifi code is not working.  I am using a modified version of examples/wifi-ap.cc, which is broken out-of-the-box in NS 3.2".

I investigated and the guy is right: the code does not work.  Wifi stations try to transmit, but the other station never receives anything.  Commenting out the following line makes the code work.

// enable rts cts all the time.
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0"));

Please fix this.  Nothing worse than a bad example program... :-/
Comment 1 Mathieu Lacage 2008-10-02 16:13:05 EDT
please, more info:
1) how to reproduce
2) what happens
3) what should happen

Gustavo: you should know better.
Comment 2 Gustavo J. A. M. Carneiro 2008-10-02 18:32:27 EDT
Mathieu, all the tracing of the PHY and MAC levels are drowning the real problem.  Start by commenting out all the tracing except Rx and Tx at NetDevice level.  Then you'll only TX trace events, and no RX events.  Basically one STA is sending packets, but the other STA is not receiving them.
Comment 3 Gustavo J. A. M. Carneiro 2008-10-10 06:42:12 EDT
While reviving the wifi scanning code I hit the same problem as this one.  Here's some debugging of what happens when a AP tries to send a ProbeResponse, using RTS/CTS:

## AP sending ProbeResponse
1150080016ns NqapWifiMac:SendProbeResp(0x6400b0, 00:00:00:00:00:01)
1150114016ns MacLow:StartTransmission(0x640270, 0x645100, 0x640798, [send rts=1, next size=0, dur=0ns, ack=normal], 0x6407e0)
1150114016ns MacLow:CancelAllEvents(0x640270)
1150114016ns MacLow:StartTransmission(): 00:00:00:00:00:03 startTx size=64, to=00:00:00:00:00:01, listener=0x6407e0
1150114016ns MacLow:SendRtsForPacket(0x640270)
1150114016ns MacLow:ForwardDown(0x640270, 0x6451a0, 0x7fffca71b9e0, wifia-6mbs)

### AP sends RTS
1150114016ns MacLow:ForwardDown(): 00:00:00:00:00:03 send CTL_RTS, to=00:00:00:00:00:01, size=20, mode=wifia-6mbs, duration=248000ns, seq=0x0
----- 2000ns ellapsed
### CTS timeout after 2000ns, in the AP
1150166016ns MacLow:CtsTimeout(0x640270)
1150166016ns MacLow:CtsTimeout(): 00:00:00:00:00:03 cts timeout
----- 16ns ellapsed
### The RTS is received by the STA 20016ns after the it was sent
1150166032ns MacLow:ReceiveOk(0x63d390, ns3::WifiMacHeader (CTL_RTS Duration/ID=248us, RA=00:00:00:00:00:01, TA=00:00:00:00:00:03) ns3::WifiMacTrailer (), 27163.3, wifia-6mbs, 0)
1150166032ns MacLow:ReceiveOk(): 00:00:00:00:00:01 duration/id=248000ns
1150166032ns MacLow:ReceiveOk(): hdr.IsCts (): 0; hdr.GetAddr1 (): 00:00:00:00:00:01; m_self: 00:00:00:00:00:01; m_ctsTimeoutEvent.IsRunning (): 0; m_currentPacket: 0
1150166032ns MacLow:ReceiveOk(): 00:00:00:00:00:01 rx RTS from=00:00:00:00:00:03, schedule CTS
----- 16000ns ellapsed
### The CTS is sent by the STA 68016ns after the RTS was sent by the AP
1150182032ns MacLow:SendCtsAfterRts(0x63d390)
1150182032ns MacLow:ForwardDown(0x63d390, 0x644ae0, 0x7fffca71c370, wifia-6mbs)
1150182032ns MacLow:ForwardDown(): 00:00:00:00:00:01 send CTL_CTS, to=00:00:00:00:00:03, size=14, mode=wifia-6mbs, duration=188000ns, seq=0x30
----- 44016ns ellapsed
### The CTS is received by the AP 112032ns after the RTS was sent
1150226048ns MacLow:ReceiveOk(0x640270, ns3::WifiMacHeader (CTL_CTS Duration/ID=188us, RA=00:00:00:00:00:03) ns3::WifiMacTrailer (), 27163.3, wifia-6mbs, 0)
1150226048ns MacLow:ReceiveOk(): 00:00:00:00:00:03 duration/id=188000ns
1150226048ns MacLow:ReceiveOk(): hdr.IsCts (): 1; hdr.GetAddr1 (): 00:00:00:00:00:03; m_self: 00:00:00:00:00:03; m_ctsTimeoutEvent.IsRunning (): 0; m_currentPacket: 0
1150226048ns MacLow:ReceiveOk(): 00:00:00:00:00:03 rx drop CTL_CTS
Comment 4 Mathieu Lacage 2008-10-16 04:20:40 EDT
(In reply to comment #3)

> ### CTS timeout after 2000ns, in the AP
> 1150166016ns MacLow:CtsTimeout(0x640270)
> 1150166016ns MacLow:CtsTimeout(): 00:00:00:00:00:03 cts timeout

the problem is here above. This timeout is happening too early.
Comment 5 Mathieu Lacage 2008-10-16 04:26:51 EDT
changeset 789e9a21ecbe

please, can you verify ?
Comment 6 Gustavo J. A. M. Carneiro 2008-10-16 06:25:38 EDT
/me confirms.  The problem is fixed.