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

Ed W lists at wildgooses.com
Mon Aug 9 10:54:17 UTC 2021


On 08/08/2021 16:06, Matthias Andree wrote:
> Am 08.08.21 um 15:02 schrieb Ed W:
>> 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 haven't looked at other parts (inotify for one) in detail; as to the
> portability, scandir() originated in BSD4.3, so the BSDs should have it,
> and it appeared in POSIX in 2008.
> The signature on some older systems may use generic void * where modern
> systems use more specific pointer types.
>

Thanks for the feedback. I think you are agreeing that it should exist in some form on all platforms
that DNSMasq needs to run on?

Essentially it seems to implement the readdir function, plus optional sorting and filtering. So it's
an easy drop in replacement if it's accepted to use it.

I wonder if anyone on some more esoteric platforms could give this a compile test for me? (I have
arm 32bit musl, plus also intel 32/64bit on musl/glibc)


Thanks

Ed W




More information about the Dnsmasq-discuss mailing list