diff -r 637b9cacd0b5 src/internet-stack/arp-l3-protocol.cc --- a/src/internet-stack/arp-l3-protocol.cc Mon Jul 27 23:04:19 2009 -0700 +++ b/src/internet-stack/arp-l3-protocol.cc Mon Aug 03 16:09:51 2009 +0400 @@ -186,7 +186,7 @@ found = true; NS_LOG_LOGIC ("node="<GetId () <<", got request from " << arp.GetSourceIpv4Address () << " -- send reply"); - SendArpReply (cache, arp.GetSourceIpv4Address (), + SendArpReply (cache, arp.GetDestinationIpv4Address (), arp.GetSourceIpv4Address (), arp.GetSourceHardwareAddress ()); break; } @@ -338,26 +338,16 @@ } void -ArpL3Protocol::SendArpReply (Ptr cache, Ipv4Address toIp, Address toMac) +ArpL3Protocol::SendArpReply (Ptr cache, Ipv4Address myIp, Ipv4Address toIp, Address toMac) { NS_LOG_FUNCTION (this << cache << toIp << toMac); ArpHeader arp; - // need to pick a source address; use routing implementation to select - Ptr ipv4 = m_node->GetObject (); - int32_t interface = ipv4->GetInterfaceForDevice (cache->GetDevice ()); - NS_ASSERT (interface >= 0); - Ipv4Header header; - header.SetDestination (toIp); - Socket::SocketErrno errno_; - Ptr packet = Create (); - Ptr route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, interface, errno_); - NS_ASSERT (route != 0); NS_LOG_LOGIC ("ARP: sending reply from node "<GetId ()<< "|| src: " << cache->GetDevice ()->GetAddress () << - " / " << route->GetSource () << + " / " << myIp << " || dst: " << toMac << " / " << toIp); - arp.SetReply (cache->GetDevice ()->GetAddress (), - route->GetSource (), toMac, toIp); + arp.SetReply (cache->GetDevice ()->GetAddress (), myIp, toMac, toIp); + Ptr packet = Create (); packet->AddHeader (arp); cache->GetDevice ()->Send (packet, toMac, PROT_NUMBER); } diff -r 637b9cacd0b5 src/internet-stack/arp-l3-protocol.h --- a/src/internet-stack/arp-l3-protocol.h Mon Jul 27 23:04:19 2009 -0700 +++ b/src/internet-stack/arp-l3-protocol.h Mon Aug 03 16:09:51 2009 +0400 @@ -87,7 +87,7 @@ typedef std::list > CacheList; Ptr FindCache (Ptr device); void SendArpRequest (Ptrcache, Ipv4Address to); - void SendArpReply (Ptr cache, Ipv4Address toIp, Address toMac); + void SendArpReply (Ptr cache, Ipv4Address myIp, Ipv4Address toIp, Address toMac); CacheList m_cacheList; Ptr m_node; TracedCallback > m_dropTrace;