[Dnsmasq-discuss] dnsmaq stops forwarding queries (part 2)
graham at theseamans.net
Sun Sep 17 00:11:14 BST 2006
Simon Kelley wrote:
> graham wrote:
>> On initial boot of the server no queries are forwarded to the opendns
>> servers: it's as if dnsmasq had never read resolv.dnsmasq Touch
>> resolv.dnsmasq, and everything immediately works correctly.
> What (if anything) writes to /etc/resolv.dnsmasq?
Nothing at all. This is a static file created by hand for dnsmasq and
nothing else knows about it.
It hasn't failed again since I wrote originally; if it does I'll check
the time on the file before I do anything to it just in case something
has written to it - but I don't see how it could.
Thanks for the suggestions
> Holger's problem
> turned out to be a script which emptied /etc/resolv.dnsmasq and then
> wrote the new nameservers. It's possible to get unlucky, so that
> following events all occur in order within one second:
> 1) Write or create empty resolv.dnsmasq
> 2) dnsmasq reads empty file -> no nameservers
> 3) write resolv.conf with new nameservers.
> Since the timestamp on the file only has one second resolution, dnsmasq
> never sees the second write, and never re-reads the file.
> This problem is largely fixed in later dnsmasq releases: if dnsmasq
> reads an empty file, it will keep re-reading every second until it gets
> real data. Since you are using 2.22 you don't have that code.
> Actually, there's a better way, which is to update resolv.dnsmasq by
> writing data into resolv.dnsmasq.new, and then doing
> "mv resolv.dnsmasq.new resolv.dnsmasq". The mv operation is atomic, so
> that eliminates the race.
> If you have a script which re-writes /etc/resolv.dnsmasq on a regular
> basis, then the fix probably involves tweaking that script. If you have
> no control over the code which writes /etc/resolv.dnsmasq then upgrading
> to the latest release should provide a workaround in dnsmasq.
>> _______________________________________________ Dnsmasq-discuss
>> mailing list Dnsmasq-discuss at lists.thekelleys.org.uk
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
More information about the Dnsmasq-discuss