wait-online: Support waiting for interfaces to disappear

This commit is contained in:
Daan De Meyer 2020-01-14 14:08:03 +01:00 committed by Daan De Meyer
parent 75cd4a5d92
commit 5cbaf95ee3
4 changed files with 14 additions and 1 deletions

View File

@ -69,6 +69,12 @@
<para>The operational status is one of the following:
<variablelist>
<varlistentry>
<term>missing</term>
<listitem>
<para>the device is missing</para>
</listitem>
</varlistentry>
<varlistentry>
<term>off</term>
<listitem>

View File

@ -26,6 +26,7 @@ bool network_is_online(void) {
}
static const char* const link_operstate_table[_LINK_OPERSTATE_MAX] = {
[LINK_OPERSTATE_MISSING] = "missing",
[LINK_OPERSTATE_OFF] = "off",
[LINK_OPERSTATE_NO_CARRIER] = "no-carrier",
[LINK_OPERSTATE_DORMANT] = "dormant",
@ -91,7 +92,7 @@ int parse_operational_state_range(const char *str, LinkOperationalStateRange *ou
return -EINVAL;
if (range.min == _LINK_OPERSTATE_INVALID)
range.min = LINK_OPERSTATE_OFF;
range.min = LINK_OPERSTATE_MISSING;
if (range.max == _LINK_OPERSTATE_INVALID)
range.max = LINK_OPERSTATE_ROUTABLE;

View File

@ -8,6 +8,7 @@
bool network_is_online(void);
typedef enum LinkOperationalState {
LINK_OPERSTATE_MISSING,
LINK_OPERSTATE_OFF,
LINK_OPERSTATE_NO_CARRIER,
LINK_OPERSTATE_DORMANT,

View File

@ -78,6 +78,11 @@ bool manager_configured(Manager *m) {
LinkOperationalStateRange *range = p;
l = hashmap_get(m->links_by_name, ifname);
if (!l && range->min == LINK_OPERSTATE_MISSING) {
one_ready = true;
continue;
}
if (!l) {
log_debug("still waiting for %s", ifname);
if (!m->any)