[Dnsmasq-discuss] [feature proposal] Alpha sort of files under conf-dir

Evgenii Seliavka evg.selyavka at gmail.com
Wed Jan 8 00:11:45 GMT 2020


Hi there,

I am extensively using dnsmasq in conjunction with *--conf-dir
*configuration property.
My test env is *CentOS Linux release 7.4.1708 (Core) *with
*3.10.0-693.17.1.el7.x86_64* kernel.
In our set up we strongly relying on the order dnsmasq will read and apply
DNS records under the configuration directory. Basically, we have files
like: 0001_this_should_be_first, 0002_comes_second, etc. and we expecting
them to be read in alpha order. We need this strict ordering guarantee
because of PTR records, according to the documentation only first A record
will receive corresponding PTR record:

*--host-record=<name>[,<name>....],[<IPv4-address>],[<IPv6-address>][,<TTL>]
Add A, AAAA and PTR records to the DNS. This adds one or more names to the
DNS with associated IPv4 (A) and IPv6 (AAAA) records. A name may appear in
more than one --host-record and therefore be assigned more than one
address. Only the first address creates a PTR record linking the address to
the name. This is the same rule as is used reading hosts-files.
--host-record options are considered to be read before host-files, so a
name appearing there inhibits PTR-record creation if it appears in
hosts-file also. Unlike hosts-files, names are not expanded, even when
--expand-hosts is in effect. Short and long names may appear in the same
--host-record, eg. --host-record=laptop,laptop.thekelleys.org
<http://laptop.thekelleys.org>,192.168.0.1,1234::100 If the time-to-live is
given, it overrides the default, which is zero or the value of --local-ttl.
The value is a positive integer and gives the time-to-live in seconds.*

The problem is that *readdir* syscall can't guarantee any order
http://man7.org/linux/man-pages/man3/readdir.3.html at least on Linux.

I prepared this small patch(see the attachment) and want to know community
opinion on how useful it is?

-- 
Best Regards,
Seliavka Evgenii
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20200107/d6013452/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-alpha-ordering-of-files-under-conf-dir-if-an.patch
Type: application/octet-stream
Size: 4640 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20200107/d6013452/attachment-0001.obj>


More information about the Dnsmasq-discuss mailing list