Neighbor's sequence number is always invalid at disabling Hello
authorYoshihiko Yazawa <yoshiyaz@gmail.com>
Tue, 14 Dec 2010 21:41:58 -0800
changeset 6683 95a102872a7e
parent 6682 096ee74e0562
child 6684 718c331ae742
Neighbor's sequence number is always invalid at disabling Hello
src/routing/aodv/aodv-routing-protocol.cc
--- a/src/routing/aodv/aodv-routing-protocol.cc	Tue Dec 14 21:41:21 2010 -0800
+++ b/src/routing/aodv/aodv-routing-protocol.cc	Tue Dec 14 21:41:58 2010 -0800
@@ -930,10 +930,17 @@
   else
     {
       Ptr<NetDevice> dev = m_ipv4->GetNetDevice (m_ipv4->GetInterfaceForAddress (receiver));
-      RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/sender, /*know seqno=*/false, /*seqno=*/0,
-                                  /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0),
-                                  /*hops=*/1, /*next hop=*/sender, /*lifetime=*/std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
-      m_routingTable.Update (newEntry);
+      if (toNeighbor.GetValidSeqNo () && (toNeighbor.GetHop () == 1) && (toNeighbor.GetOutputDevice () == dev))
+        {
+          toNeighbor.SetLifeTime (std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
+        }
+      else
+        {
+          RoutingTableEntry newEntry (/*device=*/dev, /*dst=*/sender, /*know seqno=*/false, /*seqno=*/0,
+                                      /*iface=*/m_ipv4->GetAddress (m_ipv4->GetInterfaceForAddress (receiver), 0),
+                                      /*hops=*/1, /*next hop=*/sender, /*lifetime=*/std::max (ActiveRouteTimeout, toNeighbor.GetLifeTime ()));
+          m_routingTable.Update (newEntry);
+        }
     }
 
 }