[Dnsmasq-discuss] Interested in event trigger patch

Simon Kelley simon@thekelleys.org.uk
Sat, 04 Jun 2005 20:06:50 +0100

Dan Flett wrote:
> Hello Quasar, hello list,
> I'm interested in the patch that allows dnsmasq to run an external
> script/program when an event occurs on a DHCP lease.  I will be
> experimenting with autoconfiguring BGP on a community wireless network.  The
> patch will allow a client to pass it's BGP ASN as it's Client ID to the
> DNSMasq DHCP server - DNSMasq can then trigger a script that parses the
> lease file to get the ASN and pass it to the routing program (Quagga).  At
> the same time, DNSMasq sends the BGP ASN of the host on which it is running
> to the newly-connected client as the "bootfile" option (option 67).  The
> client, running udhcpc, runs its own script to obtain the server's ASN
> (which it sent as the "bootfile" option) and passes it on to it's own
> instance of Quagga.
> I am mentioning this on the list in case anyone else is interested and has a
> better suggestion as to how to do this.  I'm guessing I have to be careful
> about parameter escaping here!
> Quasar, please email me your patch. :)
> I was just about to ask for this as a feature request, then I did a search
> of the archives and saw some fairly convincing arguments against a very
> similar proposal.  I like the D-Bus idea, so long as it can fit on a Linksys
> WRT54G :).

I'd say that the DBUS option would work well, long term.

If you believe the documentation, dbus is designed to work well on 
embedded systems. The current dbus daemon is about the same size is 
dnsmasq. Importantly, it _doesn't_ depend on half of gnome. So it should 
fit onto a Linksys box nicely.

If you want to play, the current test version of dnsmasq in 
http://www.thekelleys.org.uk/dnsmasq-test has some DBUS stuff. It 
doesn't currently do anything  with DHCP, but the integration of the 
DBUS event loop is all done, and the DNS<->DBUS code provides an example 
of how to call DBUS.

You might like to think about using vendor-defined DHCP options for 
apssing the BGP stuff around, rather than (ab)using client-id and 
bootfile options. You would have to patch the client in that case, but 
it would be cleaner.