RFC 3849 - IPv6 Address Prefix Reserved for Documentation

This commit is contained in:
Tommaso Pecorella
2013-07-10 00:06:35 +02:00
parent f2cd231aec
commit 6550570e50
5 changed files with 31 additions and 0 deletions

View File

@@ -60,6 +60,9 @@ us a note on ns-developers mailing list.</p>
<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

View File

@@ -22,6 +22,7 @@ Supported platforms
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
----------

View File

@@ -924,6 +924,14 @@ void Ipv6L3Protocol::IpForward (Ptr<const NetDevice> idev, Ptr<Ipv6Route> rtentr
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 ();

View File

@@ -522,6 +522,19 @@ bool Ipv6Address::IsAny () const
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);

View File

@@ -212,6 +212,12 @@ public:
*/
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