diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-12-29 14:36:05 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-12-29 14:36:05 +0000 |
commit | 1b4adbe6bbf2d89fdb7b33d71ae41dfcae163567 (patch) | |
tree | 986186449937ec19cbde29269d35863b71244d70 | |
parent | 84e1c81771e4b6571ab145763860a482897993b8 (diff) |
If no LEASE_TIME was received from the server, use the
default_lease_time (12 hours); I'm not entirely certain the fallback
is correct, but the RFC does not say what the client should do if no
LEASE_TIME is given by the server. Closes PR 1077
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/dhcp/dhclient/dhclient.c b/usr.sbin/dhcp/dhclient/dhclient.c index 7d585f49d7e..33cd3493066 100644 --- a/usr.sbin/dhcp/dhclient/dhclient.c +++ b/usr.sbin/dhcp/dhclient/dhclient.c @@ -56,7 +56,7 @@ #ifndef lint static char copyright[] = -"$Id: dhclient.c,v 1.11 2000/10/30 02:35:33 deraadt Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.12 2000/12/29 14:36:04 angelos Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -458,9 +458,12 @@ void dhcpack (packet) cancel_timeout (send_request, ip); /* Figure out the lease time. */ - ip -> client -> new -> expiry = - getULong (ip -> client -> - new -> options [DHO_DHCP_LEASE_TIME].data); + if (ip -> client -> new -> options [DHO_DHCP_LEASE_TIME].data) + ip -> client -> new -> expiry = + getULong (ip -> client -> + new -> options [DHO_DHCP_LEASE_TIME].data); + else + ip -> client -> new -> expiry = default_lease_time; /* Take the server-provided renewal time if there is one; otherwise figure it out according to the spec. */ |