]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't prematurely expire a lease just because a client starts out in INIT.
authorTed Lemon <source@isc.org>
Fri, 12 Nov 1999 17:17:16 +0000 (17:17 +0000)
committerTed Lemon <source@isc.org>
Fri, 12 Nov 1999 17:17:16 +0000 (17:17 +0000)
server/dhcp.c

index ed278485ffb9e038cba29fea994be008ff8726e0..9750661ca933a5decc86d528889744b316aa7a6f 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.126 1999/11/07 20:32:03 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.127 1999/11/12 17:17:16 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -71,6 +71,7 @@ void dhcpdiscover (packet)
 {
        struct lease *lease;
        char msgbuf [1024];
+       TIME when;
 
        sprintf (msgbuf, "DHCPDISCOVER from %s via %s",
                 print_hw_addr (packet -> raw -> htype,
@@ -103,7 +104,13 @@ void dhcpdiscover (packet)
                }
        }
 
-       ack_lease (packet, lease, DHCPOFFER, cur_time + 120, msgbuf);
+       /* Set the lease to really expire in 2 minutes, unless it has
+          not yet expired, in which case leave its expiry time alone. */
+       when = cur_time + 120;
+       if (when < lease -> ends)
+               when = lease -> ends;
+
+       ack_lease (packet, lease, DHCPOFFER, when, msgbuf);
 }
 
 void dhcprequest (packet)