diff options
author | Tom Gundersen <teg@jklm.no> | 2015-01-29 07:34:34 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-01-31 15:26:08 +0100 |
commit | 79b1f37d95f08fe7620b071eec51d2810ed077c9 (patch) | |
tree | a80e71691b9b8dd57639c5d5351a41a154dec1c7 /src/network/networkd-wait-online-manager.c | |
parent | 233ba5c3a0f73e01fe6149fd8c377826a83c2a0a (diff) |
networkd-wait-online: allow specific devices to be ignored
In addition to the loopback device, also explicitly configured devices to be ignored.
Suggested by Charles Devereaux <systemd@guylhem.net>.
Diffstat (limited to 'src/network/networkd-wait-online-manager.c')
-rw-r--r-- | src/network/networkd-wait-online-manager.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c index 6f392febe7..c66470c3e2 100644 --- a/src/network/networkd-wait-online-manager.c +++ b/src/network/networkd-wait-online-manager.c @@ -31,6 +31,19 @@ #include "util.h" +bool manager_ignore_link(Manager *m, Link *link) { + assert(m); + assert(link); + + if (link->flags & IFF_LOOPBACK) + return true; + + if (strv_contains(m->ignore, link->ifname)) + return true; + + return false; +} + bool manager_all_configured(Manager *m) { Iterator i; Link *l; @@ -49,8 +62,8 @@ bool manager_all_configured(Manager *m) { /* wait for all links networkd manages to be in admin state 'configured' and at least one link to gain a carrier */ HASHMAP_FOREACH(l, m->links, i) { - if (!link_relevant(l)) { - log_info("ignore irrelevant link: %s", l->ifname); + if (manager_ignore_link(m, l)) { + log_info("ignoring: %s", l->ifname); continue; } @@ -245,7 +258,7 @@ static int manager_network_monitor_listen(Manager *m) { return 0; } -int manager_new(Manager **ret, char **interfaces) { +int manager_new(Manager **ret, char **interfaces, char **ignore) { _cleanup_(manager_freep) Manager *m = NULL; int r; @@ -256,6 +269,7 @@ int manager_new(Manager **ret, char **interfaces) { return -ENOMEM; m->interfaces = interfaces; + m->ignore = ignore; r = sd_event_default(&m->event); if (r < 0) |