From 6bd4a3e1ff023ef45eaa1ae01769287c873d9989 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 29 Jul 2015 15:43:05 +0200 Subject: [PATCH] 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. --- debian/changelog | 2 + .../networkd-wait-online-fix-race.patch | 24 ++++++++++ ...line-only-consider-interfaces-given-.patch | 45 +++++++++++++++++++ debian/patches/series | 2 + 4 files changed, 73 insertions(+) create mode 100644 debian/patches/networkd-wait-online-fix-race.patch create mode 100644 debian/patches/networkd-wait-online-only-consider-interfaces-given-.patch diff --git a/debian/changelog b/debian/changelog index 3623b3df0..86baa1054 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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) diff --git a/debian/patches/networkd-wait-online-fix-race.patch b/debian/patches/networkd-wait-online-fix-race.patch new file mode 100644 index 000000000..ad1f02f71 --- /dev/null +++ b/debian/patches/networkd-wait-online-fix-race.patch @@ -0,0 +1,24 @@ +From: Tom Gundersen +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; diff --git a/debian/patches/networkd-wait-online-only-consider-interfaces-given-.patch b/debian/patches/networkd-wait-online-only-consider-interfaces-given-.patch new file mode 100644 index 000000000..01f015b65 --- /dev/null +++ b/debian/patches/networkd-wait-online-only-consider-interfaces-given-.patch @@ -0,0 +1,45 @@ +From: Tom Gundersen +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. ++ interfaces. When used, all other interfaces are ignored. ++ + + + +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; diff --git a/debian/patches/series b/debian/patches/series index 2c6b191b9..5d91ea24b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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