Fix networkd-wait-online -i to properly wait for the given interfaces only

Patches taken from https://github.com/systemd/systemd/pull/761, will go
upstream soon.
This commit is contained in:
Martin Pitt 2015-07-29 15:43:05 +02:00
parent 338ed8207e
commit 6bd4a3e1ff
4 changed files with 73 additions and 0 deletions

2
debian/changelog vendored
View File

@ -26,6 +26,8 @@ systemd (223-1) UNRELEASED; urgency=medium
* systemd.postinst: Avoid confusing error message about
/run/systemd/was-enabled not existing on reconfiguring.
* debian/extra/initramfs-tools/hooks/udev: Drop some redundant code.
* Fix networkd-wait-online -i to properly wait for the given interfaces
only.
[ Julian Wollrath ]
* Copy all .link interface naming definitions to initramfs. (Closes: #793374)

View File

@ -0,0 +1,24 @@
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 29 Jul 2015 01:34:35 +0200
Subject: networkd-wait-online: fix race
We must consider 'pending' links as if they may be managed by networkd, as this
is the state we enter before deciding wether networkd should manage the link
or not, so we better wait for this decision being made.
---
src/network/networkd-wait-online-manager.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c
index ec44893..9283f57 100644
--- a/src/network/networkd-wait-online-manager.c
+++ b/src/network/networkd-wait-online-manager.c
@@ -83,7 +83,7 @@ bool manager_all_configured(Manager *m) {
return false;
}
- if (streq(l->state, "configuring")) {
+ if (STR_IN_SET(l->state, "configuring", "pending")) {
log_debug("link %s is being processed by networkd",
l->ifname);
return false;

View File

@ -0,0 +1,45 @@
From: Tom Gundersen <teg@jklm.no>
Date: Wed, 29 Jul 2015 01:41:24 +0200
Subject: networkd-wait-online: only consider interfaces given on the
commandline
If some interfaces are given on the commandline, ignore all others.
---
man/systemd-networkd-wait-online.service.xml | 3 ++-
src/network/networkd-wait-online-manager.c | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/man/systemd-networkd-wait-online.service.xml b/man/systemd-networkd-wait-online.service.xml
index f53b337..bcc5776 100644
--- a/man/systemd-networkd-wait-online.service.xml
+++ b/man/systemd-networkd-wait-online.service.xml
@@ -80,7 +80,8 @@
several interfaces which will be configured, but a particular
one is necessary to access some network resources. This option
may be used more than once to wait for multiple network
- interfaces.</para></listitem>
+ interfaces. When used, all other interfaces are ignored.
+ </para></listitem>
</varlistentry>
<varlistentry>
<term><option>--ignore=</option></term>
diff --git a/src/network/networkd-wait-online-manager.c b/src/network/networkd-wait-online-manager.c
index 1fc724f..ec44893 100644
--- a/src/network/networkd-wait-online-manager.c
+++ b/src/network/networkd-wait-online-manager.c
@@ -38,9 +38,15 @@ bool manager_ignore_link(Manager *m, Link *link) {
assert(m);
assert(link);
+ /* always ignore the loopback interface */
if (link->flags & IFF_LOOPBACK)
return true;
+ /* if interfaces are given on the commandlin, ignore all others */
+ if (m->interfaces && !strv_contains(m->interfaces, link->ifname))
+ return true;
+
+ /* ignore interfaces we explicitly are asked to ignore */
STRV_FOREACH(ignore, m->ignore)
if (fnmatch(*ignore, link->ifname, 0) == 0)
return true;

View File

@ -1,6 +1,8 @@
## Cherry-picked from upstream
## Debian specific patches
networkd-wait-online-only-consider-interfaces-given-.patch
networkd-wait-online-fix-race.patch
Add-back-support-for-Debian-specific-config-files.patch
don-t-try-to-start-autovt-units-when-not-running-wit.patch
timedated-don-t-rely-on-usr-being-mounted-in-the-ini.patch