[kea-dev] Is it possible to define custom arguments in hooks and have those saved with the lease?

Tomek Mrugalski tomasz at isc.org
Wed Oct 11 08:36:25 UTC 2017

W dniu 11.10.2017 o 04:11, Dave Cole pisze:
> With the hook we are developing here we extract values from Option 82
> and publish them to Kafka.  This works quite well, but it occurred to me
> that it would be very useful if we could have the Option82 value saved
> in PostgreSQL along with the lease.
> From my initial reading of the code it seems that it is not possible. 
> To me, the necessary changes to support the function (for us) would be
> in AllocEngine::createLease4 so that the CalloutHandlePtr was passed
> into LeaseMgrFactory::addLease.  From there it would be necessary to
> have the ability to dynamically extend (via confirguration)
> the createBindForSend so that extra columns could be bound to arguments
> populated via setArgument in previous hooks.

> Am I completely wrong in my assessment?
You are right, it is not possible right now. Of course this is a
software, so with enough effort put in, anything is possible.

> Is there a way to do what I want already?

If you are considering writing a hook that saves extra information, I
think a pkt4_send would be the place to start. At that time the lease is
already inserted, so you could update the table by calling SQL update
command. Yes, it's would have performance impact and this would double
the number of queries needed for lease insertion, but on the other hand
update shouldn't be as costly as insert.

ISC will one day implement a capability to store extra information. You
want some option 82 values, but there are people who want other things
to be stored. So I think we'd go with an expression. User would specify
what exactly he wants, and that expression would be evaluated for each
incoming packet and would be stored for new leases (or when lease is


More information about the kea-dev mailing list