]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: simplify code a bit
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 8 Sep 2021 06:37:48 +0000 (15:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 11 Sep 2021 01:49:11 +0000 (10:49 +0900)
src/network/networkd-address.c

index c0d4e9ae673701a58f114182ebea8d488a36e14d..714fd8ccc2cb86bb2e7e41ccfa5276e648a46c41 100644 (file)
@@ -436,6 +436,7 @@ static int address_add(Link *link, const Address *in, Address **ret) {
 }
 
 static int address_update(Address *address, const Address *src) {
+        Link *link;
         bool ready;
         int r;
 
@@ -443,17 +444,18 @@ static int address_update(Address *address, const Address *src) {
         assert(address->link);
         assert(src);
 
+        link = address->link;
         ready = address_is_ready(address);
 
         address->flags = src->flags;
         address->scope = src->scope;
         address->cinfo = src->cinfo;
 
-        if (IN_SET(address->link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
+        if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
                 return 0;
 
-        link_update_operstate(address->link, true);
-        link_check_ready(address->link);
+        link_update_operstate(link, true);
+        link_check_ready(link);
 
         if (!ready && address_is_ready(address)) {
                 if (address->callback) {
@@ -463,10 +465,10 @@ static int address_update(Address *address, const Address *src) {
                 }
 
                 if (address->family == AF_INET6 &&
-                    in6_addr_is_link_local(&address->in_addr.in6) > 0 &&
-                    in6_addr_is_null(&address->link->ipv6ll_address)) {
+                    in6_addr_is_link_local(&address->in_addr.in6) &&
+                    in6_addr_is_null(&link->ipv6ll_address)) {
 
-                        r = link_ipv6ll_gained(address->link, &address->in_addr.in6);
+                        r = link_ipv6ll_gained(link, &address->in_addr.in6);
                         if (r < 0)
                                 return r;
                 }