diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-06 04:14:43 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-07-11 15:37:00 +0200 |
commit | 9a897e22d488e055c3da2e9366a6f2b8154dc591 (patch) | |
tree | d16cf2176fec081a8cb3e08bdebbbee49179ec91 /src/basic/in-addr-util.c | |
parent | network: route_configure() do nothing when it returns 0 (diff) | |
download | systemd-9a897e22d488e055c3da2e9366a6f2b8154dc591.tar.xz systemd-9a897e22d488e055c3da2e9366a6f2b8154dc591.zip |
util: introduce in4_addr_equal()
Diffstat (limited to 'src/basic/in-addr-util.c')
-rw-r--r-- | src/basic/in-addr-util.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/basic/in-addr-util.c b/src/basic/in-addr-util.c index c1fab51b5e..fad239691c 100644 --- a/src/basic/in-addr-util.c +++ b/src/basic/in-addr-util.c @@ -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 |