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