patch #7912 by Grant Erickson: Add a macro for introspecting the IPv6 loopback address.

This commit is contained in:
Simon Goldschmidt 2014-01-16 21:50:53 +01:00
parent 94eff945b4
commit 8b63a89267

View File

@ -170,6 +170,10 @@ Little-endian version, stored in network order (no htonl). */
((ip6addr)->addr[2] == 0) && \
((ip6addr)->addr[3] == 0)))
#define ip6_addr_isloopback(ip6addr) (((ip6addr)->addr[0] == 0UL) && \
((ip6addr)->addr[1] == 0UL) && \
((ip6addr)->addr[2] == 0UL) && \
((ip6addr)->addr[3] == PP_HTONL(0x00000001UL)))
#define ip6_addr_isglobal(ip6addr) (((ip6addr)->addr[0] & PP_HTONL(0xe0000000UL)) == PP_HTONL(0x20000000UL))