shane at time-travellers
Aug 13, 2012, 11:03 AM
Post #9 of 9
Gert and all,
On Monday, 2012-08-13 17:42:17 +0200,
Gert Doering <gert [at] space> wrote:
> On Sun, Aug 12, 2012 at 11:07:42AM +0200, Oliver wrote:
> > The ISC suite implements "OMAPI" for reading/writing/trapping on
> > events - you should be able to write a monitoring daemon that
> > connects to OMAPI for the purposes of being notified about PDs that
> > have been handed out; much cleaner than poking a leases file :)
> Will the dhcpd actually *notify* the client of changes? From reading
> omapi(3), this very much looks like a "command/response" interface,
> with no way to install callbacks / select on "activity".
> Better than parsing the dhcpd.leases file, maybe, but much worse to
> use a polling interface than just passively wait for the dhcpd.leases
> file to change (inotify etc).
> A callback handler that runs an arbitrary command (e.g. script) with
> some well-defined environment would be the right way forward...
I asked the ISC DHCP team, and got the following answer:
ISC DHCP4 code does support execute statement. Although I haven't
done it myself, my understanding is that it can be done. In
particular, quick look at common/execute.c indicates that we seem to
support on-commit, on-release and on-expiry, so all cases are
covered. I assume that assigned options are passed to that script. I
haven't checked if it is possible to to call execute() on both
client and server (it should be).
The other open source that does support calling external scripts is
Dibbler. The approach is very similar - external script can be
called whenever something happens to a lease.
Sadly, the DHCP documentation is a bit lacking right now. We've started
on a Administrator's Reference Manual, which will include explanations
of this sort of thing along with examples.