network: add a function to detect IPv4 APIPA addresses
This commit is contained in:
@@ -16,6 +16,8 @@ This file is a best-effort approach to solving this issue; we will do our best b
|
||||
|
||||
### New API
|
||||
|
||||
* (network) Added a function to detect IPv4 APIPA addresses (169.254.0.0/16).
|
||||
|
||||
### Changes to existing API
|
||||
|
||||
* (internet-apps) Added a parameter to the RADVD helper to announce a prefix without the autoconfiguration flag.
|
||||
|
||||
@@ -281,6 +281,14 @@ Ipv4Address::IsLocalMulticast() const
|
||||
return (m_address & 0xffffff00) == 0xe0000000;
|
||||
}
|
||||
|
||||
bool
|
||||
Ipv4Address::IsLinkLocal() const
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
// Link-Local address is 169.254.0.0/16
|
||||
return (m_address & 0xffff0000) == 0xa9fe0000;
|
||||
}
|
||||
|
||||
void
|
||||
Ipv4Address::Serialize(uint8_t buf[4]) const
|
||||
{
|
||||
|
||||
@@ -112,6 +112,14 @@ class Ipv4Address
|
||||
* @return true only if address is in local multicast address scope, 224.0.0.0/24
|
||||
*/
|
||||
bool IsLocalMulticast() const;
|
||||
/**
|
||||
* @brief If the IPv4 address is an APIPA address (169.254/16).
|
||||
*
|
||||
* The Automatic Private IP Address is described in \RFC{3927}
|
||||
*
|
||||
* @return true if the address is link-local, false otherwise
|
||||
*/
|
||||
bool IsLinkLocal() const;
|
||||
/**
|
||||
* @brief Combine this address with a network mask
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user