src/internet-node/arp-l3-protocol.cc
changeset 1167 2cb083ff04c6
parent 1161 bb72baff8b26
parent 933 df68dad55087
child 1176 4894ea885c0f
--- a/src/internet-node/arp-l3-protocol.cc	Fri Jul 27 09:44:24 2007 +0200
+++ b/src/internet-node/arp-l3-protocol.cc	Mon Jul 30 10:35:03 2007 +0200
@@ -87,6 +87,13 @@
   ArpCache *cache = FindCache (device);
   ArpHeader arp;
   packet.RemoveHeader (arp);
+  
+  NS_DEBUG ("ARP: received "<< (arp.IsRequest ()? "request" : "reply") <<
+            " node="<<m_node->GetId ()<<", got request from " <<
+            arp.GetSourceIpv4Address () << " for address " <<
+            arp.GetDestinationIpv4Address () << "; we have address " <<
+            cache->GetInterface ()->GetAddress ());
+
   if (arp.IsRequest () && 
       arp.GetDestinationIpv4Address () == cache->GetInterface ()->GetAddress ()) 
     {
@@ -128,6 +135,12 @@
 	  // XXX report packet as dropped.
         }
     }
+  else
+    {
+      NS_DEBUG ("node="<<m_node->GetId ()<<", got request from " <<
+                arp.GetSourceIpv4Address () << " for unknown address " <<
+                arp.GetDestinationIpv4Address () << " -- drop");
+    }
 }
 bool 
 ArpL3Protocol::Lookup (Packet &packet, Ipv4Address destination, 
@@ -203,6 +216,11 @@
 ArpL3Protocol::SendArpRequest (ArpCache const *cache, Ipv4Address to)
 {
   ArpHeader arp;
+  NS_DEBUG ("ARP: sending request from node "<<m_node->GetId ()<<
+            " || src: " << cache->GetDevice ()->GetAddress () <<
+            " / " << cache->GetInterface ()->GetAddress () <<
+            " || dst: " << cache->GetDevice ()->GetBroadcast () <<
+            " / " << to);
   arp.SetRequest (cache->GetDevice ()->GetAddress (),
 		  cache->GetInterface ()->GetAddress (), 
                   cache->GetDevice ()->GetBroadcast (),
@@ -216,6 +234,10 @@
 ArpL3Protocol::SendArpReply (ArpCache const *cache, Ipv4Address toIp, Address toMac)
 {
   ArpHeader arp;
+  NS_DEBUG ("ARP: sending reply from node "<<m_node->GetId ()<<
+            "|| src: " << cache->GetDevice ()->GetAddress () << 
+            " / " << cache->GetInterface ()->GetAddress () <<
+            " || dst: " << toMac << " / " << toIp);
   arp.SetReply (cache->GetDevice ()->GetAddress (),
                 cache->GetInterface ()->GetAddress (),
                 toMac, toIp);