[ns] A possible BUG in ns2, in capture() function in mac/mac-802_11.cc

Mayur mayur at ee.iitd.ac.in
Sat Oct 18 03:01:28 PDT 2008


Dear NS experts,

There seems to be a BUG in ns2 (till latest version ns2.33) :

_*Abstract: *_

capture() function should treat errored_pkts and normal_pkts 
differently. Viz., the NAV should be set to only EIFS for errored 
packets and for normal packets to { EIFS + txtime(pkt) }.

_*More elaboration :*_

    * When a sender is far such that the received power (Pr) is [
      RXThresh_ < Pr <= CSThresh_ ], the packet is sensed but bot
      understood. As per the 802.11 std, for such sensed_only packet the
      receiver node should wait for EIFS. In NS2 presently (till ns2.33)
      this is done so far as this is the only packet being received.
      (PHY makes the packet ERRORED and MAC sets NAV to EIFS. (see
      recv_timer() function.)

    * But when more than one packets are being received, (COLLISION or
      CAPTURE case) then, there (seems to be) is a bug in the code. viz.
      The capture() function always sets NAV to (EIFS + txtime(pkt)),
      without checking if the packet is marked with 'errored' or not.


I have tried to rectify the bug (If I am correct). The corrected 
mac-802_11.cc is attached herewith. [Note: The original and modified 
versions can be toggled by just commenting/uncommenting the 
corresponding "#define" .]

As observed I have modified the capture() function to take a second 
argument for if the pkt is errored and the function acts accordingly.

Obviously, the mac-802_11.h needs one line correction for the new 
declaration of capture().

The results in the two cases (original_capture and modified_capture) are 
drastically different depending upon the scenario being tested.

Your suggestions are welcomed.

regards,
Mayur


More information about the Ns-users mailing list