summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-10-27 21:52:25 +0200
committerGitHub <noreply@github.com>2021-10-27 21:52:25 +0200
commit593524af5dc175c0fcbd7f6e033456cf3494e524 (patch)
treefe1c37818eadca601c3f3e765ce0e8e89b20fb04 /src
parentsystemctl: drop redundant "else" (diff)
parentnetwork: route: update lifetime of existing route (diff)
downloadsystemd-593524af5dc175c0fcbd7f6e033456cf3494e524.tar.xz
systemd-593524af5dc175c0fcbd7f6e033456cf3494e524.zip
Merge pull request #21153 from yuwata/network-lifetime-fix
network: fix lifetime handling
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-address.c18
-rw-r--r--src/network/networkd-route.c1
2 files changed, 14 insertions, 5 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index a89bdcac95..5ef38bc476 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -1113,9 +1113,13 @@ int link_request_address(
if (address_get(link, address, &existing) < 0) {
_cleanup_(address_freep) Address *tmp = NULL;
- r = address_dup(address, &tmp);
- if (r < 0)
- return r;
+ if (consume_object)
+ tmp = address;
+ else {
+ r = address_dup(address, &tmp);
+ if (r < 0)
+ return r;
+ }
/* Consider address tentative until we get the real flags from the kernel */
tmp->flags |= IFA_F_TENTATIVE;
@@ -1128,14 +1132,18 @@ int link_request_address(
} else {
existing->source = address->source;
existing->provider = address->provider;
+ existing->lifetime_valid_usec = address->lifetime_valid_usec;
+ existing->lifetime_preferred_usec = address->lifetime_preferred_usec;
+ if (consume_object)
+ address_free(address);
}
r = ipv4acd_configure(existing);
if (r < 0)
return r;
- log_address_debug(address, "Requesting", link);
- r = link_queue_request(link, REQUEST_TYPE_ADDRESS, address, consume_object,
+ log_address_debug(existing, "Requesting", link);
+ r = link_queue_request(link, REQUEST_TYPE_ADDRESS, existing, false,
message_counter, netlink_handler, ret);
if (r < 0)
return log_link_warning_errno(link, r, "Failed to request address: %m");
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index e5c95d734e..9ee89a671f 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1572,6 +1572,7 @@ int link_request_route(
} else {
existing->source = route->source;
existing->provider = route->provider;
+ existing->lifetime_usec = route->lifetime_usec;
if (consume_object)
route_free(route);
}