1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

in-addr-util: introduce in6_addr_equal()

This commit is contained in:
Yu Watanabe 2021-02-18 02:17:08 +09:00
parent 1235befadd
commit fa55043450
2 changed files with 9 additions and 1 deletions

View File

@ -128,6 +128,13 @@ bool in4_addr_equal(const struct in_addr *a, const struct in_addr *b) {
return a->s_addr == b->s_addr;
}
bool in6_addr_equal(const struct in6_addr *a, const struct in6_addr *b) {
assert(a);
assert(b);
return IN6_ARE_ADDR_EQUAL(a, b);
}
int in_addr_equal(int family, const union in_addr_union *a, const union in_addr_union *b) {
assert(a);
assert(b);
@ -136,7 +143,7 @@ int in_addr_equal(int family, const union in_addr_union *a, const union in_addr_
return in4_addr_equal(&a->in, &b->in);
if (family == AF_INET6)
return IN6_ARE_ADDR_EQUAL(&a->in6, &b->in6);
return in6_addr_equal(&a->in6, &b->in6);
return -EAFNOSUPPORT;
}

View File

@ -54,6 +54,7 @@ bool in4_addr_is_local_multicast(const struct in_addr *a);
bool in4_addr_is_non_local(const struct in_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);
int in_addr_equal(int family, const union in_addr_union *a, const union in_addr_union *b);
int in_addr_prefix_intersect(int family, const union in_addr_union *a, unsigned aprefixlen, const union in_addr_union *b, unsigned bprefixlen);
int in_addr_prefix_next(int family, union in_addr_union *u, unsigned prefixlen);