Comment 10 for bug 1777094

Revision history for this message
Ryan Harper (raharper) wrote : Re: [Bug 1777094] Re: dnsmasq started too early, not getting all interfaces

On Tue, Jun 19, 2018 at 9:41 AM Hadmut Danisch <email address hidden> wrote:
>
> dnsmasq _after_ networking?
>
> Isn't it part of networking and should be running and ready for other
> services depending on networking?

Yes, but it's complicated; see below.

>
>
> (my guess is that Ubuntu has never defined the targets very precisely. it should distinguish between low level /interface level configuration and networking services.)
>

This is rather precisely defined; not by Ubuntu but by the init
system. In systemd there are many targets that indicate various state
of the system during boot[1][2]
For networking, the ones that matter are:

network-pre.target (before systemd has attempted to bring the network up)
network.target (systemd has started to bring network up; for
Artful/Bionic, this means systemd-networkd.service has started)
network-online.target ("required" networking interfaces are up,
configured, routable)

Dnsmasq itself is a networking service, so arguably, it is fine to run
at After=network.target; but network.target does not guarantee that
all of networking has been configured. Dnsmasq has two choices. 1)
it can run later, at network-online.target which means systemd is
done with creating and configuring interfaces. 2) start at
After=network.target but listen to dbus or netlink layer to react to
when a
configured interface is present and ready for it to use.

Since dnsmasq does not watch dbus or netlink for new interfaces and
when they're configured, then the only solution is to run after such
a time that the configured interfaces are ready for use by dnsmasq.

1. https://www.freedesktop.org/software/systemd/man/systemd.special.html
2. https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/

> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1777094
>
> Title:
> dnsmasq started too early, not getting all interfaces
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1777094/+subscriptions