improve arp debugging output
This commit is contained in:
@@ -81,7 +81,8 @@ Arp::Receive(Packet& packet, NetDevice &device)
|
||||
if (arp.IsRequest () &&
|
||||
arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ())
|
||||
{
|
||||
NS_DEBUG ("got request from " << arp.GetSourceIpv4Address () << " -- send reply");
|
||||
NS_DEBUG ("node="<<m_node->GetId () <<", got request from " <<
|
||||
arp.GetSourceIpv4Address () << " -- send reply");
|
||||
SendArpReply (cache, arp.GetSourceIpv4Address (),
|
||||
arp.GetSourceHardwareAddress ());
|
||||
}
|
||||
@@ -95,7 +96,8 @@ Arp::Receive(Packet& packet, NetDevice &device)
|
||||
{
|
||||
if (entry->IsWaitReply ())
|
||||
{
|
||||
NS_DEBUG ("got reply from " << arp.GetSourceIpv4Address ()
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<", got reply from " <<
|
||||
arp.GetSourceIpv4Address ()
|
||||
<< " for waiting entry -- flush");
|
||||
MacAddress from_mac = arp.GetSourceHardwareAddress ();
|
||||
Packet waiting = entry->MarkAlive (from_mac);
|
||||
@@ -105,14 +107,15 @@ Arp::Receive(Packet& packet, NetDevice &device)
|
||||
{
|
||||
// ignore this reply which might well be an attempt
|
||||
// at poisening my arp cache.
|
||||
NS_DEBUG ("got reply from " << arp.GetSourceIpv4Address () <<
|
||||
" for non-waiting entry -- drop");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<", got reply from " <<
|
||||
arp.GetSourceIpv4Address () <<
|
||||
" for non-waiting entry -- drop");
|
||||
// XXX report packet as dropped.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_DEBUG ("got reply for unknown entry -- drop");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<", got reply for unknown entry -- drop");
|
||||
// XXX report packet as dropped.
|
||||
}
|
||||
}
|
||||
@@ -130,19 +133,22 @@ Arp::Lookup (Packet &packet, Ipv4Address destination,
|
||||
{
|
||||
if (entry->IsDead ())
|
||||
{
|
||||
NS_DEBUG ("dead entry for " << destination << " expired -- send arp request");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", dead entry for " << destination << " expired -- send arp request");
|
||||
entry->MarkWaitReply (packet);
|
||||
SendArpRequest (cache, destination);
|
||||
}
|
||||
else if (entry->IsAlive ())
|
||||
{
|
||||
NS_DEBUG ("alive entry for " << destination << " expired -- send arp request");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", alive entry for " << destination << " expired -- send arp request");
|
||||
entry->MarkWaitReply (packet);
|
||||
SendArpRequest (cache, destination);
|
||||
}
|
||||
else if (entry->IsWaitReply ())
|
||||
{
|
||||
NS_DEBUG ("wait reply for " << destination << " expired -- drop");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", wait reply for " << destination << " expired -- drop");
|
||||
entry->MarkDead ();
|
||||
// XXX report packet as 'dropped'
|
||||
}
|
||||
@@ -151,18 +157,21 @@ Arp::Lookup (Packet &packet, Ipv4Address destination,
|
||||
{
|
||||
if (entry->IsDead ())
|
||||
{
|
||||
NS_DEBUG ("dead entry for " << destination << " valid -- drop");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", dead entry for " << destination << " valid -- drop");
|
||||
// XXX report packet as 'dropped'
|
||||
}
|
||||
else if (entry->IsAlive ())
|
||||
{
|
||||
NS_DEBUG ("alive entry for " << destination << " valid -- send");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", alive entry for " << destination << " valid -- send");
|
||||
*hardwareDestination = entry->GetMacAddress ();
|
||||
return true;
|
||||
}
|
||||
else if (entry->IsWaitReply ())
|
||||
{
|
||||
NS_DEBUG ("wait reply for " << destination << " valid -- drop previous");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", wait reply for " << destination << " valid -- drop previous");
|
||||
Packet old = entry->UpdateWaitReply (packet);
|
||||
// XXX report 'old' packet as 'dropped'
|
||||
}
|
||||
@@ -172,7 +181,8 @@ Arp::Lookup (Packet &packet, Ipv4Address destination,
|
||||
else
|
||||
{
|
||||
// This is our first attempt to transmit data to this destination.
|
||||
NS_DEBUG ("no entry for " << destination << " -- send arp request");
|
||||
NS_DEBUG ("node="<<m_node->GetId ()<<
|
||||
", no entry for " << destination << " -- send arp request");
|
||||
entry = cache->Add (destination);
|
||||
entry->MarkWaitReply (packet);
|
||||
SendArpRequest (cache, destination);
|
||||
|
||||
Reference in New Issue
Block a user