Bug#806949: ifupdown: some tweaks to networking.service

Martin Pitt mpitt at debian.org
Mon Dec 14 07:38:07 GMT 2015


Hello Guus,

Guus Sliepen [2015-12-10 15:12 +0100]:
> Anyway, if we are going for a script that polls stuff, then why not
> decouple it completely from ifupdown or whatever networking framework is
> used, and do the following?
> 
> #!/bin/sh
> TIMEOUT=30
> 
> offline() {
> 	ip -4 r s | grep -q ^default && return 1
> 	ip -6 r s | grep -q ^default && return 1
> 	return 0
> }
> 
> i=0
> while offline; do
> 	if [ $i = $TIMEOUT ] ; then
> 		break
> 	fi
> 	i=$(($i+1))
> 	sleep 1
> done
> 
> Which is just waiting until we have a default route.

As Tollef already said, this would limit the notion of "online" to
"default route" which might not always be true. At the same time it
might also not be sufficient as AFAIUI this would be content with an
IPv4 *or* IPv6 route, and your network config might require both.

Both {NetworkManager,systemd-networkd}-wait-online already know which
interfaces should be configured how, and thus can say exactly when the
interfaces are in the desired state. They also don't need to poll, but
instead just read events from D-Bus.

In order to not deviate too much from this schema, I'd prefer
ifupdown-wait-online to do the same, i. e. wait until all "ifup"s of
your "auto" interfaces are done. This will respect the configuration
and not second-guess the admin. Thus in practical terms this indeed
should mean nothing else than "networking.service is running", no? So
at first sight just adding a WantedBy=network-online.target now makes
sense, as it will do just that and not block sysinit.target any more.

Thanks!

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20151214/c02fa0f2/attachment-0002.sig>


More information about the Pkg-systemd-maintainers mailing list