Bug#752919: networking scripts runs ifup for hotplugged interfaces, races with net.agent from udev

Niall Walsh niallwalsh at celtux.org
Fri Aug 8 20:07:24 BST 2014


Hi

> I think a better thing would be to block ifup requests from udev script
> until networking initscript has finished

The following diff seems to work.

--- net.agent.orig      2014-08-08 15:41:17.389440075 +0100
+++ net.agent   2014-08-08 16:26:46.869439749 +0100
@@ -49,6 +49,12 @@

      wait_for_interface lo

+    if [ -d /run/systemd/system ]; then
+        while systemctl list-jobs | grep -q network.target ; do
+            sleep 1
+        done
+    fi
+
      exec ifup --allow=hotplug $INTERFACE
  }

I shamelessly ripped off the test from:
http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/2014-July/002630.html

Technically it waits for when the initscript is not running rather then 
waiting for it to finish, I had first come up with:

+    if [ -d /run/systemd/system ] && systemctl -q is-active networking 
; then
+        while ! systemctl show -p Result | grep -q =success$ ; do

but then found the above on the systemd-maintainers mailing list which 
felt saner. tbh I'm not 100% sure which is the more appropriate here (or 
if another variation would be better).  Given the wait for lo which 
signifies that networking should have started if it is in use I think 
the first is fine though.

Hope this helps.

Thanks,

Niall




More information about the Pkg-systemd-maintainers mailing list