1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-25 10:04:04 +03:00

network: store IPv6LL address even if link is in failed state

Otherwise, if IPv6LL is received when the link is in failed state,
we may fail to reconfigure the link.
This commit is contained in:
Yu Watanabe 2021-09-08 15:52:53 +09:00
parent 7a8685ffef
commit 7657ec3eb8
3 changed files with 21 additions and 21 deletions

View File

@ -451,6 +451,18 @@ static int address_update(Address *address, const Address *src) {
address->scope = src->scope;
address->cinfo = src->cinfo;
if (address_is_ready(address) &&
address->family == AF_INET6 &&
in6_addr_is_link_local(&address->in_addr.in6) &&
in6_addr_is_null(&link->ipv6ll_address)) {
link->ipv6ll_address = address->in_addr.in6;
r = link_ipv6ll_gained(link);
if (r < 0)
return r;
}
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
return 0;
@ -467,15 +479,6 @@ static int address_update(Address *address, const Address *src) {
if (r < 0)
return r;
}
if (address->family == AF_INET6 &&
in6_addr_is_link_local(&address->in_addr.in6) &&
in6_addr_is_null(&link->ipv6ll_address)) {
r = link_ipv6ll_gained(link, &address->in_addr.in6);
if (r < 0)
return r;
}
}
return 0;

View File

@ -701,24 +701,21 @@ static int link_acquire_dynamic_conf(Link *link) {
return 0;
}
int link_ipv6ll_gained(Link *link, const struct in6_addr *address) {
int link_ipv6ll_gained(Link *link) {
int r;
assert(link);
log_link_info(link, "Gained IPv6LL");
link->ipv6ll_address = *address;
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
return 0;
r = link_acquire_dynamic_ipv6_conf(link);
if (r < 0)
return r;
link_check_ready(link);
if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) {
r = link_acquire_dynamic_ipv6_conf(link);
if (r < 0) {
link_enter_failed(link);
return r;
}
}
return 0;
}

View File

@ -236,7 +236,7 @@ bool link_has_carrier(Link *link);
bool link_ipv6_enabled(Link *link);
bool link_ipv6ll_enabled(Link *link);
int link_ipv6ll_gained(Link *link, const struct in6_addr *address);
int link_ipv6ll_gained(Link *link);
bool link_ipv4ll_enabled(Link *link);