[Dnsmasq-discuss] Distributed lease database on a mesh, using batman-adv alfred

Simon Kelley simon at thekelleys.org.uk
Mon Nov 4 14:49:53 GMT 2013

On 02/11/13 20:30, Gui Iribarren wrote:
> Hello once again Simon,
> we are giving one more iteration to this Libre-Mesh[0] idea, this
> weekend at a HackMeeting[1] near Bilbao
> i already described a bit of the "interesting" setup generated by the
> firmware in my last email.
> To make the mesh as distributed / resilient as possible, there's a
> dnsmasq instance running on each node, with identical configuration
> (i.e. everyone serves the same range to its clients, since they are all
> part of a batadv link-local that enables them to roam around)
> This scheme needs some kind of "lease propagation" between all
> instances: not only to avoid collisions in a robust way, but also to
> have cloud-wide hostname resolution (i.e. any dnsmasq will know
> hostname->ip of every client, independent of which dnsmasq gave the
> lease to the client)
> Gioacchino did a small script[2] to be used as a --dhcp-script, that
> talks to alfred[3] (a batadv-related daemon that propagates arbitrary
> data over a link-local) and correctly populates dnsmasq lease database
> on startup (since leasefile-ro makes dnsmasq call the script with "init"
> arg)
> it also accepts "add" actions and such, and instantly propagates leases
> to the rest of the nodes.
> Problem is, there's no way to update dnsmasq internal database from
> outside (i.e. when alfred gets new info from another node); SIGHUP will
> not make dnsmasq call dhcp-script "init", only a full restart will do,
> and we'd rather not kill and respawn dnsmasq whenever a new lease is
> given in any part of the cloud :P
> Simon, any chance of having dnsmasq call "init" on dhcp-script (or
> lua-hook, if it's simpler) when getting a SIGHUP (or another, dedicated
> signal, for that matter)?

Calling "init" after startup would be "interesting" to implement. All 
the other script calls apart from "init", are handled by a separate 
process. This is for two reasons: 1) It allows the script calls to be as 
root, even when the main dnsmasq daemon drops root. 2) It makes a queue 
of events, so that the main dnsmasq process doesn't block whilst the 
script is running. This architecture makes it pretty much impossible to 
pass information from the script back to dnsmasq.

The "init" call is done from the main dnsmasq process, before it drops 
root, and before it has to worry about being blocked. Running "init" 
again that way isn't possible, for obvious reasons.

I wonder is a better solution would be to use DBus for IPC? We could add 
an "Update lease-database row" method to the DBus interface. That would 
eliminate most of the problems, and might work better than having to 
reload the whole database each time it changes. How does that sound?



> I hope my description of why that'd be highly desirable was
> understandable :)
> Hope you're having a nice weekend!
> Gui
> [0]: http://dev.libre-mesh.org/
> [1]:
> http://sindominio.net/hackmeeting/wiki/2013/Nodos/Libre-mesh:_metafirmware_OpenWrt_para_cualquier_comunidad_WiFi_del_mundo
> [2]:
> https://github.com/libre-mesh/lime-packages/blob/master/packages/lime-dnsmasq-lease-share/src/dnsmasq-lease-share.lua
> [3]: http://www.open-mesh.org/projects/alfred
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

More information about the Dnsmasq-discuss mailing list