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

Simon Kelley simon at thekelleys.org.uk
Tue Aug 10 22:12:27 UTC 2021


On 08/08/2021 14:02, Ed W wrote:
> 
> On 19/07/2021 18:52, Ed W wrote:
>> Hi, around 2.82 someone posted a little patch to import the config files in dictionary order, which
>> is very useful for situations where you have overlapping definitions. I'm using an addn-hosts stanza
>> pointing to a directory and files currently import in a somewhat random order (suppose inode
>> order?), which can lead to unexpected reverse host definitions in some cases
>>
>> Could we have a dictionary order import for add-hosts files please?
>>
>> Ed W
> 
> 
> Hi, I have developed the attached patch without really being sure that this is the best approach. I
> would be grateful for some feedback. I have used scandir without understanding if this is portable
> across systems that we support with dnsmasq. Also I am trying to copy the existing coding style, but
> surely I have failed.
> 

I'll look in more detail soon, but this certainly looks like the right
way to go.

> I'm also unclear that it still works as advertised in the case that I don't have inotify enabled?
> Any help?

Since the whole point of the inotify stuff is that individual files get
read as they change, imposing or relying on a particular order doesn't
make much sense. I'd therefore not make any changes to inotify.c.

The man page then needs to note that --dhcp-hostsdir --dhcp-optsdir and
--hostsdir DON'T offer any ordering of files read, but
--dhcp-hostsfile --dhcp-optsfile and --addn-hosts with directory
arguments DO.
> 
> The intent is that I have a few aliases for my local system name. However, the reverse name depends
> on the order that the addn-hosts files are read. In any case predictable dictionary order seems like
> a nice thing to have for all config files


Seems sensible.



Simon.

> 
> Thanks
> 
> 
> Ed W
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss
> 




More information about the Dnsmasq-discuss mailing list