Re: [Dnsmasq-discuss] No forgetting logic when using hostsdir

2020-05-17 Thread Geert Stappers
On Sun, May 17, 2020 at 12:08:36PM +0100, an0nym wrote:
> On Sun, May 17, 2020 at 10:28:11AM +, Kevin 'ldir' Darbyshire-Bryant 
> wrote:
> > The man page sayeth: 
> > (http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html)
> > 
> > --hostsdir=
> > Read all the hosts files contained in the directory. New or changed
> > files are read automatically. See --dhcp-hostsdir for details.
> > 
> > --dhcp-hostsdir=
> > This is equivalent to --dhcp-hostsfile, except for the following. The
> > path MUST be a directory, and not an individual file. Changed or
> > new files within the directory are read automatically, without the
> > need to send SIGHUP. If a file is deleted or changed after it has
> > been read by dnsmasq, then the host record it contained will remain
> > until dnsmasq receives a SIGHUP, or is restarted; ie host records
> > are only added dynamically.
> > 
> > 
> > To re-iterate:
> > 
> > Host entries from dynamically read files will remain in dnsmasq’s
> > memory if removed from those file/s unless dnsmasq is persuaded to
> > forget them, either by SIGHUP or a complete restart.
> > 
> > Personally I would find it a welcome option if dnsmasq could also
> > dynamically forget entries.  I suspect it is not as simple as it
> > sounds otherwise it would have been implemented.
> 
> Thank you, Kevin.
> 
> Regrettably, I have missed this documented statement.
> Now everything makes sense.

Challenge:  Play with it and report back.


Regards
Geert Stappers

P.S.
SIGHUP can be send with the tool c.q. utility `kill`.
Even the default signal that `kill` sends is SIGHUP, Signal HangUP.

Use `kill -L` for getting a list of signals.

See also  `pidof` and `killall`.

Have fun  and thanks for being a good dnsmasq community member.
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] No forgetting logic when using hostsdir

2020-05-17 Thread an0nym
Thank you, Kevin.

Regrettably, I have missed this documented statement. Now everything makes
sense.
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] No forgetting logic when using hostsdir

2020-05-17 Thread Kevin 'ldir' Darbyshire-Bryant
The man page sayeth: 
(http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html)

--hostsdir=
Read all the hosts files contained in the directory. New or changed files are 
read automatically. See --dhcp-hostsdir for details.

--dhcp-hostsdir=
This is equivalent to --dhcp-hostsfile, except for the following. The path MUST 
be a directory, and not an individual file. Changed or new files within the 
directory are read automatically, without the need to send SIGHUP. If a file is 
deleted or changed after it has been read by dnsmasq, then the host record it 
contained will remain until dnsmasq receives a SIGHUP, or is restarted; ie host 
records are only added dynamically.


To re-iterate:

Host entries from dynamically read files will remain in dnsmasq’s memory if 
removed from those file/s unless dnsmasq is persuaded to forget them, either by 
SIGHUP or a complete restart.

Personally I would find it a welcome option if dnsmasq could also dynamically 
forget entries.  I suspect it is not as simple as it sounds otherwise it would 
have been implemented.
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] No forgetting logic when using hostsdir

2020-05-17 Thread an0nym
Hi Geert,

Thank you for your response.

I am not sure I fully understand it. Yes, both times the same IP address is
passed however test.conf is being overwritten so at any point in time there
is at most one entry with this IP address as per the conf files. Yet
dnsmasq daemon thinks there is a duplicate.

As far as I understand this happens because it does not act on entries
deletion:
- removing test.conf produces no messages in logs;
- emptying it produces "changed file" message in logs however if you re-add
even exactly the same entry (with the same id: and same IP) - then dnsmasq
says there is a duplicate which is factually wrong - the address is not
leased, the address was removed from config, dnsmasq noticed this change,
then the address was re-added with exactly same filter, dnsmasq noticed
this change and thinks there is a duplicate.

