diff --git a/RELEASE_NOTES b/RELEASE_NOTES index 446f1b6c3..b3720bd28 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -50,6 +50,7 @@ New user-visible features - (network) ns-3 is now capable of serializing cooked (SLL) headers. This is used in DCE to allow the generation of pcap directly readable by wireshark. - (internet) It is now possible to set custom values for RipNg Link Down (standard is 16). +- (internet) permanent (static) NDISC entries can be created for IPv6 Bugs fixed ---------- diff --git a/src/internet/bindings/modulegen__gcc_ILP32.py b/src/internet/bindings/modulegen__gcc_ILP32.py index 08be8b2dd..00c169a1b 100644 --- a/src/internet/bindings/modulegen__gcc_ILP32.py +++ b/src/internet/bindings/modulegen__gcc_ILP32.py @@ -14802,6 +14802,11 @@ def register_Ns3NdiscCacheEntry_methods(root_module, cls): 'bool', [], is_const=True) + ## ndisc-cache.h (module 'internet'): bool ns3::NdiscCache::Entry::IsPermanent() const [member function] + cls.add_method('IsPermanent', + 'bool', + [], + is_const=True) ## ndisc-cache.h (module 'internet'): bool ns3::NdiscCache::Entry::IsProbe() const [member function] cls.add_method('IsProbe', 'bool', @@ -14830,6 +14835,10 @@ def register_Ns3NdiscCacheEntry_methods(root_module, cls): cls.add_method('MarkIncomplete', 'void', [param('ns3::Ptr< ns3::Packet >', 'p')]) + ## ndisc-cache.h (module 'internet'): void ns3::NdiscCache::Entry::MarkPermanent() [member function] + cls.add_method('MarkPermanent', + 'void', + []) ## ndisc-cache.h (module 'internet'): void ns3::NdiscCache::Entry::MarkProbe() [member function] cls.add_method('MarkProbe', 'void', diff --git a/src/internet/bindings/modulegen__gcc_LP64.py b/src/internet/bindings/modulegen__gcc_LP64.py index 08be8b2dd..00c169a1b 100644 --- a/src/internet/bindings/modulegen__gcc_LP64.py +++ b/src/internet/bindings/modulegen__gcc_LP64.py @@ -14802,6 +14802,11 @@ def register_Ns3NdiscCacheEntry_methods(root_module, cls): 'bool', [], is_const=True) + ## ndisc-cache.h (module 'internet'): bool ns3::NdiscCache::Entry::IsPermanent() const [member function] + cls.add_method('IsPermanent', + 'bool', + [], + is_const=True) ## ndisc-cache.h (module 'internet'): bool ns3::NdiscCache::Entry::IsProbe() const [member function] cls.add_method('IsProbe', 'bool', @@ -14830,6 +14835,10 @@ def register_Ns3NdiscCacheEntry_methods(root_module, cls): cls.add_method('MarkIncomplete', 'void', [param('ns3::Ptr< ns3::Packet >', 'p')]) + ## ndisc-cache.h (module 'internet'): void ns3::NdiscCache::Entry::MarkPermanent() [member function] + cls.add_method('MarkPermanent', + 'void', + []) ## ndisc-cache.h (module 'internet'): void ns3::NdiscCache::Entry::MarkProbe() [member function] cls.add_method('MarkProbe', 'void', diff --git a/src/internet/model/arp-cache.cc b/src/internet/model/arp-cache.cc index 0d1134a33..0c4a06f9b 100644 --- a/src/internet/model/arp-cache.cc +++ b/src/internet/model/arp-cache.cc @@ -392,8 +392,9 @@ ArpCache::Entry::MarkAlive (Address macAddress) void ArpCache::Entry::MarkPermanent (void) { - NS_LOG_FUNCTION (this); + NS_LOG_FUNCTION (this << m_macAddress); NS_ASSERT (!m_macAddress.IsInvalid ()); + m_state = PERMANENT; ClearRetries (); UpdateSeen (); diff --git a/src/internet/model/icmpv6-l4-protocol.cc b/src/internet/model/icmpv6-l4-protocol.cc index d109b2b8c..d7e370c5f 100644 --- a/src/internet/model/icmpv6-l4-protocol.cc +++ b/src/internet/model/icmpv6-l4-protocol.cc @@ -401,7 +401,7 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address } else { - if (!entry->IsReachable ()) + if (!entry->IsReachable () || !entry->IsPermanent ()) { entry->StopNudTimer (); waiting = entry->MarkReachable (lla.GetAddress ()); @@ -412,7 +412,10 @@ void Icmpv6L4Protocol::ReceiveLLA (Icmpv6OptionLinkLayerAddress lla, Ipv6Address cache->GetInterface ()->Send (*it, src); } } - entry->StartReachableTimer (); + if (!entry->IsPermanent ()) + { + entry->StartReachableTimer (); + } } } } @@ -708,7 +711,7 @@ void Icmpv6L4Protocol::HandleNA (Ptr packet, Ipv6Address const &src, Ipv if (naHeader.GetFlagS ()) { - if (!entry->IsReachable ()) + if (!entry->IsReachable () || !entry->IsPermanent ()) { if (entry->IsProbe ()) { @@ -724,7 +727,10 @@ void Icmpv6L4Protocol::HandleNA (Ptr packet, Ipv6Address const &src, Ipv entry->MarkReachable (lla.GetAddress ()); } } - entry->StartReachableTimer (); + if (!entry->IsPermanent ()) + { + entry->StartReachableTimer (); + } } else if (lla.GetAddress () != entry->GetMacAddress ()) { @@ -1295,7 +1301,7 @@ bool Icmpv6L4Protocol::Lookup (Ipv6Address dst, Ptr device, PtrLookup (dst); if (entry) { - if (entry->IsReachable () || entry->IsDelay ()) + if (entry->IsReachable () || entry->IsDelay () || entry->IsPermanent ()) { *hardwareDestination = entry->GetMacAddress (); return true; @@ -1329,7 +1335,7 @@ bool Icmpv6L4Protocol::Lookup (Ptr p, Ipv6Address dst, Ptr de NdiscCache::Entry* entry = cache->Lookup (dst); if (entry) { - if (entry->IsReachable () || entry->IsDelay ()) + if (entry->IsReachable () || entry->IsDelay () || entry->IsPermanent ()) { /* XXX check reachability time */ /* send packet */ diff --git a/src/internet/model/ndisc-cache.cc b/src/internet/model/ndisc-cache.cc index 5a9dc0c27..a41bfb460 100644 --- a/src/internet/model/ndisc-cache.cc +++ b/src/internet/model/ndisc-cache.cc @@ -187,10 +187,18 @@ void NdiscCache::PrintNdiscCache (Ptr stream) { *os << " PROBE\n"; } - else + else if (i->second->IsStale ()) { *os << " STALE\n"; } + else if (i->second->IsPermanent ()) + { + *os << " PERMANENT\n"; + } + else + { + NS_FATAL_ERROR ("Test for possibly unreachable code-- please file a bug report, with a test case, if this is ever hit"); + } } } @@ -495,6 +503,13 @@ void NdiscCache::Entry::MarkDelay () m_state = DELAY; } +void NdiscCache::Entry::MarkPermanent () +{ + NS_LOG_FUNCTION_NOARGS (); + StopNudTimer (); + m_state = PERMANENT; +} + bool NdiscCache::Entry::IsStale () const { NS_LOG_FUNCTION_NOARGS (); @@ -525,6 +540,12 @@ bool NdiscCache::Entry::IsProbe () const return (m_state == PROBE); } +bool NdiscCache::Entry::IsPermanent () const +{ + NS_LOG_FUNCTION_NOARGS (); + return (m_state == PERMANENT); +} + Address NdiscCache::Entry::GetMacAddress () const { NS_LOG_FUNCTION_NOARGS (); diff --git a/src/internet/model/ndisc-cache.h b/src/internet/model/ndisc-cache.h index 81eca9329..951e02a47 100644 --- a/src/internet/model/ndisc-cache.h +++ b/src/internet/model/ndisc-cache.h @@ -184,6 +184,11 @@ public: */ void MarkDelay (); + /** + * \brief Change the state to this entry to PERMANENT. + */ + void MarkPermanent (); + /** * \brief Add a packet (or replace old value) in the queue. * \param p packet to add @@ -225,6 +230,12 @@ public: */ bool IsProbe () const; + /** + * \brief Is the entry PERMANENT + * \return true if the entry is in PERMANENT state, false otherwise + */ + bool IsPermanent () const; + /** * \brief Get the MAC address of this entry. * \return the L2 address @@ -328,7 +339,8 @@ private: REACHABLE, /**< Mapping exists between IPv6 and L2 addresses */ STALE, /**< Mapping is stale */ DELAY, /**< Try to wait contact from remote host */ - PROBE /**< Try to contact IPv6 address to know again its L2 address */ + PROBE, /**< Try to contact IPv6 address to know again its L2 address */ + PERMANENT /**< Permanent Mapping exists between IPv6 and L2 addresses */ }; /**