<div dir="ltr">Hi there,<div><br><div>I am extensively using dnsmasq in conjunction with <b>--conf-dir </b>configuration property. My test env is <b>CentOS Linux release 7.4.1708 (Core) </b>with <b>3.10.0-693.17.1.el7.x86_64</b> kernel.</div><div>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:</div><div><br></div><i><font size="1">--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,<a href="http://laptop.thekelleys.org">laptop.thekelleys.org</a>,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.</font></i></div><div><font size="1"><i><br></i></font><div>The problem is that <b>readdir</b> syscall can't guarantee any order <a href="http://man7.org/linux/man-pages/man3/readdir.3.html" class="external-link" rel="nofollow" title="Follow link" style="color:rgb(0,132,180);font-family:-apple-system,system-ui,"Segoe UI",Roboto,Oxygen,Ubuntu,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif;font-size:14px">http://man7.org/linux/man-pages/man3/readdir.3.html</a><font color="#172b4d" face="-apple-system, system-ui, Segoe UI, Roboto, Oxygen, Ubuntu, Fira Sans, Droid Sans, Helvetica Neue, sans-serif"><span style="font-size:14px"> at least on Linux.</span></font></div><div><font color="#172b4d" face="-apple-system, system-ui, Segoe UI, Roboto, Oxygen, Ubuntu, Fira Sans, Droid Sans, Helvetica Neue, sans-serif"><span style="font-size:14px"><br></span></font><div>I prepared this small patch(see the attachment) and want to know community opinion on how useful it is?<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Best Regards,<br>Seliavka Evgenii</div></div></div></div></div></div>