mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
util: introduce in4_addr_equal()
This commit is contained in:
parent
661113a2a2
commit
9a897e22d4
@ -91,12 +91,19 @@ int in_addr_is_localhost(int family, const union in_addr_union *u) {
|
||||
return -EAFNOSUPPORT;
|
||||
}
|
||||
|
||||
bool in4_addr_equal(const struct in_addr *a, const struct in_addr *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
return a->s_addr == b->s_addr;
|
||||
}
|
||||
|
||||
int in_addr_equal(int family, const union in_addr_union *a, const union in_addr_union *b) {
|
||||
assert(a);
|
||||
assert(b);
|
||||
|
||||
if (family == AF_INET)
|
||||
return a->in.s_addr == b->in.s_addr;
|
||||
return in4_addr_equal(&a->in, &b->in);
|
||||
|
||||
if (family == AF_INET6)
|
||||
return
|
||||
|
@ -32,6 +32,7 @@ int in_addr_is_localhost(int family, const union in_addr_union *u);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user