net: ipv6: add function checking if given address is ULA
This patch adds a helper function to verify if given IPv6 address is a unique local address. Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
This commit is contained in:
parent
fe6266ea7d
commit
9831ddd14b
@ -763,6 +763,18 @@ static inline bool net_ipv6_is_ll_addr(const struct in6_addr *addr)
|
||||
return UNALIGNED_GET(&addr->s6_addr16[0]) == htons(0xFE80);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given IPv6 address is a unique local address.
|
||||
*
|
||||
* @param addr A valid pointer on an IPv6 address
|
||||
*
|
||||
* @return True if it is, false otherwise.
|
||||
*/
|
||||
static inline bool net_ipv6_is_ula_addr(const struct in6_addr *addr)
|
||||
{
|
||||
return addr->s6_addr[0] == 0xFD;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return pointer to any (all bits zeros) IPv6 address.
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user