Debian Bug report logs - #798653
Should detect entries removed from files in hostsdir=/dir/ and not serve them anymore

version graph

Package: dnsmasq; Maintainer for dnsmasq is Simon Kelley <simon@thekelleys.org.uk>; Source for dnsmasq is src:dnsmasq (PTS, buildd, popcon).

Reported by: Guido Günther <agx@sigxcpu.org>

Date: Fri, 11 Sep 2015 14:00:02 UTC

Severity: wishlist

Found in version dnsmasq/2.75-1

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Simon Kelley <simon@thekelleys.org.uk>:
Bug#798653; Package dnsmasq. (Fri, 11 Sep 2015 14:00:06 GMT) (full text, mbox, link).


Acknowledgement sent to Guido Günther <agx@sigxcpu.org>:
New Bug report received and forwarded. Copy sent to Simon Kelley <simon@thekelleys.org.uk>. (Fri, 11 Sep 2015 14:00:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Guido Günther <agx@sigxcpu.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: hosts from hostsdir=/dir/ picked up but not served
Date: Fri, 11 Sep 2015 15:57:19 +0200
Package: dnsmasq
Version: 2.75-1
Severity: normal

Hi,
I just tried your suggestion with --hostdir=/tmp/test. While I see these
log messages nicely:

Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp
Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp - 3 addresses
Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts
Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts - 3 addresses

these addresses are _only_ being served if they are already present in
the file during daemon start. New entries are not being served. Note
that my program writes to a .tmp first and then does a rename so this
might confuse dnsmasq (and I can't use s.th. like:

    --host-dir=/tmp/test,*.tmp

to ignor the temporary file).
Cheers,
 -- Guido


-- System Information:
Debian Release: 8.1
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.1.0-2-amd64 (SMP w/p4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dnsmasq depends on:
ii  dnsmasq-base         2.75-1
ii  init-system-helpers  1.22
ii  netbase              5.3

dnsmasq recommends no packages.

Versions of packages dnsmasq suggests:
ii  resolvconf  1.76.1

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, Simon Kelley <simon@thekelleys.org.uk>:
Bug#798653; Package dnsmasq. (Fri, 11 Sep 2015 14:57:07 GMT) (full text, mbox, link).


Acknowledgement sent to Guido Günther <agx@sigxcpu.org>:
Extra info received and forwarded to list. Copy sent to Simon Kelley <simon@thekelleys.org.uk>. (Fri, 11 Sep 2015 14:57:07 GMT) (full text, mbox, link).


Message #10 received at submit@bugs.debian.org (full text, mbox, reply):

From: Guido Günther <agx@sigxcpu.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Re: Bug#798653: hosts from hostsdir=/dir/ picked up but not served
Date: Fri, 11 Sep 2015 16:54:57 +0200
On Fri, Sep 11, 2015 at 03:57:19PM +0200, Guido Günther wrote:
> Package: dnsmasq
> Version: 2.75-1
> Severity: normal
> 
> Hi,
> I just tried your suggestion with --hostdir=/tmp/test. While I see these
> log messages nicely:
> 
> Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp
> Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp - 3 addresses
> Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts
> Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts - 3 addresses
> 
> these addresses are _only_ being served if they are already present in
> the file during daemon start. New entries are not being served. Note
> that my program writes to a .tmp first and then does a rename so this
> might confuse dnsmasq (and I can't use s.th. like:

Even when I skip the writing to .tmp file step dnsmasq does only server
entries that are present in the file at startup.

A SIGHUP also lets the daemon server the entries from the hostdir.

Cheers,
 -- Guido





Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#798653; Package dnsmasq. (Fri, 18 Sep 2015 21:27:04 GMT) (full text, mbox, link).


Acknowledgement sent to Simon Kelley <simon@thekelleys.org.uk>:
Extra info received and forwarded to list. (Fri, 18 Sep 2015 21:27:04 GMT) (full text, mbox, link).


Message #15 received at submit@bugs.debian.org (full text, mbox, reply):

From: Simon Kelley <simon@thekelleys.org.uk>
To: Guido Günther <agx@sigxcpu.org>, 798653@bugs.debian.org, Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Re: Bug#798653: hosts from hostsdir=/dir/ picked up but not served
Date: Fri, 18 Sep 2015 22:23:57 +0100
On 11/09/15 15:54, Guido Günther wrote:
> On Fri, Sep 11, 2015 at 03:57:19PM +0200, Guido Günther wrote:
>> Package: dnsmasq
>> Version: 2.75-1
>> Severity: normal
>>
>> Hi,
>> I just tried your suggestion with --hostdir=/tmp/test. While I see these
>> log messages nicely:
>>
>> Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp
>> Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts.tmp - 3 addresses
>> Sep 11 15:53:49 foo dnsmasq[14616]: inotify, new or changed file /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts
>> Sep 11 15:53:49 foo dnsmasq[14616]: read /tmp/test/libvirt-qemu%3A%2F%2F%2Fsystem.hosts - 3 addresses
>>
>> these addresses are _only_ being served if they are already present in
>> the file during daemon start. New entries are not being served. Note
>> that my program writes to a .tmp first and then does a rename so this
>> might confuse dnsmasq (and I can't use s.th. like:
> 
> Even when I skip the writing to .tmp file step dnsmasq does only server
> entries that are present in the file at startup.
> 
> A SIGHUP also lets the daemon server the entries from the hostdir.
> 
> Cheers,
>  -- Guido
> 

Ok, a trivial attempt to reproduce this fails for me. I create a new
file in the directory with a new name in it and I can immediately look
up the new name. What is in your hosts file? Are the names or addresses
re-used?

I would be interesting to set --log-queries, and to look at the cache
dump created in the log by sending SIGUSR1.


Cheers,

Simon.




Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#798653; Package dnsmasq. (Fri, 18 Sep 2015 21:54:04 GMT) (full text, mbox, link).


Acknowledgement sent to Simon Kelley <simon@thekelleys.org.uk>:
Extra info received and forwarded to list. (Fri, 18 Sep 2015 21:54:04 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org, Simon Kelley <simon@thekelleys.org.uk>:
Bug#798653; Package dnsmasq. (Sat, 19 Sep 2015 11:00:03 GMT) (full text, mbox, link).


Acknowledgement sent to Guido Günther <agx@sigxcpu.org>:
Extra info received and forwarded to list. Copy sent to Simon Kelley <simon@thekelleys.org.uk>. (Sat, 19 Sep 2015 11:00:03 GMT) (full text, mbox, link).


Message #25 received at submit@bugs.debian.org (full text, mbox, reply):

From: Guido Günther <agx@sigxcpu.org>
To: Simon Kelley <simon@thekelleys.org.uk>
Cc: 798653@bugs.debian.org, Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Re: Bug#798653: hosts from hostsdir=/dir/ picked up but not served
Date: Sat, 19 Sep 2015 12:57:55 +0200
Hi,
On Fri, Sep 18, 2015 at 10:23:57PM +0100, Simon Kelley wrote:
[..snip..]
> > A SIGHUP also lets the daemon server the entries from the hostdir.
> > 
> > Cheers,
> >  -- Guido
> > 
> 
> Ok, a trivial attempt to reproduce this fails for me. I create a new
> file in the directory with a new name in it and I can immediately look
> up the new name. What is in your hosts file? Are the names or addresses
> re-used?

IT works now for, I have no idea what changed:

Addresses are not reused. They come and go but the IPs shouldn't
change. Here's a typical query:

 dnsmasq[8490]: query[A] sid from 127.0.0.1
 dnsmasq[8490]: /tmp/test/ sid is 192.168.122.46
 dnsmasq[8490]: query[AAAA] sid from 127.0.0.1
 dnsmasq[8490]: forwarded sid to 193.189.244.225
 dnsmasq[8490]: forwarded sid to 193.189.244.206
 dnsmasq[8490]: reply sid is NODATA-IPv6
 dnsmasq[8490]: query[MX] sid from 127.0.0.1
 dnsmasq[8490]: forwarded sid to 193.189.244.206

> 
> I would be interesting to set --log-queries, and to look at the cache
> dump created in the log by sending SIGUSR1.

 dnsmasq[984]: time 1442659875
 dnsmasq[984]: cache size 150, 0/418 cache insertions re-used unexpired cache entries.
 dnsmasq[984]: queries forwarded 257, queries answered locally 358
 dnsmasq[984]: queries for authoritative zones 0
 dnsmasq[984]: server 193.189.244.225#53: queries sent 181, retried or failed 4
 dnsmasq[984]: server 193.189.244.206#53: queries sent 178, retried or failed 35

What does not seem to work is that addresses removed from the file are
removed from the cache immediately. So if I remove the entry for sid it
will still be served.

Cheers and thanks a lot for looking into this and dnsmasq in general!
 -- Guido



Information forwarded to debian-bugs-dist@lists.debian.org, Simon Kelley <simon@thekelleys.org.uk>:
Bug#798653; Package dnsmasq. (Sat, 19 Sep 2015 11:00:05 GMT) (full text, mbox, link).


Acknowledgement sent to Guido Günther <agx@sigxcpu.org>:
Extra info received and forwarded to list. Copy sent to Simon Kelley <simon@thekelleys.org.uk>. (Sat, 19 Sep 2015 11:00:06 GMT) (full text, mbox, link).


Information forwarded to debian-bugs-dist@lists.debian.org:
Bug#798653; Package dnsmasq. (Mon, 21 Sep 2015 21:18:08 GMT) (full text, mbox, link).


Acknowledgement sent to Simon Kelley <simon@thekelleys.org.uk>:
Extra info received and forwarded to list. (Mon, 21 Sep 2015 21:18:08 GMT) (full text, mbox, link).


Message #35 received at 798653@bugs.debian.org (full text, mbox, reply):

From: Simon Kelley <simon@thekelleys.org.uk>
To: Guido Günther <agx@sigxcpu.org>, 798653@bugs.debian.org
Subject: Re: Bug#798653: hosts from hostsdir=/dir/ picked up but not served
Date: Mon, 21 Sep 2015 22:16:26 +0100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256




> What does not seem to work is that addresses removed from the file
> are removed from the cache immediately. So if I remove the entry
> for sid it will still be served.
> 

That's documented behaviour. New or changed files are read, so extra
information is added, but old information is not removed. Doing that
needs a SIGUSR1 as it's a rather heavyweight operation that involves
deleting everything are re-reading all the relevant files.


Cheers,

Simon.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBCAAGBQJWAHOqAAoJEBXN2mrhkTWiCbcP/1eP2bqhSSkob3BSeuSA7OLM
6wQ8eGdVRiiMysX0+eY2nTDuXyNPM9rjKCXR6R1iLr5/Rf8zU7rvqhgwoAjg8PPM
yt8E9Jke2TeJ4Ju2hZGjzGpwYjWcWmKMpgGISg+Bk5kT/F6Wa5iNoRin8Vsy65Bs
T6DTO8B1yCD8XP2vUwrOgwyw8/vYu6FAhWzDP1TdfF5uDDkZRiovD3j7zrgvb7R9
UVDmBtw8OTWGhlD+/OYqvLyPUJodL0Zl0DAcWzt12WR1y0Syhl0xkLECIdXmWj9+
xcDYkUHdCe3nnzEC2IIWJuc3lu9DQXeNhGmFBeFQZl8tgqInWsjt0iCA5hVR6bM5
H2FAmp/gGQn4zO2pKjIuRjtqvDi6/SZR2h4YUyT5Hvafjrtzz4YHo6/RC+RZTLJC
4FzhuWw5uPTk96YNKNJKzxAAXnAUaf+8i+5EtYX6MVEvCtaCMUWdAQ+Ws5im4thL
ZBRRT3tLVh33Cv+D+XMP9MqLMr2WdCFoyacEkPPE7mKnHzEsOwCCLELgwIuQWNks
9IKfJ8cNEz4QatYTCzJnfhCrjRhCfa05wgXpHZGe+zNDeOXWGKem9IYKXmko8Wef
BnsR4VhtK9qmc45GdIU4KzE/l6km/eb/Ce5EvVvTKAbhTl2zS7+tPz5yQVIhRRpV
Jrq+lv4sczyxaXXDn62k
=8Ksr
-----END PGP SIGNATURE-----



Information forwarded to debian-bugs-dist@lists.debian.org, Simon Kelley <simon@thekelleys.org.uk>:
Bug#798653; Package dnsmasq. (Tue, 22 Sep 2015 06:51:06 GMT) (full text, mbox, link).


Acknowledgement sent to Guido Günther <agx@sigxcpu.org>:
Extra info received and forwarded to list. Copy sent to Simon Kelley <simon@thekelleys.org.uk>. (Tue, 22 Sep 2015 06:51:06 GMT) (full text, mbox, link).


Message #40 received at 798653@bugs.debian.org (full text, mbox, reply):

From: Guido Günther <agx@sigxcpu.org>
To: Simon Kelley <simon@thekelleys.org.uk>
Cc: 798653@bugs.debian.org
Subject: Re: Bug#798653: hosts from hostsdir=/dir/ picked up but not served
Date: Tue, 22 Sep 2015 08:47:57 +0200
retitle 798653 Should detect entries removed from files in hostsdir=/dir/ and not serve them anymore
severity 798653 wishlist
thanks

On Mon, Sep 21, 2015 at 10:16:26PM +0100, Simon Kelley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> 
> 
> > What does not seem to work is that addresses removed from the file
> > are removed from the cache immediately. So if I remove the entry
> > for sid it will still be served.
> > 
> 
> That's documented behaviour. New or changed files are read, so extra
> information is added, but old information is not removed. Doing that
> needs a SIGUSR1 as it's a rather heavyweight operation that involves
> deleting everything are re-reading all the relevant files.

Thanks for the update. It would still be nice functionality though. I've
moved the severity to wishlist but feel free to close it.

Cheers,
 -- Guido



Changed Bug title to 'Should detect entries removed from files in hostsdir=/dir/ and not serve them anymore' from 'hosts from hostsdir=/dir/ picked up but not served' Request was from Guido Günther <agx@sigxcpu.org> to control@bugs.debian.org. (Tue, 22 Sep 2015 06:51:09 GMT) (full text, mbox, link).


Severity set to 'wishlist' from 'normal' Request was from Guido Günther <agx@sigxcpu.org> to control@bugs.debian.org. (Tue, 22 Sep 2015 06:51:09 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Jul 4 10:36:37 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.