diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2018-09-12 23:03:27 +0000 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2019-02-27 21:28:38 +0100 |
commit | b8c0bc361f4a869a2bb96cd9641d88becbc3296e (patch) | |
tree | eee69eaf09ce7e38b5b292f2f4289409944733c7 /lib/ip.h | |
parent | 7c36eb3e8bd7d06f65dc7319d42b6abe782c5b89 (diff) |
link-local: WIPold/ipv4-link-local
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; } |