]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: address: fix flags and lifetime in debugging logs
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 1 Oct 2021 00:41:02 +0000 (09:41 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 4 Oct 2021 08:59:15 +0000 (17:59 +0900)
Prompted by #20891.

src/network/networkd-address.c

index 37c5c3cc6c67b1fc743c6a8d5ee98cdcc28c3615..b308e9ee62b2937d6eac156bd68671b517582d2c 100644 (file)
@@ -398,7 +398,7 @@ static int address_add(Link *link, Address *address) {
         return 0;
 }
 
-static int address_update(Address *address, const Address *src) {
+static int address_update(Address *address) {
         Link *link;
         int r;
 
@@ -406,11 +406,6 @@ static int address_update(Address *address, const Address *src) {
         assert(address->link);
 
         link = address->link;
-        if (src) {
-                address->flags = src->flags;
-                address->scope = src->scope;
-                address->cinfo = src->cinfo;
-        }
 
         if (address_is_ready(address) &&
             address->family == AF_INET6 &&
@@ -1357,8 +1352,12 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
         switch (type) {
         case RTM_NEWADDR:
                 if (address) {
+                        /* update flags and etc. */
+                        address->flags = tmp->flags;
+                        address->scope = tmp->scope;
+                        address->cinfo = tmp->cinfo;
                         address_enter_configured(address);
-                        log_address_debug(address, "Remembering updated", link);
+                        log_address_debug(address, "Received updated", link);
                 } else {
                         address_enter_configured(tmp);
                         log_address_debug(tmp, "Received new", link);
@@ -1377,7 +1376,7 @@ int manager_rtnl_process_address(sd_netlink *rtnl, sd_netlink_message *message,
                 }
 
                 /* address_update() logs internally, so we don't need to here. */
-                r = address_update(address, tmp);
+                r = address_update(address);
                 if (r < 0)
                         link_enter_failed(link);