On 09/20/2017 04:28 PM, Grant Edwards wrote: > On 2017-09-20, Ian Zimmerman <[email protected]> wrote: > >> When I add multiple net.* services to a single runlevel (basic example: >> both a net.en* and a net.wl* service in default runlevel), it has a >> surprising and undesirable effect: when I bring one of them down by >> stopping the service, dnsmasq also gets stopped. >> >> It is as if openrc thinks dnsmasq "depends" in the openrc sense on >> _both_ the net.* services, instead of just one. Is there a way to hack >> the dependency machinery to teach openrc the right way? > > From my /etc/rc.conf: > > # Do we allow any started service in the runlevel to satisfy the dependency > # or do we want all of them regardless of state? For example, if net.eth0 > # and net.eth1 are in the default runlevel then with rc_depend_strict="NO" > # both will be started, but services that depend on 'net' will work if either > # one comes up. With rc_depend_strict="YES" we would require them both to > # come up. > rc_depend_strict="NO" >
This might also be considered a bug in dnsmasq's init script: https://bugs.gentoo.org/show_bug.cgi?id=need-net Most things that "need net" don't -- they just need any old interface to be up. In particular, they might work just fine with only the loopback interface up, and so what they really want is "net.lo". However (and a little ironically), "need net" is not satisfied by the loopback interface, so "need net" almost always waits longer than it has to because most daemons have default configuration that use either 0.0.0.0 or 127.0.0.1. I wouldn't swear to it, but I bet as a forwarding DNS server, dnsmasq can start just fine with only the loopback interface up. (You still won't be able to make DNS queries until the WAN comes up, but that's no reason to delay the start-up of dnsmasq with a "need" dependency). You might want to ask around, but I think the best solution for those services is to drop "need net" and add rc_need="net.lo" to their conf.d files. That way, you can place a comment right next to it that says # if you listen on a particular interface, specify it here rc_need="net.lo" allowing you to preempt the situation where a user specifies one interface in the config file but "need net" is satisfied by the wrong one.

