logging the lease time *sent* to clients in an "on commit" block

Phil Mayers p.mayers at imperial.ac.uk
Fri May 18 15:44:34 UTC 2007


What syntax can I use to get the ACTUAL IP address lease time (option 
51) the server sends to the client? We have a need to do detailed 
logging of leases handed out including the lease time.

If I use:

on commit {
   set macaddr = binary-to-ascii(16,8,":",substring(hardware,1,6));
   set ipaddr = binary-to-ascii(10,8,".",leased-address);

   set leasetime = pick-first-value(
     binary-to-ascii(10, 32, "", option dhcp-lease-time),

   set log-msg = concat(
     "commit ",
     " mac=", macaddr,
     " ip=", ipaddr,
     " leasetime=", leasetime
   log(info, log-msg);

...then it logs the client *requested* lease time, which is unset 99% of 
the time and in any event not definitive.

Using "config-option dhcp-lease-time" just gets me "null" i.e. it logs 
"unset" all the time.

More information about the dhcp-users mailing list