Am I missing something?

On Sun, 17 May 2020 at 08:10, Geert Stappers  wrote:

> On Sat, May 16, 2020 at 05:07:59PM +0100, an0nym wrote:
> > Hello,
> >
> > I hope you are safe and well.
> >
> > When dnsmasq is configured to monitor hostsdir, I believe there is no
> > forgetting logic when you delete and then create or simply overwrite one
> of
> > the files there with different filter and the same allocated IP.
> >
> > E. g.
> >
> > # grep -F dhcp-hostsdir /etc/dnsmasq.conf
> > dhcp-hostsdir=/etc/dnsmasq.d/hosts.d
> > # echo "id:test,192.168.0.156" >/etc/dnsmasq.d/hosts.d/test.conf
>
> test   .156
>
>
> > # systemctl status dnsmasq
> > ...
> > dnsmasq[21376]: inotify, new or changed file
> > /etc/dnsmasq.d/hosts.d/test.conf
> > dnsmasq-dhcp[21376]: read /etc/dnsmasq.d/hosts.d/test.conf
> > # echo "id:test2,192.168.0.156" >/etc/dnsmasq.d/hosts.d/test.conf
>
> test2.156
>
>
> > # systemctl status dnsmasq
> > ...
> > dnsmasq[21376]: inotify, new or changed file
> > /etc/dnsmasq.d/hosts.d/test.conf
> > dnsmasq-dhcp[21376]: read /etc/dnsmasq.d/hosts.d/test.conf
> > dnsmasq[21376]: duplicate dhcp-host IP address 192.168.0.156 at line 1
> of /etc/dnsmasq.d/hosts.d/test.conf
>
> duplicate  of .156
>
>
> > Dnsmasq 2.80. Apologies if this has been fixed in 2.81,
> > I did not succeed in compiling from sources to check.
> >
> > I hope this helps.
>
> Helpfull is reporting back how helpfull this message was.
>
>
> Groeten
> Geert Stappers
> --
> Silence is hard to parse
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] No forgetting logic when using hostsdir

2020-05-17 Thread Geert Stappers
On Sat, May 16, 2020 at 05:07:59PM +0100, an0nym wrote:
> Hello,
> 
> I hope you are safe and well.
> 
> When dnsmasq is configured to monitor hostsdir, I believe there is no
> forgetting logic when you delete and then create or simply overwrite one of
> the files there with different filter and the same allocated IP.
> 
> E. g.
> 
> # grep -F dhcp-hostsdir /etc/dnsmasq.conf
> dhcp-hostsdir=/etc/dnsmasq.d/hosts.d
> # echo "id:test,192.168.0.156" >/etc/dnsmasq.d/hosts.d/test.conf

test   .156


> # systemctl status dnsmasq
> ...
> dnsmasq[21376]: inotify, new or changed file
> /etc/dnsmasq.d/hosts.d/test.conf
> dnsmasq-dhcp[21376]: read /etc/dnsmasq.d/hosts.d/test.conf
> # echo "id:test2,192.168.0.156" >/etc/dnsmasq.d/hosts.d/test.conf

test2.156


> # systemctl status dnsmasq
> ...
> dnsmasq[21376]: inotify, new or changed file
> /etc/dnsmasq.d/hosts.d/test.conf
> dnsmasq-dhcp[21376]: read /etc/dnsmasq.d/hosts.d/test.conf
> dnsmasq[21376]: duplicate dhcp-host IP address 192.168.0.156 at line 1 of 
> /etc/dnsmasq.d/hosts.d/test.conf

duplicate  of .156


> Dnsmasq 2.80. Apologies if this has been fixed in 2.81,
> I did not succeed in compiling from sources to check.
> 
> I hope this helps.

Helpfull is reporting back how helpfull this message was.


Groeten
Geert Stappers
-- 
Silence is hard to parse

___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss