[Dnsmasq-discuss] conf-dir load order and strict-order directive

Salatiel Filho salatiel.filho at gmail.com
Sat Feb 29 13:59:23 GMT 2020


Thanks, Simon. I found your commit at
http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2020q1/013693.html
( http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commit;h=ab53883c94f94958e22077c79ba1dae1850a475e
) and patched 2.80 with it.
It appears to work, but I noticed two problems:

The first:
I have two files in confdir: 10-stubby.conf and 20-nextdns.conf

# cat /var/dnsmasq.d/10-stubby.conf
server=127.0.0.1#5453
strict-order
no-resolv

# cat /var/dnsmasq.d/20-nextdns.conf
server=127.0.0.1#5342
strict-order
no-resolv


After restart dnsmasq , the log shows:
Sat Feb 29 10:50:44 2020 daemon.info dnsmasq[17671]: using nameserver
127.0.0.1#5342
Sat Feb 29 10:50:44 2020 daemon.info dnsmasq[17671]: using nameserver
127.0.0.1#5453

The order appears to be reversed. The 127.0.0.1#5342 is being used
even though it is added by the 20-nextdns.conf ( which should be
loaded after 10-stubby.conf)

The second problem is:
If I delete /var/dnsmasq.d/20-nextdns.conf and send a HUP signal,
dnsmasq does not notice that file was deleted and keep using
127.0.0.1#5342. If I restart ( instead of reload/HUP) it will work as
expected.
If i send a USR1 signal ( after  deletion ) I still see:
Sat Feb 29 10:56:19 2020 daemon.info dnsmasq[17671]: server
127.0.0.1#5342: queries sent 67, retried or failed 0
Sat Feb 29 10:56:19 2020 daemon.info dnsmasq[17671]: server
127.0.0.1#5453: queries sent 0, retried or failed 0












Atenciosamente/Kind regards,
Salatiel

On Tue, Feb 11, 2020 at 7:51 AM Simon Kelley <simon at thekelleys.org.uk> wrote:
>
> In all the released versions of dnsmasq, the order in which the files in
> a conf-dir are loaded is indeterminate.
>
> The next dnsmasq release changes this to alphabetic order.
>
>
> Simon.
>
>
> On 11/02/2020 00:44, Salatiel Filho wrote:
> > I am trying to understand the behaviour of conf-dir parameter.
> > Although I am running dnsmasq inside openwrt, this is more a dnsmasq
> > question than openwrt question.
> >
> > I have conf-dir=/tmp/dnsmasq.d
> > This directory CAN contain files or not. The files, when exists,  are
> > created by  the init scripts of two other services  (nextdns and
> > stubby)
> > When nextdns it creates 20-nextdns.conf and send a SIGHUP to dnsmasq (
> > reload ). The content of the conf file is:
> >
> > # cat /var/dnsmasq.d/20-nextdns.conf
> > server=127.0.0.1#5342
> > strict-order
> > no-resolv
> >
> >>From this moment on , the new requests will use nextdns server as
> > upstream (127.0.0.1 port 5432) as expected.
> >
> > Now if I start the stubby service, it will create
> > /var/dnsmasq.d/30-stubby.conf and reload dnsmasq.
> > # cat /var/dnsmasq.d/30-stubby.conf
> > server=127.0.0.1#5453
> > strict-order
> > no-resolv
> >
> >
> > Now we have two files inside the conf-dir.
> >
> >
> > Question number 1: Since we have strict-order, what server should be
> > used? The one from the 20-nextdns.conf or the one from 30-stubby.conf
> > ?  I suppose the order is  alphabetical, right ?
> >
> > Now comes the odd part. If I stop nextdns, the init script will delete
> > the /var/dnsmasq.d/20-nextdns.conf and reload dnsmasq. As expected,
> > the only upstream server will be the one from 30-stubby.conf  (
> > 127.0.0.1#5453 ). BUT if i start nextdns again, it will create the
> > /var/dnsmasq.d/20-nextdns.conf again and reload dnsmasq again. But
> > now, dnsmasq will not start using the dns from 20-nextdns.conf  (
> > 127.0.0.1#5342 ). It will keep using the DNS from 30-stubby.conf (
> > 127.0.0.1#5453).
> >
> > Question 2: Shouldn't dnsmasq on reload respect the strict-order and
> > start using the dns from 20-nextdns.conf instead of keeping using the
> > one from 30-stubby.conf ?
> >
> > Thanks!
> >
> >
> >
> >
> >
> >
> > Atenciosamente/Kind regards,
> > Salatiel
> >
> > _______________________________________________
> > Dnsmasq-discuss mailing list
> > Dnsmasq-discuss at lists.thekelleys.org.uk
> > http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> >
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



More information about the Dnsmasq-discuss mailing list