1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-07 17:17:44 +03:00

Merge pull request #21153 from yuwata/network-lifetime-fix

network: fix lifetime handling
This commit is contained in:
Yu Watanabe 2021-10-28 04:52:25 +09:00 committed by GitHub
commit 593524af5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 5 deletions

View File

@ -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");

View File

@ -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);
}