use NetDevice::NeedsArp where needed

Mathieu Lacage 2007-04-30 10:07:53 +02:00
parent cd2fabe2f1
commit bb58b03aef
1 changed files with 13 additions and 5 deletions

View File

@ -55,12 +55,20 @@ ArpIpv4Interface::DoCreateTraceResolver (TraceContext const &context)
void
ArpIpv4Interface::SendTo (Packet p, Ipv4Address dest)
{
Arp * arp = m_node->GetArp ();
MacAddress hardwareDestination;
bool found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination);
if (found)
NS_ASSERT (GetDevice () != 0);
if (GetDevice ()->NeedsArp ())
{
GetDevice ()->Send (p, hardwareDestination, Ipv4::PROT_NUMBER);
Arp * arp = m_node->GetArp ();
MacAddress hardwareDestination;
bool found = arp->Lookup (p, dest, GetDevice (), &hardwareDestination);
if (found)
{
GetDevice ()->Send (p, hardwareDestination, Ipv4::PROT_NUMBER);
}
}
else
{
GetDevice ()->Send (p, GetDevice ()->GetBroadcast (), Ipv4::PROT_NUMBER);
}
}