diff options
Diffstat (limited to 'lib/ip.h')
-rw-r--r-- | lib/ip.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -226,6 +226,9 @@ int ip6_compare(ip6_addr a, ip6_addr b); int ip4_classify(ip4_addr ad); int ip6_classify(ip6_addr *a); +static inline int ip4_is_link_local(ip6_addr a) +{ return (_I3(a) & 0xffff0000) == 0xa9fe0000; } + static inline int ip6_is_link_local(ip6_addr a) { return (_I0(a) & 0xffc00000) == 0xfe800000; } @@ -233,7 +236,7 @@ static inline int ip6_is_v4mapped(ip6_addr a) { return _I0(a) == 0 && _I1(a) == 0 && _I2(a) == 0xffff; } #define ipa_classify(x) ip6_classify(&(x)) -#define ipa_is_link_local(x) ip6_is_link_local(x) +#define ipa_is_link_local(x) (ipa_is_ip4(x) ? ip4_is_link_local(x) : ip6_is_link_local(x)) static inline int ip4_is_unicast(ip4_addr a) { return _I(a) < 0xe0000000; } |