diff --git a/CHANGES.md b/CHANGES.md index 964e7a31f..f87379a73 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -40,6 +40,7 @@ Changes from ns-3.40 to ns-3-dev * (lr-wpan) Add the capability to see the enum values of the MAC transition states in log prints for easier debugging. * (sixlowpan) Remove `ForceEtherType` and `EtherType` attributes, and use RFC 7973 EtherType for interfaces supporting an EtherType. * (lr-wpan) Group MAC status enumerations into a single `LrWpanMacStatus` enumeration in `lr-wpan-mac-base.h.` +* (internet) Deprecated `Ipv4::WeakEsModel` and `Ipv4::GetWeakEsModel()`, `Ipv4::SetWeakEsModel(bool)` methods. Moved `Ipv6L3Protocol::StrongEndSystemModel` to `Ipv6::StrongEndSystemModel` and added `Ipv4::StrongEndSystemModel` with corresponding `GetStrongEndSystemModel()` and `SetStrongEndSystemModel(bool)` methods to improve end system model configuration options. ### Changes to build system diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 32562352b..77b1aa1ac 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -31,6 +31,7 @@ Release 3-dev - (wifi) - Reduce error rate model precision to fix infinite loop when Ideal rate manager is used with EHT - (lr-wpan) !1794 - Group MAC primitives status enumerations into a single enumeration - (core) !1802 - Added support for Bernoulli and Binomial random variables (`BernoulliRandomVariable`, `BinomialRandomVariable`) +- (internet) !1817 - Resolved inconsistency in behavior regarding the Strong End System Model between IPv4 and IPv6. Attributes `Ipv6L3Protocol::StrongEndSystemModel` and `Ipv4::WeakEsModel` have been aligned to provide a consistent user experience and avoid confusion ### Bugs fixed diff --git a/src/click/model/ipv4-l3-click-protocol.cc b/src/click/model/ipv4-l3-click-protocol.cc index 7f050c1b8..15c1e7848 100644 --- a/src/click/model/ipv4-l3-click-protocol.cc +++ b/src/click/model/ipv4-l3-click-protocol.cc @@ -238,7 +238,7 @@ Ipv4L3ClickProtocol::IsDestinationAddress(Ipv4Address address, uint32_t iif) con return true; } - if (GetWeakEsModel()) // Check other interfaces + if (!GetStrongEndSystemModel()) // Check other interfaces { for (uint32_t j = 0; j < GetNInterfaces(); j++) { @@ -287,13 +287,25 @@ Ipv4L3ClickProtocol::GetIpForward() const void Ipv4L3ClickProtocol::SetWeakEsModel(bool model) { - m_weakEsModel = model; + m_strongEndSystemModel = !model; } bool Ipv4L3ClickProtocol::GetWeakEsModel() const { - return m_weakEsModel; + return !m_strongEndSystemModel; +} + +void +Ipv4L3ClickProtocol::SetStrongEndSystemModel(bool model) +{ + m_strongEndSystemModel = model; +} + +bool +Ipv4L3ClickProtocol::GetStrongEndSystemModel() const +{ + return m_strongEndSystemModel; } Ptr diff --git a/src/click/model/ipv4-l3-click-protocol.h b/src/click/model/ipv4-l3-click-protocol.h index d90f5403d..5b6caccc6 100644 --- a/src/click/model/ipv4-l3-click-protocol.h +++ b/src/click/model/ipv4-l3-click-protocol.h @@ -266,9 +266,15 @@ class Ipv4L3ClickProtocol : public Ipv4 void SetIpForward(bool forward) override; bool GetIpForward() const override; + + NS_DEPRECATED_3_41("Use SetStrongEndSystemModel instead") void SetWeakEsModel(bool model) override; + NS_DEPRECATED_3_41("Use GetStrongEndSystemModel instead") bool GetWeakEsModel() const override; + void SetStrongEndSystemModel(bool model) override; + bool GetStrongEndSystemModel() const override; + /** * \brief List of IPv4 interfaces. */ @@ -296,7 +302,7 @@ class Ipv4L3ClickProtocol : public Ipv4 Ptr m_routingProtocol; //!< IPv4 routing protocol bool m_ipForward; //!< Whether IP forwarding is enabled - bool m_weakEsModel; //!< Whether to use weak Es model + bool m_strongEndSystemModel; //!< Whether to use Strong End System Model L4List_t m_protocols; //!< List of IPv4 L4 protocols Ipv4InterfaceList m_interfaces; //!< List of interfaces Ipv4InterfaceReverseContainer diff --git a/src/internet/model/ipv4-l3-protocol.cc b/src/internet/model/ipv4-l3-protocol.cc index cedc3e9eb..ba3914268 100644 --- a/src/internet/model/ipv4-l3-protocol.cc +++ b/src/internet/model/ipv4-l3-protocol.cc @@ -546,7 +546,7 @@ Ipv4L3Protocol::IsDestinationAddress(Ipv4Address address, uint32_t iif) const return true; } - if (GetWeakEsModel()) // Check other interfaces + if (!GetStrongEndSystemModel()) // Check other interfaces { for (uint32_t j = 0; j < GetNInterfaces(); j++) { @@ -1441,14 +1441,28 @@ void Ipv4L3Protocol::SetWeakEsModel(bool model) { NS_LOG_FUNCTION(this << model); - m_weakEsModel = model; + m_strongEndSystemModel = !model; } bool Ipv4L3Protocol::GetWeakEsModel() const { NS_LOG_FUNCTION(this); - return m_weakEsModel; + return !m_strongEndSystemModel; +} + +void +Ipv4L3Protocol::SetStrongEndSystemModel(bool model) +{ + NS_LOG_FUNCTION(this << model); + m_strongEndSystemModel = model; +} + +bool +Ipv4L3Protocol::GetStrongEndSystemModel() const +{ + NS_LOG_FUNCTION(this); + return m_strongEndSystemModel; } void diff --git a/src/internet/model/ipv4-l3-protocol.h b/src/internet/model/ipv4-l3-protocol.h index b59e7292f..64af3342d 100644 --- a/src/internet/model/ipv4-l3-protocol.h +++ b/src/internet/model/ipv4-l3-protocol.h @@ -295,9 +295,15 @@ class Ipv4L3Protocol : public Ipv4 // class Ipv4 attributes void SetIpForward(bool forward) override; bool GetIpForward() const override; + + NS_DEPRECATED_3_41("Use SetStrongEndSystemModel instead") void SetWeakEsModel(bool model) override; + NS_DEPRECATED_3_41("Use GetStrongEndSystemModel instead") bool GetWeakEsModel() const override; + void SetStrongEndSystemModel(bool model) override; + bool GetStrongEndSystemModel() const override; + /** * \brief Decrease the identification value for a dropped or recursed packet * \param source source IPv4 address @@ -460,7 +466,7 @@ class Ipv4L3Protocol : public Ipv4 typedef std::map> L4List_t; bool m_ipForward; //!< Forwarding packets (i.e. router mode) state. - bool m_weakEsModel; //!< Weak ES model state + bool m_strongEndSystemModel; //!< Strong End System Model state L4List_t m_protocols; //!< List of transport protocol. Ipv4InterfaceList m_interfaces; //!< List of IPv4 interfaces. Ipv4InterfaceReverseContainer diff --git a/src/internet/model/ipv4.cc b/src/internet/model/ipv4.cc index be6f3a876..3059120e2 100644 --- a/src/internet/model/ipv4.cc +++ b/src/internet/model/ipv4.cc @@ -23,6 +23,7 @@ #include "ns3/boolean.h" #include "ns3/log.h" #include "ns3/node.h" +#include "ns3/warnings.h" namespace ns3 { @@ -34,6 +35,7 @@ NS_OBJECT_ENSURE_REGISTERED(Ipv4); TypeId Ipv4::GetTypeId() { + NS_WARNING_PUSH_DEPRECATED; static TypeId tid = TypeId("ns3::Ipv4") .SetParent() @@ -49,7 +51,16 @@ Ipv4::GetTypeId() "another interface", BooleanValue(true), MakeBooleanAccessor(&Ipv4::SetWeakEsModel, &Ipv4::GetWeakEsModel), - MakeBooleanChecker()) + MakeBooleanChecker(), + TypeId::DEPRECATED, + "DEPRECATED since ns-3.41. Use the StrongEndSystemModel attribute.") + .AddAttribute( + "StrongEndSystemModel", + "Reject packets for an address not configured on the interface they're " + "coming from (RFC1122, section 3.3.4.2).", + BooleanValue(false), + MakeBooleanAccessor(&Ipv4::SetStrongEndSystemModel, &Ipv4::GetStrongEndSystemModel), + MakeBooleanChecker()) #if 0 .AddAttribute ("MtuDiscover", "If enabled, every outgoing ip packet will have the DF flag set.", BooleanValue (false), @@ -58,6 +69,7 @@ Ipv4::GetTypeId() MakeBooleanChecker ()) #endif ; + NS_WARNING_POP; return tid; } diff --git a/src/internet/model/ipv4.h b/src/internet/model/ipv4.h index 329b2ebb7..5bd339afc 100644 --- a/src/internet/model/ipv4.h +++ b/src/internet/model/ipv4.h @@ -220,9 +220,9 @@ class Ipv4 : public Object * a multicast group that the host has joined (and the incoming device * is acceptable), or if address corresponds to a broadcast address. * - * If the Ipv4 attribute WeakEsModel is true, the unicast address may - * match any of the Ipv4 addresses on any interface. If the attribute is - * false, the address must match one assigned to the incoming device. + * If the Ipv4 attribute StrongEndSystemModel is true, the address must match one assigned to + * the incoming device. If the attribute is false, the unicast address may match any of the Ipv4 + * addresses on any interface. */ virtual bool IsDestinationAddress(Ipv4Address address, uint32_t iif) const = 0; @@ -454,20 +454,40 @@ class Ipv4 : public Object */ virtual bool GetIpForward() const = 0; - /** - * \brief Set or unset the Weak Es Model - * - * RFC1122 term for whether host accepts datagram with a dest. address on another interface - * \param model true for Weak Es Model - */ - virtual void SetWeakEsModel(bool model) = 0; /** * \brief Get the Weak Es Model status * * RFC1122 term for whether host accepts datagram with a dest. address on another interface * \returns true for Weak Es Model activated + * \deprecated Deprecated since ns-3.41. Use SetStrongEndSystemModel instead. */ + NS_DEPRECATED_3_41("Use GetStrongEndSystemModel instead") virtual bool GetWeakEsModel() const = 0; + + /** + * \brief Set or unset the Weak Es Model + * + * RFC1122 term for whether host accepts datagram with a dest. address on another interface + * \param model true for Weak Es Model + * \deprecated Deprecated since ns-3.41. Use SetStrongEndSystemModel instead. + */ + NS_DEPRECATED_3_41("Use SetStrongEndSystemModel instead") + virtual void SetWeakEsModel(bool model) = 0; + + /** + * \brief Set or unset the Strong End System Model + * + * RFC1122 term for whether host rejects datagram with a dest. address on another interface + * \param model true for Strong End System Model + */ + virtual void SetStrongEndSystemModel(bool model) = 0; + /** + * \brief Get the Strong End System Model status + * + * RFC1122 term for whether host rejects datagram with a dest. address on another interface + * \returns true for Strong End System Model activated + */ + virtual bool GetStrongEndSystemModel() const = 0; }; } // namespace ns3 diff --git a/src/internet/model/ipv6-l3-protocol.cc b/src/internet/model/ipv6-l3-protocol.cc index 512653ec8..bcf608537 100644 --- a/src/internet/model/ipv6-l3-protocol.cc +++ b/src/internet/model/ipv6-l3-protocol.cc @@ -88,12 +88,6 @@ Ipv6L3Protocol::GetTypeId() MakeBooleanAccessor(&Ipv6L3Protocol::SetSendIcmpv6Redirect, &Ipv6L3Protocol::GetSendIcmpv6Redirect), MakeBooleanChecker()) - .AddAttribute("StrongEndSystemModel", - "Reject packets for an address not configured on the interface they're " - "coming from (RFC1122, section 3.3.4.2).", - BooleanValue(true), - MakeBooleanAccessor(&Ipv6L3Protocol::m_strongEndSystemModel), - MakeBooleanChecker()) .AddTraceSource("Tx", "Send IPv6 packet to outgoing interface.", MakeTraceSourceAccessor(&Ipv6L3Protocol::m_txTrace), @@ -1169,20 +1163,22 @@ Ipv6L3Protocol::Receive(Ptr device, LocalDeliver(packet, hdr, interface); return; } - else if (!m_strongEndSystemModel) + else if (!GetStrongEndSystemModel()) { NS_LOG_LOGIC("For me (destination " - << addr << " match) on another interface with Weak ES Model" + << addr + << " match) on another interface with Weak End System Model" << hdr.GetDestination()); LocalDeliver(packet, hdr, interface); return; } else { - NS_LOG_LOGIC("For me (destination " - << addr - << " match) on another interface with Strong ES Model - discarding" - << hdr.GetDestination()); + NS_LOG_LOGIC( + "For me (destination " + << addr + << " match) on another interface with Strong End System Model - discarding" + << hdr.GetDestination()); m_dropTrace(hdr, packet, DROP_NO_ROUTE, this, interface); return; } @@ -1839,4 +1835,18 @@ Ipv6L3Protocol::ReachabilityHint(uint32_t ipInterfaceIndex, Ipv6Address address) return true; } +void +Ipv6L3Protocol::SetStrongEndSystemModel(bool model) +{ + NS_LOG_FUNCTION(this << model); + m_strongEndSystemModel = model; +} + +bool +Ipv6L3Protocol::GetStrongEndSystemModel() const +{ + NS_LOG_FUNCTION(this); + return m_strongEndSystemModel; +} + } /* namespace ns3 */ diff --git a/src/internet/model/ipv6-l3-protocol.h b/src/internet/model/ipv6-l3-protocol.h index cfbc4942d..8dec87998 100644 --- a/src/internet/model/ipv6-l3-protocol.h +++ b/src/internet/model/ipv6-l3-protocol.h @@ -707,6 +707,9 @@ class Ipv6L3Protocol : public Ipv6 */ virtual bool GetSendIcmpv6Redirect() const; + void SetStrongEndSystemModel(bool model) override; + bool GetStrongEndSystemModel() const override; + /** * \brief Node attached to stack. */ diff --git a/src/internet/model/ipv6.cc b/src/internet/model/ipv6.cc index 1e388606a..f41de0e36 100644 --- a/src/internet/model/ipv6.cc +++ b/src/internet/model/ipv6.cc @@ -47,7 +47,14 @@ Ipv6::GetTypeId() "If disabled, every interface will have its MTU set to 1280 bytes.", BooleanValue(true), MakeBooleanAccessor(&Ipv6::SetMtuDiscover, &Ipv6::GetMtuDiscover), - MakeBooleanChecker()); + MakeBooleanChecker()) + .AddAttribute( + "StrongEndSystemModel", + "Reject packets for an address not configured on the interface they're " + "coming from (RFC1122, section 3.3.4.2).", + BooleanValue(true), + MakeBooleanAccessor(&Ipv6::SetStrongEndSystemModel, &Ipv6::GetStrongEndSystemModel), + MakeBooleanChecker()); return tid; } diff --git a/src/internet/model/ipv6.h b/src/internet/model/ipv6.h index 45e8ee610..99976fd4e 100644 --- a/src/internet/model/ipv6.h +++ b/src/internet/model/ipv6.h @@ -424,6 +424,21 @@ class Ipv6 : public Object * \return MTU discover state (enabled or not) */ virtual bool GetMtuDiscover() const = 0; + + /** + * \brief Set or unset the Strong End System Model + * + * RFC1122 term for whether host rejects datagram with a dest. address on another interface + * \param model true for Strong End System Model + */ + virtual void SetStrongEndSystemModel(bool model) = 0; + /** + * \brief Get the Strong End System Model status + * + * RFC1122 term for whether host rejects datagram with a dest. address on another interface + * \returns true for Strong End System Model activated + */ + virtual bool GetStrongEndSystemModel() const = 0; }; } // namespace ns3