1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-26 08:55:18 +03:00

wait-online: also use address state even when operational state is below degraded

Closes #21706.
This commit is contained in:
Yu Watanabe 2021-12-13 20:14:06 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent b4bb96f3f2
commit 372e8592c6
2 changed files with 14 additions and 8 deletions

View File

@ -92,8 +92,12 @@
<listitem><para>Waiting for an IPv4 address of each network interface to be configured. If this
option is specified with <option>--any</option>, then
<command>systemd-networkd-wait-online</command> exits with success when at least one interface
becomes online and has an IPv4 address. The option is applied only for the operational state
<literal>degraded</literal> or above. If neither <option>--ipv4</option> nor
becomes online and has an IPv4 address. If the required minimum operational state is
below <literal>routable</literal>, then each link (or at least one link with
<option>--any</option>) must have an IPv4 link-local or routable address. If the required
minimum operational state is <literal>routable</literal>, then each link must have an IPv4
routable address.</para>
<para>If neither <option>--ipv4</option> nor
<option>--ipv6</option> is specified, then the value from
<varname>RequiredFamilyForOnline=</varname> in the corresponding <filename>.network</filename>
file is used if present.</para></listitem>
@ -106,8 +110,12 @@
<listitem><para>Waiting for an IPv6 address of each network interface to be configured. If this
option is specified with <option>--any</option>, then
<command>systemd-networkd-wait-online</command> exits with success when at least one interface
becomes online and has an IPv6 address. The option is applied only for the operational state
<literal>degraded</literal> or above. If neither <option>--ipv4</option> nor
becomes online and has an IPv6 address. If the required minimum operational state is
below <literal>routable</literal>, then each link (or at least one link with
<option>--any</option>) must have an IPv6 link-local or routable address. If the required
minimum operational state is <literal>routable</literal>, then each link must have an IPv6
routable address.</para>
<para>If neither <option>--ipv4</option> nor
<option>--ipv6</option> is specified, then the value from
<varname>RequiredFamilyForOnline=</varname> in the corresponding <filename>.network</filename>
file is used if present.</para></listitem>

View File

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