1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-27 14:03:43 +03:00

Merge pull request #19894 from yuwata/network-fix-configure-without-carrier

network: always check dynamic address assignments before entering con…
This commit is contained in:
Luca Boccassi 2021-06-14 14:23:09 +01:00 committed by GitHub
commit feaf43158a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 41 deletions

View File

@ -469,13 +469,14 @@ void link_check_ready(Link *link) {
if (!link->sr_iov_configured)
return (void) log_link_debug(link, "%s(): SR-IOV is not configured.", __func__);
if (link_has_carrier(link) || !link->network->configure_without_carrier) {
bool has_ndisc_address = false;
NDiscAddress *n;
if (link_ipv6ll_enabled(link) && !in6_addr_is_set(&link->ipv6ll_address))
/* IPv6LL is assigned after the link gains its carrier. */
if (!link->network->configure_without_carrier &&
link_ipv6ll_enabled(link) &&
!in6_addr_is_set(&link->ipv6ll_address))
return (void) log_link_debug(link, "%s(): IPv6LL is not configured yet.", __func__);
bool has_ndisc_address = false;
NDiscAddress *n;
SET_FOREACH(n, link->ndisc_addresses)
if (!n->marked) {
has_ndisc_address = true;
@ -488,8 +489,11 @@ void link_check_ready(Link *link) {
/* When DHCP[46] or IPv4LL is enabled, at least one address is acquired by them. */
return (void) log_link_debug(link, "%s(): DHCP4, DHCP6 or IPv4LL is enabled but no dynamic address is assigned yet.", __func__);
/* Ignore NDisc when ConfigureWithoutCarrier= is enabled, as IPv6AcceptRA= is enabled by default. */
if (link_dhcp4_enabled(link) || link_dhcp6_enabled(link) || link_dhcp6_pd_is_enabled(link) ||
link_ipv6_accept_ra_enabled(link) || link_ipv4ll_enabled(link)) {
(!link->network->configure_without_carrier && link_ipv6_accept_ra_enabled(link)) ||
link_ipv4ll_enabled(link)) {
if (!link->dhcp4_configured &&
!(link->dhcp6_address_configured && link->dhcp6_route_configured) &&
!(link->dhcp6_pd_address_configured && link->dhcp6_pd_route_configured) &&
@ -509,7 +513,6 @@ void link_check_ready(Link *link) {
yes_no(link->ndisc_addresses_configured),
yes_no(link->ndisc_routes_configured));
}
}
link_set_state(link, LINK_STATE_CONFIGURED);
}

View File

@ -2,6 +2,5 @@
Name=bridge99
[Network]
LinkLocalAddressing=yes
IPv6AcceptRA=no
ConfigureWithoutCarrier=yes

View File

@ -4,3 +4,4 @@ Name=test1
[Network]
Address=192.168.0.15/24
Gateway=192.168.0.1
IPv6AcceptRA=no

View File

@ -2044,7 +2044,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
with self.subTest(carrier=carrier):
if carrier_map[carrier] != read_link_attr('test1', 'carrier'):
check_output(f'ip link set dev test1 carrier {carrier}')
self.wait_online([f'test1:{routable_map[carrier]}'])
self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
print(output)
@ -2068,7 +2068,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
with self.subTest(carrier=carrier, have_config=have_config):
if carrier_map[carrier] != read_link_attr('test1', 'carrier'):
check_output(f'ip link set dev test1 carrier {carrier}')
self.wait_online([f'test1:{routable_map[carrier]}'])
self.wait_online([f'test1:{routable_map[carrier]}:{routable_map[carrier]}'])
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
print(output)