Re: [Dnsmasq-discuss] Polling of hosts file

2014-03-20 Thread Simon Kelley
On 19/03/14 09:24, Franco Broi wrote:
> 
> I hear what you say but for me it would be very convenient, I have
> several dnsmasq servers all reading the same shared hosts file.
> 
> My currently solution is to run a script from cron that detects a change
> and sends HUP to dnsmasq.

That sounds like a good solution, especially if you arrange to replace
the file atomically, ie write hosts.new, then mv hosts.new to hosts
> 
> You could have a few simple safeguards, like delaying the update if the
> number of hosts has reduced drastically etc.. 

You could, and they would have the effect of turning frequent failures
into infrequent and difficult to diagnose failures.


Cheers,

Simon.

> 
> On Wed, 2014-03-19 at 09:07 +, Simon Kelley wrote: 
>> On 19/03/14 04:04, Franco Broi wrote:
>>> Hi
>>>
>>> Just wondering why dnsmasq doesn't poll the hosts file for changes like
>>> it does for resolv.conf?
>>>
>>
>> Polling files is dangerous. You can get race conditions where the update
>> time changes but the file is still in the process of being written.
>> Polling resolv.conf is necessary because there are lots of things which
>> just write it and expect the changes to be picked up (because that's
>> what the resolver library does.) That's not true for /etc/hosts, so it's
>> better to mandate the update-then-signal model.
>>
>>
>> Cheers,
>>
>> Simon.
>>
>>
>> ___
>> Dnsmasq-discuss mailing list
>> Dnsmasq-discuss@lists.thekelleys.org.uk
>> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 
> 
> 


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Polling of hosts file

2014-03-19 Thread Franco Broi

I hear what you say but for me it would be very convenient, I have
several dnsmasq servers all reading the same shared hosts file.

My currently solution is to run a script from cron that detects a change
and sends HUP to dnsmasq.

You could have a few simple safeguards, like delaying the update if the
number of hosts has reduced drastically etc.. 

On Wed, 2014-03-19 at 09:07 +, Simon Kelley wrote: 
> On 19/03/14 04:04, Franco Broi wrote:
> > Hi
> > 
> > Just wondering why dnsmasq doesn't poll the hosts file for changes like
> > it does for resolv.conf?
> > 
> 
> Polling files is dangerous. You can get race conditions where the update
> time changes but the file is still in the process of being written.
> Polling resolv.conf is necessary because there are lots of things which
> just write it and expect the changes to be picked up (because that's
> what the resolver library does.) That's not true for /etc/hosts, so it's
> better to mandate the update-then-signal model.
> 
> 
> Cheers,
> 
> Simon.
> 
> 
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss



___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Polling of hosts file

2014-03-19 Thread Simon Kelley
On 19/03/14 04:04, Franco Broi wrote:
> Hi
> 
> Just wondering why dnsmasq doesn't poll the hosts file for changes like
> it does for resolv.conf?
> 

Polling files is dangerous. You can get race conditions where the update
time changes but the file is still in the process of being written.
Polling resolv.conf is necessary because there are lots of things which
just write it and expect the changes to be picked up (because that's
what the resolver library does.) That's not true for /etc/hosts, so it's
better to mandate the update-then-signal model.


Cheers,

Simon.


___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss