logging the lease time *sent* to clients in an "on commit" block
Christof Chen
christof at chen.de
Mon May 21 18:12:40 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.
A simple way to obtain this information is to append the lease end time to the
ACK/OFFER syslog line:
This patch is against 3.0.5 server/dhcp.c:
@@ -2832,7 +2883,7 @@
s = (char *)0;
/* Say what we're doing... */
- log_info ("%s on %s to %s %s%s%svia %s",
+ log_info ("%s on %s to %s %s%s%svia %s LE:%d",
(state -> offer
? (state -> offer == DHCPACK ? "DHCPACK" : "DHCPOFFER")
: "BOOTREPLY"),
@@ -2846,7 +2897,8 @@
s ? "(" : "", s ? s : "", s ? ") " : "",
(state -> giaddr.s_addr
? inet_ntoa (state -> giaddr)
- : state -> ip -> name));
+ : state -> ip -> name),
+ (int) lease -> ends);
/* Set up the hardware address... */
hto.hlen = lease -> hardware_addr.hlen;
Hope this helps.
Best regards,
Christof Chen
More information about the dhcp-users
mailing list