From 372e8592c6e3a891174344be0899a91769ef61af Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 13 Dec 2021 20:14:06 +0900 Subject: [PATCH] wait-online: also use address state even when operational state is below degraded Closes #21706. --- man/systemd-networkd-wait-online.service.xml | 16 ++++++++++++---- src/network/wait-online/manager.c | 6 ++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/man/systemd-networkd-wait-online.service.xml b/man/systemd-networkd-wait-online.service.xml index 31aa02218af..9c6b02ac1c8 100644 --- a/man/systemd-networkd-wait-online.service.xml +++ b/man/systemd-networkd-wait-online.service.xml @@ -92,8 +92,12 @@ Waiting for an IPv4 address of each network interface to be configured. If this option is specified with , then systemd-networkd-wait-online exits with success when at least one interface - becomes online and has an IPv4 address. The option is applied only for the operational state - degraded or above. If neither nor + becomes online and has an IPv4 address. If the required minimum operational state is + below routable, then each link (or at least one link with + ) must have an IPv4 link-local or routable address. If the required + minimum operational state is routable, then each link must have an IPv4 + routable address. + If neither nor is specified, then the value from RequiredFamilyForOnline= in the corresponding .network file is used if present. @@ -106,8 +110,12 @@ Waiting for an IPv6 address of each network interface to be configured. If this option is specified with , then systemd-networkd-wait-online exits with success when at least one interface - becomes online and has an IPv6 address. The option is applied only for the operational state - degraded or above. If neither nor + becomes online and has an IPv6 address. If the required minimum operational state is + below routable, then each link (or at least one link with + ) must have an IPv6 link-local or routable address. If the required + minimum operational state is routable, then each link must have an IPv6 + routable address. + If neither nor is specified, then the value from RequiredFamilyForOnline= in the corresponding .network file is used if present. diff --git a/src/network/wait-online/manager.c b/src/network/wait-online/manager.c index e1df0345c0d..3890e92b61c 100644 --- a/src/network/wait-online/manager.c +++ b/src/network/wait-online/manager.c @@ -71,7 +71,7 @@ static int manager_link_is_online(Manager *m, Link *l, LinkOperationalStateRange needs_ipv4 = required_family & ADDRESS_FAMILY_IPV4; needs_ipv6 = required_family & ADDRESS_FAMILY_IPV6; - if (s.min >= LINK_OPERSTATE_DEGRADED) { + if (s.min < LINK_OPERSTATE_ROUTABLE) { if (needs_ipv4 && l->ipv4_address_state < LINK_ADDRESS_STATE_DEGRADED) { log_link_debug(l, "No routable or link-local IPv4 address is configured."); return 0; @@ -81,9 +81,7 @@ static int manager_link_is_online(Manager *m, Link *l, LinkOperationalStateRange log_link_debug(l, "No routable or link-local IPv6 address is configured."); return 0; } - } - - if (s.min >= LINK_OPERSTATE_ROUTABLE) { + } else { if (needs_ipv4 && l->ipv4_address_state < LINK_ADDRESS_STATE_ROUTABLE) { log_link_debug(l, "No routable IPv4 address is configured."); return 0; -- 2.39.5