in-addr-util: introduce in6_addr_is_ipv4_mapped_address()

This commit is contained in:
Yu Watanabe
2021-06-08 06:33:27 +09:00
parent 9a038aaced
commit c3e960883f
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -121,6 +121,12 @@ int in_addr_is_localhost(int family, const union in_addr_union *u) {
return -EAFNOSUPPORT;
}
bool in6_addr_is_ipv4_mapped_address(const struct in6_addr *a) {
return a->s6_addr32[0] == 0 &&
a->s6_addr32[1] == 0 &&
a->s6_addr32[2] == htobe32(UINT32_C(0x0000ffff));
}
bool in4_addr_equal(const struct in_addr *a, const struct in_addr *b) {
assert(a);
assert(b);
+1
View File
@@ -58,6 +58,7 @@ int in_addr_is_localhost(int family, const union in_addr_union *u);
bool in4_addr_is_local_multicast(const struct in_addr *a);
bool in4_addr_is_non_local(const struct in_addr *a);
bool in6_addr_is_ipv4_mapped_address(const struct in6_addr *a);
bool in4_addr_equal(const struct in_addr *a, const struct in_addr *b);
bool in6_addr_equal(const struct in6_addr *a, const struct in6_addr *b);