[Dnsmasq-discuss] Distributed lease database on a mesh, using batman-adv alfred
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 idea, this
> weekend at a HackMeeting 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 to be used as a --dhcp-script, that
> talks to alfred (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"
> 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!
> : http://dev.libre-mesh.org/
> : http://www.open-mesh.org/projects/alfred
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
More information about the Dnsmasq-discuss