Bug 940 - AODV fails to set up a correct path
AODV fails to set up a correct path
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: aodv
ns-3.8
All Linux
: P3 normal
Assigned To: Elena Buchatskaya
:
Depends on: 966
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-11 09:50 EDT by Christian
Modified: 2010-08-04 14:00 EDT (History)
3 users (show)

See Also:


Attachments
Simulation scripts reproducing the bug (4.11 KB, text/x-c++src)
2010-06-11 09:50 EDT, Christian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian 2010-06-11 09:50:31 EDT
Created attachment 916 [details]
Simulation scripts reproducing the bug

Important notes:
* this behavior does not occur always: specifically, only for some seeds AODV fails to establish a route.
* Also, I am not sure if this bug is related to bug 879 (in that bug TCP is used, whereas here UDP is used).

I saw that AODV cannot establish a correct route for the following configuration:
* OnOffApplication + UDP
* WifiAdHoc multi-hop network w/ chain topology: OnOffApp on 1st node, PacketSink on n-th node
* ~200 seconds of simulation

Here's an excerpt of a gdb session:
Breakpoint 6, ns3::UdpSocketImpl::DoSendTo (this=0x80b7a00, p=..., dest=..., port=21) at ../src/internet-stack/udp-socket-impl.cc:430
430	      route = ipv4->GetRoutingProtocol ()->RouteOutput (p, header, oif, errno_); 
(gdb) bt
#0  ns3::UdpSocketImpl::DoSendTo (this=0x80b7a00, p=..., dest=..., port=21) at ../src/internet-stack/udp-socket-impl.cc:431
#1  0xb76a6bea in ns3::UdpSocketImpl::DoSend (this=0x80b7a00, p=...) at ../src/internet-stack/udp-socket-impl.cc:271
#2  0xb76a6ee8 in ns3::UdpSocketImpl::Send (this=0x80b7a00, p=..., flags=0) at ../src/internet-stack/udp-socket-impl.cc:249
#3  0xb75d2ce9 in ns3::Socket::Send (this=0x80b7a00, p=...) at ../src/node/socket.cc:112
#4  0xb77e4e2e in ns3::OnOffApplication::SendPacket (this=0x80aa7b8) at ../src/applications/onoff/onoff-application.cc:240
#5  0xb77e2f14 in Notify (this=0x80a4f78) at debug/ns3/make-event.h:94
#6  0xb745694a in ns3::EventImpl::Invoke (this=0x80a4f78) at ../src/simulator/event-impl.cc:37
#7  0xb74764aa in ns3::DefaultSimulatorImpl::ProcessOneEvent (this=0x807add0) at ../src/simulator/default-simulator-impl.cc:128
#8  0xb747650a in ns3::DefaultSimulatorImpl::Run (this=0x807add0) at ../src/simulator/default-simulator-impl.cc:158
#9  0xb745f915 in ns3::Simulator::Run () at ../src/simulator/simulator.cc:173
#10 0x08052858 in main (argc=2, argv=0xbffff3c4) at ../scratch/aodv.cc:138
(gdb) n
431	      if (route != 0)
(gdb) p route
$6 = {
  m_ptr = 0x80b5eb0
}
(gdb) p/x (*route->m_ptr)
$7 = {
  <ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >> = {
    <ns3::empty> = {<No data fields>}, 
    members of ns3::SimpleRefCount<ns3::Ipv4Route, ns3::empty, ns3::DefaultDeleter<ns3::Ipv4Route> >: 
    m_count = 0x1
  }, 
  members of ns3::Ipv4Route: 
  m_dest = {
    m_address = 0xa000005
  }, 
  m_source = {
    m_address = 0x66666666
  }, 
  m_gateway = {
    m_address = 0x7f000001
  }, 
  m_outputDevice = {
    m_ptr = 0x80a26d8
  }
}

By translating the addresses, it is possible to see that the destination is 10.0.0.5 (correct), the source is 102.102.102.102 (not correct), and the gateway is 127.0.0.1 (not correct).

I have attached a simulation script that reproduces the bug (in my case using --RngRun=10 turns on the bug).
To find a "bug-enabling" seed one could use a quick'n'dirty for-loop in bash (hitting ctrl-c whenever packet are received):
for i in $(seq 1 2000) ; do ./waf --command-template="%s --RngRun=$i" --run "scratch/aodv" ; done
Comment 1 Tom Henderson 2010-06-13 17:56:49 EDT
(In reply to comment #0)
> Created an attachment (id=916) [details]
> Simulation scripts reproducing the bug
> 
> Important notes:
> * this behavior does not occur always: specifically, only for some seeds AODV
> fails to establish a route.
> * Also, I am not sure if this bug is related to bug 879 (in that bug TCP is
> used, whereas here UDP is used).

<snip>

> 
> By translating the addresses, it is possible to see that the destination is
> 10.0.0.5 (correct), the source is 102.102.102.102 (not correct), and the
> gateway is 127.0.0.1 (not correct).
> 
> I have attached a simulation script that reproduces the bug (in my case using
> --RngRun=10 turns on the bug).

I was able to reproduce this with the --RngRun=10 option as you suggested, after disabling these two lines in the test case that caused an error for me:
  phy.Set ("TxPowerStart", DoubleValue (16.0206)); // 40 mW
  phy.Set ("TxPowerEnd", DoubleValue (23.0));      // 200 mW

However, the behavior of the gateway being 127.0.0.1 is correct.  In this case, since there is no route, AODV replies with a "LoopbackRoute" so that the packet can be caught in the RouteInput() stage and a RREQ issued.  

But the bug may be related to bug 879; will have to look more closely to compare the failure case with the working case.
Comment 2 Elena Buchatskaya 2010-08-04 09:01:02 EDT
The reported behavior is related to bug 966. After applying corresponding patch AODV correctly finds the route.
Comment 3 Elena Buchatskaya 2010-08-04 14:00:15 EDT
changeset 5dbb70a41b85