RFC 3849 - IPv6 Address Prefix Reserved for Documentation
This commit is contained in:
@@ -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 ();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user