in-addr-util: use s6_addr* macros everywhere

Currently, the code in in-addr-util.c uses a mix of accessing the
in6_u members directly, as well as using the s6_addr* macros.
Let's unify it so that the s6_addr macros are used everwhere.
This commit is contained in:
Jan Vaclav
2025-05-27 09:55:50 +02:00
committed by Yu Watanabe
parent c5d7a2d000
commit a8a39e23bb

View File

@@ -25,7 +25,7 @@ bool in4_addr_is_null(const struct in_addr *a) {
bool in6_addr_is_null(const struct in6_addr *a) {
assert(a);
return eqzero(a->in6_u.u6_addr32);
return eqzero(a->s6_addr32);
}
int in_addr_is_null(int family, const union in_addr_union *u) {
@@ -63,7 +63,7 @@ bool in4_addr_is_link_local_dynamic(const struct in_addr *a) {
bool in6_addr_is_link_local(const struct in6_addr *a) {
assert(a);
return (a->in6_u.u6_addr32[0] & htobe32(0xffc00000)) == htobe32(0xfe800000);
return (a->s6_addr32[0] & htobe32(0xffc00000)) == htobe32(0xfe800000);
}
int in_addr_is_link_local(int family, const union in_addr_union *u) {
@@ -97,7 +97,7 @@ bool in4_addr_is_multicast(const struct in_addr *a) {
bool in6_addr_is_multicast(const struct in6_addr *a) {
assert(a);
return a->in6_u.u6_addr8[0] == 0xff;
return a->s6_addr[0] == 0xff;
}
int in_addr_is_multicast(int family, const union in_addr_union *u) {