[Dnsmasq-discuss] feature: dictionary order import of addn-hosts dirs?

john doe johndoe65534 at mail.com
Sun Aug 22 18:09:14 UTC 2021

On 8/18/2021 3:44 PM, Simon Kelley wrote:
> On 17/08/2021 19:24, john doe wrote:
>> On 8/14/2021 7:00 PM, Simon Kelley wrote:
>>> On 12/08/2021 18:30, john doe wrote:
>>>> On 8/12/2021 5:04 PM, Simon Kelley wrote:
>>>>> On 11/08/2021 00:25, Ed W wrote:
>>>>>> On 10/08/2021 23:12, Simon Kelley wrote:
>>>>>>> On 08/08/2021 14:02, Ed W wrote:
>>>>>>>> On 19/07/2021 18:52, Ed W wrote:
>>>> [snip]
>>>>> --dhcp-hostsdir --dhcp-optsdir and --hostsdir work in much the same way
>>>>> as when the first three options are given a directory; the files are
>>>>> read at start-up and when SIGHUP is received. BUT any file which is
>>>>> modified or created gets read asynchronously, without needing SIGHUP to
>>>>> be sent. Note that the old data from the files is not discarded when
>>>>> this is done: if a file gets modified, then it gets re-read but data
>>>>> from the previous version of the file is not deleted. This means that
>>>> Why is deleting not happening when the file is reread?
>>>>> this facility is useful for adding hosts to the configuration without
>>>>> the upheaval of a full SIGHUP re-read. Anytime you want to delete
>>>>> stuff,
>>>>> SIGHUP is still needed.
>>>> In other words, what is the reasoning behind requiring SIGHUP to delete
>>>> stuff?
>>> The cache datastructures don't allow track where names came from, so the
>>> choices are to clear the cache and re-read all configuration files, or
>>> not to delete anything.
>> Thank you, that would explain the following:
>> inotify, new or changed file /etc/dnsmasq-dhcp-hosts.d/try
>> read /etc/dnsmasq-dhcp-hosts.d/try
>> duplicate dhcp-host IP address at line 7 of
>> /etc/dnsmasq-dhcp-hosts.d/try
>> duplicate dhcp-host IP address at line 9 of
>> /etc/dnsmasq-dhcp-hosts.d/try
>> Is there a way to disable inotify?
> Use dhcp-hostsfile=</path/to/directory>instead of
> dhcp-hostsdir=</path/to/directory>
> dhcp-hostsfil is fine with a directory argument, and doesn't implement
> the automatic re-read function.

Thank you.

Changing 'dhcp-hostsdir' and 'dhcp-optsdir' to 'dhcp-*file=<...>' works
but not for 'hostsfile=<PATH-OF-DIR>'

"dnsmasq: syntax check OK.
dnsmasq: bad option at line 11 of /etc/dnsmasq.d/dnsmasq.conf
bad option at line 11 of /etc/dnsmasq.d/dnsmasq.conf"

Line 11: 'hostsfile=<PATH-OF-DIR>'

Debian Stretch:
$ dnsmasq --version
Dnsmasq version 2.76  Copyright (c) 2000-2016 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua
TFTP conntrack ipset auth DNSSEC loop-detect inotify

That is, if I'm reading the manpage correctly! :)

My apologies for the noise if this is already fixed in a newer release.

John Doe

More information about the Dnsmasq-discuss mailing list