From d1a5975f9b2a4a843186daf6dd6753ff8ab399d5 Mon Sep 17 00:00:00 2001 From: Simon Kelley Date: Mon, 5 Nov 2012 16:50:30 +0000 Subject: [PATCH] No lease-time in DHCPINFORM replies. --- CHANGELOG | 4 ++++ src/rfc2131.c | 11 +---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2de505e..42f7f73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -45,7 +45,11 @@ version 2.64 subnet, --dhcp-range=::,static Useful for Stateless DHCPv6. Thanks to Vladislav Grishenko for the patch. + Don't include lease-time in DHCPACK replies to DHCPINFORM + queries, since RFC-2131 says we shouldn't. Thanks to + Wouter Ibens for pointing this out. + version 2.63 Do duplicate dhcp-host address check in --test mode. diff --git a/src/rfc2131.c b/src/rfc2131.c index 250b1ab..9816e29 100644 --- a/src/rfc2131.c +++ b/src/rfc2131.c @@ -1387,6 +1387,7 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, if (lease) { + lease_set_interface(lease, int_index, now); if (override.s_addr != 0) lease->override = override; else @@ -1397,16 +1398,6 @@ size_t dhcp_reply(struct dhcp_context *context, char *iface_name, int int_index, option_put(mess, end, OPTION_MESSAGE_TYPE, 1, DHCPACK); option_put(mess, end, OPTION_SERVER_IDENTIFIER, INADDRSZ, ntohl(server_id(context, override, fallback).s_addr)); - if (lease) - { - if (lease->expires == 0) - time = 0xffffffff; - else - time = (unsigned int)difftime(lease->expires, now); - option_put(mess, end, OPTION_LEASE_TIME, 4, time); - lease_set_interface(lease, int_index, now); - } - do_options(context, mess, end, req_options, hostname, get_domain(mess->ciaddr), netid, subnet_addr, fqdn_flags, borken_opt, pxearch, uuid, vendor_class_len, now);