# HG changeset patch # User Tom Henderson # Date 1305931458 25200 # Node ID a3a0c0cfbba3682da933045ddc49d47350078cd5 # Parent e860437bafcc32a52c985e28930bf07d018f30a9 improve AODV logging diff -r e860437bafcc -r a3a0c0cfbba3 src/aodv/model/aodv-routing-protocol.cc --- a/src/aodv/model/aodv-routing-protocol.cc Fri May 20 15:43:54 2011 -0700 +++ b/src/aodv/model/aodv-routing-protocol.cc Fri May 20 15:44:18 2011 -0700 @@ -356,7 +356,7 @@ bool result = m_routingTable.LookupRoute(header.GetDestination (), rt); if(!result || ((rt.GetFlag() != IN_SEARCH) && result)) { - NS_LOG_LOGIC ("Send RREQ to" <SendTo (packet, 0, InetSocketAddress (destination, AODV_PORT)); } ScheduleRreqRetry (dst); @@ -894,6 +895,7 @@ rt.IncrementRreqCnt (); m_routingTable.Update (rt); m_addressReqTimer[dst].Schedule (Time (rt.GetRreqCnt () * NetTraversalTime)); + NS_LOG_LOGIC ("Scheduled RREQ retry in " << Time (rt.GetRreqCnt () * NetTraversalTime).GetSeconds () << " seconds"); } void @@ -1002,7 +1004,10 @@ if (m_routingTable.LookupRoute (src, toPrev)) { if (toPrev.IsUnidirectional ()) - return; + { + NS_LOG_DEBUG ("Ignoring RREQ from node in blacklist"); + return; + } } uint32_t id = rreqHeader.GetId (); @@ -1014,6 +1019,7 @@ */ if (m_rreqIdCache.IsDuplicate (origin, id)) { + NS_LOG_DEBUG ("Ignoring RREQ due to duplicate"); return; } @@ -1058,13 +1064,16 @@ toOrigin.GetLifeTime ())); m_routingTable.Update (toOrigin); } - NS_LOG_LOGIC (receiver << " receive RREQ to destination " << rreqHeader.GetDst ()); + NS_LOG_LOGIC (receiver << " receive RREQ with hop count " << static_cast(rreqHeader.GetHopCount ()) + << " ID " << rreqHeader.GetId () + << " to destination " << rreqHeader.GetDst ()); // A node generates a RREP if either: // (i) it is itself the destination, if (IsMyOwnAddress (rreqHeader.GetDst ())) { m_routingTable.LookupRoute (origin, toOrigin); + NS_LOG_DEBUG ("Send reply since I am the destination"); SendReply (rreqHeader, toOrigin); return; } @@ -1468,17 +1477,17 @@ */ if (toDst.GetRreqCnt () == RreqRetries) { - NS_LOG_LOGIC("route discovery to " << dst << " has been attempted RreqRetries times"); + NS_LOG_LOGIC("route discovery to " << dst << " has been attempted RreqRetries (" << RreqRetries << ") times"); m_addressReqTimer.erase (dst); m_routingTable.DeleteRoute (dst); - NS_LOG_DEBUG ("Route not found. Drop packet with dst " << dst); + NS_LOG_DEBUG ("Route not found. Drop all packets with dst " << dst); m_queue.DropPacketWithDst (dst); return; } if (toDst.GetFlag () == IN_SEARCH) { - NS_LOG_LOGIC ("Send new RREQ to " << dst << " ttl " << NetDiameter); + NS_LOG_LOGIC ("Resend RREQ to " << dst << " ttl " << NetDiameter); SendRequest (dst); } else