diff --git a/include/netinet/in.h b/include/netinet/in.h index 154f785e2c723..33d35a7a1d8ce 100644 --- a/include/netinet/in.h +++ b/include/netinet/in.h @@ -201,7 +201,7 @@ ((a)->s6_addr[0] == 0xff) #define IN6_IS_ADDR_LINKLOCAL(a) \ - ((a)->s6_addr16[0] & HTONS(0xffc0) == HTONS(0xfe80)) + (((a)->s6_addr16[0] & HTONS(0xffc0)) == HTONS(0xfe80)) #define IN6_IS_ADDR_LOOPBACK(a) \ ((a)->s6_addr32[0] == 0 && \ @@ -215,6 +215,12 @@ (a)->s6_addr32[2] == 0 && \ (a)->s6_addr32[3] == 0) +#define IN6_IS_ADDR_GLOBAL(a) \ + (!IN6_IS_ADDR_MULTICAST(a) && \ + !IN6_IS_ADDR_LINKLOCAL(a) && \ + !IN6_IS_ADDR_LOOPBACK(a) && \ + !IN6_IS_ADDR_UNSPECIFIED(a)) + #define IN6_IS_ADDR_V4COMPAT(a) \ ((a)->s6_addr32[0] == 0 && \ (a)->s6_addr32[1] == 0 && \