[Dnsmasq-discuss] Polling /etc/hosts

Simon Kelley simon at thekelleys.org.uk
Fri Oct 7 14:57:36 BST 2005

Dan Flett wrote:
> Hi there,
> Can anyone tell me if DNSMasq can be made to poll /etc/hosts or 
> equivalent in the same way it polls /etc/resolv.conf?  Or is it 
> necessary to manually send a HUP signal for this to happen?
It's necessary to send SIGHUP.

> I am looking at experimenting with the OLSR Nameservice plugin which 
> automatically distributes hostname-to-ip-address info across a mesh in 
> hosts file format.  Entries are addedd dynamically to the hosts file it 
> creates (by default /etc/hosts_olsr) whenever a new OLSR node joins the 
> mesh.  It would be quite handy if DNSMasq could automatically re-read 
> this file whenever it changes.

The problem is avoiding race conditions. What happens if the file is 
still changing when dnsmasq starts to read it. Strictly speaking, this 
is a problem with automatically reading /etc/resolv.conf too, but the 
potential windows are smaller,  and precautions are taken to avoid nasty 

To do this "properly" the best way might be to enhance the DBus code, to 
allow name/address pairs to be added and removed.

> FYI the readme file for this plugin is here:
> http://cvs.sourceforge.net/viewcvs.py/olsrd/olsrd-current/lib/nameservice/README?rev=1.8&view=auto 



More information about the Dnsmasq-discuss mailing list