]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
in-addr-util: use s6_addr* macros everywhere
authorJan Vaclav <jvaclav@redhat.com>
Tue, 27 May 2025 07:55:50 +0000 (09:55 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 May 2025 13:33:57 +0000 (22:33 +0900)
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.

src/basic/in-addr-util.c

index aded2b93abfc175effa04785de8899caf384d4ea..a47bdf7149121d90274fd73549af72588feb2d58 100644 (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) {