--- a/CHANGES.html Sun Mar 25 13:45:55 2012 +0200
+++ b/CHANGES.html Sun Mar 25 14:26:45 2012 +0200
@@ -78,6 +78,11 @@
Ipv6RoutingHelper can now print the IPv6 Routing Tables at specific
intervals or time. Exactly like Ipv4RoutingHelper do.
</li>
+<li>
+New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
+Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
+i.e., enable/disable the ICMPv6 Redirect sending.
+</li>
</ul>
<h2>Changes to build system:</h2>
--- a/RELEASE_NOTES Sun Mar 25 13:45:55 2012 +0200
+++ b/RELEASE_NOTES Sun Mar 25 14:26:45 2012 +0200
@@ -27,6 +27,9 @@
- Ipv6RoutingHelper is now in-line with Ipv4RoutingHelper concerning the RT
print functions. Various minor changes made in Ipv6RoutingProtocol and derived
classes to make this possible.
+- New "SendIcmpv6Redirect" attribute (and getter/setter functions) to
+ Ipv6L3Protocol. The behavior is similar to Linux's conf "send_redirects",
+ i.e., enable/disable the ICMPv6 Redirect sending.
Bugs fixed
----------
--- a/src/internet/model/ipv6-l3-protocol.cc Sun Mar 25 13:45:55 2012 +0200
+++ b/src/internet/model/ipv6-l3-protocol.cc Sun Mar 25 14:26:45 2012 +0200
@@ -22,6 +22,7 @@
#include "ns3/node.h"
#include "ns3/uinteger.h"
#include "ns3/vector.h"
+#include "ns3/boolean.h"
#include "ns3/callback.h"
#include "ns3/trace-source-accessor.h"
#include "ns3/object-vector.h"
@@ -62,6 +63,11 @@
ObjectVectorValue (),
MakeObjectVectorAccessor (&Ipv6L3Protocol::m_interfaces),
MakeObjectVectorChecker<Ipv6Interface> ())
+ .AddAttribute ("SendIcmpv6Redirect", "Send the ICMPv6 Redirect when appropriate.",
+ BooleanValue (true),
+ MakeBooleanAccessor (&Ipv6L3Protocol::SetSendIcmpv6Redirect,
+ &Ipv6L3Protocol::GetSendIcmpv6Redirect),
+ MakeBooleanChecker ())
.AddTraceSource ("Tx", "Send IPv6 packet to outgoing interface.",
MakeTraceSourceAccessor (&Ipv6L3Protocol::m_txTrace))
.AddTraceSource ("Rx", "Receive IPv6 packet from incoming interface.",
@@ -492,6 +498,18 @@
return m_ipForward;
}
+void Ipv6L3Protocol::SetSendIcmpv6Redirect (bool sendIcmpv6Redirect)
+{
+ NS_LOG_FUNCTION (this << sendIcmpv6Redirect);
+ m_sendIcmpv6Redirect = sendIcmpv6Redirect;
+}
+
+bool Ipv6L3Protocol::GetSendIcmpv6Redirect () const
+{
+ NS_LOG_FUNCTION_NOARGS ();
+ return m_sendIcmpv6Redirect;
+}
+
void Ipv6L3Protocol::NotifyNewAggregate ()
{
NS_LOG_FUNCTION_NOARGS ();
@@ -878,8 +896,10 @@
* we send him an ICMPv6 redirect message to notify him that a short route
* exists.
*/
- if ((!rtentry->GetGateway ().IsAny () && rtentry->GetGateway ().CombinePrefix (Ipv6Prefix (64)) == header.GetSourceAddress ().CombinePrefix (Ipv6Prefix (64)))
- || (rtentry->GetDestination ().CombinePrefix (Ipv6Prefix (64)) == header.GetSourceAddress ().CombinePrefix (Ipv6Prefix (64))))
+
+ if (m_sendIcmpv6Redirect &&
+ ((!rtentry->GetGateway ().IsAny () && rtentry->GetGateway ().CombinePrefix (Ipv6Prefix (64)) == header.GetSourceAddress ().CombinePrefix (Ipv6Prefix (64)))
+ || (rtentry->GetDestination ().CombinePrefix (Ipv6Prefix (64)) == header.GetSourceAddress ().CombinePrefix (Ipv6Prefix (64)))))
{
NS_LOG_LOGIC ("ICMPv6 redirect!");
Ptr<Icmpv6L4Protocol> icmpv6 = GetIcmpv6 ();
--- a/src/internet/model/ipv6-l3-protocol.h Sun Mar 25 13:45:55 2012 +0200
+++ b/src/internet/model/ipv6-l3-protocol.h Sun Mar 25 14:26:45 2012 +0200
@@ -469,6 +469,18 @@
virtual bool GetIpForward () const;
/**
+ * \brief Set the ICMPv6 Redirect sending state.
+ * \param sendIcmpv6Redirect ICMPv6 Redirect sending enabled or not
+ */
+ virtual void SetSendIcmpv6Redirect (bool sendIcmpv6Redirect);
+
+ /**
+ * \brief Get the ICMPv6 Redirect sending state.
+ * \return ICMPv6 Redirect sending state (enabled or not)
+ */
+ virtual bool GetSendIcmpv6Redirect () const;
+
+ /**
* \brief Node attached to stack.
*/
Ptr<Node> m_node;
@@ -512,6 +524,11 @@
* \brief List of IPv6 prefix received from RA.
*/
Ipv6AutoconfiguredPrefixList m_prefixes;
+
+ /**
+ * \brief Allow ICMPv6 Redirect sending state
+ */
+ bool m_sendIcmpv6Redirect;
};
} /* namespace ns3 */