bug 1643 - NdiscCache creation and existence checks
This commit is contained in:
@@ -1231,8 +1231,16 @@ bool Icmpv6L4Protocol::Lookup (Ipv6Address dst, Ptr<NetDevice> device, Ptr<Ndisc
|
||||
/* try to find the cache */
|
||||
cache = FindCache (device);
|
||||
}
|
||||
|
||||
return cache->Lookup (dst);
|
||||
if (cache)
|
||||
{
|
||||
NdiscCache::Entry* entry = cache->Lookup (dst);
|
||||
if (entry && !(entry->IsIncomplete() || entry->IsProbe()))
|
||||
{
|
||||
*hardwareDestination = entry->GetMacAddress ();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> device, Ptr<NdiscCache> cache, Address* hardwareDestination)
|
||||
@@ -1244,6 +1252,10 @@ bool Icmpv6L4Protocol::Lookup (Ptr<Packet> p, Ipv6Address dst, Ptr<NetDevice> de
|
||||
/* try to find the cache */
|
||||
cache = FindCache (device);
|
||||
}
|
||||
if (!cache)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NdiscCache::Entry* entry = cache->Lookup (dst);
|
||||
if (entry)
|
||||
|
||||
@@ -103,7 +103,10 @@ void Ipv6Interface::DoSetup ()
|
||||
}
|
||||
|
||||
Ptr<Icmpv6L4Protocol> icmpv6 = m_node->GetObject<Ipv6L3Protocol> ()->GetIcmpv6 ();
|
||||
m_ndCache = icmpv6->CreateCache (m_device, this);
|
||||
if (m_device->NeedsArp ())
|
||||
{
|
||||
m_ndCache = icmpv6->CreateCache (m_device, this);
|
||||
}
|
||||
}
|
||||
|
||||
void Ipv6Interface::SetNode (Ptr<Node> node)
|
||||
|
||||
Reference in New Issue
Block a user