RFC 3849 - IPv6 Address Prefix Reserved for Documentation
authorTommaso Pecorella <tommaso.pecorella@unifi.it>
Wed, 10 Jul 2013 00:06:35 +0200
changeset 9919 5596934962c2
parent 9918 dc9ec9fb4578
child 9920 e90d966ba939
RFC 3849 - IPv6 Address Prefix Reserved for Documentation
CHANGES.html
RELEASE_NOTES
src/internet/model/ipv6-l3-protocol.cc
src/network/utils/ipv6-address.cc
src/network/utils/ipv6-address.h
--- a/CHANGES.html	Tue Jul 09 22:49:30 2013 +0200
+++ b/CHANGES.html	Wed Jul 10 00:06:35 2013 +0200
@@ -60,6 +60,9 @@
 
 <h2>Changes to existing API:</h2>
 <ul>
+  <li> The documentation's IPv6 addresses (2001:db8::/32, RFC 3849) are now
+  dropped by routers.
+  </li>
   <li> The 'src/tools' module has been removed, and most files migrated to
   'src/stats'.  For users of these programs (the statistics-processing 
   in average.h, or the gnuplot support), the main change is likely to be
--- a/RELEASE_NOTES	Tue Jul 09 22:49:30 2013 +0200
+++ b/RELEASE_NOTES	Wed Jul 10 00:06:35 2013 +0200
@@ -22,6 +22,7 @@
 New user-visible features
 -------------------------
 - Time attributes can now be bounded.  See attribute-test-suite.cc for an example.
+- IPv6 addrss class 2001:db8::/32 is now dropped by routers (RFC 3849).
 
 Bugs fixed
 ----------
--- a/src/internet/model/ipv6-l3-protocol.cc	Tue Jul 09 22:49:30 2013 +0200
+++ b/src/internet/model/ipv6-l3-protocol.cc	Wed Jul 10 00:06:35 2013 +0200
@@ -924,6 +924,14 @@
   NS_LOG_FUNCTION (this << rtentry << p << header);
   NS_LOG_LOGIC ("Forwarding logic for node: " << m_node->GetId ());
 
+  // Drop RFC 3849 packets: 2001:db8::/32
+  if (header.GetDestinationAddress().IsDocumentation())
+    {
+      NS_LOG_WARN ("Received a packet for 2001:db8::/32 (documentation class).  Drop.");
+      m_dropTrace (header, p, DROP_ROUTE_ERROR, m_node->GetObject<Ipv6> (), 0);
+      return;
+    }
+
   // Forwarding
   Ipv6Header ipHeader = header;
   Ptr<Packet> packet = p->Copy ();
--- a/src/network/utils/ipv6-address.cc	Tue Jul 09 22:49:30 2013 +0200
+++ b/src/network/utils/ipv6-address.cc	Wed Jul 10 00:06:35 2013 +0200
@@ -522,6 +522,19 @@
   return (*this == any);
 }
 
+
+bool Ipv6Address::IsDocumentation () const
+{
+  NS_LOG_FUNCTION (this);
+  Ipv6Address documentation ("2001:db8::0");
+  if (((Ipv6Address*)this)->CombinePrefix (Ipv6Prefix (32)) == documentation)
+    {
+      return true;
+    }
+  return false;
+}
+
+
 bool Ipv6Address::IsMatchingType (const Address& address)
 {
   NS_LOG_FUNCTION (address);
--- a/src/network/utils/ipv6-address.h	Tue Jul 09 22:49:30 2013 +0200
+++ b/src/network/utils/ipv6-address.h	Wed Jul 10 00:06:35 2013 +0200
@@ -213,6 +213,12 @@
   bool IsAny () const;
 
   /**
+   * \brief If the IPv6 address is a documentation address (2001:DB8::/32).
+   * \return true if the address is documentation, false otherwise
+   */
+  bool IsDocumentation () const;
+
+  /**
    * \brief Combine this address with a prefix.
    * \param prefix a IPv6 prefix
    * \return an IPv6 address that is this address combined