mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-08-31 09:50:11 +03:00
Merge pull request #21153 from yuwata/network-lifetime-fix
network: fix lifetime handling
This commit is contained in:
@ -1113,9 +1113,13 @@ int link_request_address(
|
|||||||
if (address_get(link, address, &existing) < 0) {
|
if (address_get(link, address, &existing) < 0) {
|
||||||
_cleanup_(address_freep) Address *tmp = NULL;
|
_cleanup_(address_freep) Address *tmp = NULL;
|
||||||
|
|
||||||
r = address_dup(address, &tmp);
|
if (consume_object)
|
||||||
if (r < 0)
|
tmp = address;
|
||||||
return r;
|
else {
|
||||||
|
r = address_dup(address, &tmp);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
/* Consider address tentative until we get the real flags from the kernel */
|
/* Consider address tentative until we get the real flags from the kernel */
|
||||||
tmp->flags |= IFA_F_TENTATIVE;
|
tmp->flags |= IFA_F_TENTATIVE;
|
||||||
@ -1128,14 +1132,18 @@ int link_request_address(
|
|||||||
} else {
|
} else {
|
||||||
existing->source = address->source;
|
existing->source = address->source;
|
||||||
existing->provider = address->provider;
|
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);
|
r = ipv4acd_configure(existing);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
log_address_debug(address, "Requesting", link);
|
log_address_debug(existing, "Requesting", link);
|
||||||
r = link_queue_request(link, REQUEST_TYPE_ADDRESS, address, consume_object,
|
r = link_queue_request(link, REQUEST_TYPE_ADDRESS, existing, false,
|
||||||
message_counter, netlink_handler, ret);
|
message_counter, netlink_handler, ret);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_warning_errno(link, r, "Failed to request address: %m");
|
return log_link_warning_errno(link, r, "Failed to request address: %m");
|
||||||
|
@ -1572,6 +1572,7 @@ int link_request_route(
|
|||||||
} else {
|
} else {
|
||||||
existing->source = route->source;
|
existing->source = route->source;
|
||||||
existing->provider = route->provider;
|
existing->provider = route->provider;
|
||||||
|
existing->lifetime_usec = route->lifetime_usec;
|
||||||
if (consume_object)
|
if (consume_object)
|
||||||
route_free(route);
|
route_free(route);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user