Route lookup removed in ARP request (see bug 606)

This commit is contained in:
Pavel Boyko committed 2009-08-06 10:23:12 +04:00
1 parent 403b68938c
commit 7a89fcdd50
2 files changed
+6 -16

No files matched your search

+5 -15
View File
@@ -186,7 +186,7 @@ ArpL3Protocol::Receive(Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t prot
found = true;
NS_LOG_LOGIC ("node="<<m_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 @@ ArpL3Protocol::SendArpRequest (Ptr<const ArpCache> cache, Ipv4Address to)
}
void
ArpL3Protocol::SendArpReply (Ptr<const ArpCache> cache, Ipv4Address toIp, Address toMac)
ArpL3Protocol::SendArpReply (Ptr<const ArpCache> 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<Ipv4L3Protocol> ipv4 = m_node->GetObject<Ipv4L3Protocol> ();
int32_t interface = ipv4->GetInterfaceForDevice (cache->GetDevice ());
NS_ASSERT (interface >= 0);
Ipv4Header header;
header.SetDestination (toIp);
Socket::SocketErrno errno_;
Ptr<Packet> packet = Create<Packet> ();
Ptr<Ipv4Route> route = ipv4->GetRoutingProtocol ()->RouteOutput (packet, header, interface, errno_);
NS_ASSERT (route != 0);
NS_LOG_LOGIC ("ARP: sending reply from node "<<m_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> packet = Create<Packet> ();
packet->AddHeader (arp);
cache->GetDevice ()->Send (packet, toMac, PROT_NUMBER);
}
+1 -1
View File
@@ -87,7 +87,7 @@ private:
typedef std::list<Ptr<ArpCache> > CacheList;
Ptr<ArpCache> FindCache (Ptr<NetDevice> device);
void SendArpRequest (Ptr<const ArpCache>cache, Ipv4Address to);
void SendArpReply (Ptr<const ArpCache> cache, Ipv4Address toIp, Address toMac);
void SendArpReply (Ptr<const ArpCache> cache, Ipv4Address myIp, Ipv4Address toIp, Address toMac);
CacheList m_cacheList;
Ptr<Node> m_node;
TracedCallback<Ptr<const Packet> > m_dropTrace;