From: Ted Lemon Date: Fri, 6 Nov 1998 01:04:32 +0000 (+0000) Subject: Don't test for abandoned lease if we didn't find a lease. Don't try to evaluate... X-Git-Tag: carrel-2~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ffcdd2a198def5a21f367b40b2726c7d997f82e;p=thirdparty%2Fdhcp.git Don't test for abandoned lease if we didn't find a lease. Don't try to evaluate an option cache if we didn't find it. --- diff --git a/server/dhcp.c b/server/dhcp.c index 6f4f062cb..5bd0ed7f5 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.68 1998/11/06 00:17:12 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.69 1998/11/06 01:04:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -733,10 +733,12 @@ void ack_lease (packet, lease, offer, when) /* Figure out how long a lease to assign. If this is a dynamic BOOTP lease, its duration must be infinite. */ if (offer) { - oc = lookup_option (packet -> options.dhcp_hash, - DHO_DHCP_LEASE_TIME); - s1 = evaluate_option_cache (&d1, packet, - &packet -> options, oc); + if ((oc = lookup_option (packet -> options.dhcp_hash, + DHO_DHCP_LEASE_TIME))) + s1 = evaluate_option_cache (&d1, packet, + &packet -> options, oc); + else + s1 = 0; if (s1 && d1.len == sizeof (u_int32_t)) { lease_time = getULong (d1.data); data_string_forget (&d1, "ack_lease"); @@ -1693,6 +1695,7 @@ struct lease *find_lease (packet, share, ours) if (have_client_identifier) data_string_forget (&client_identifier, "find_lease"); + #if defined (DEBUG_FIND_LEASE) if (lease) note ("Returning lease: %s.", @@ -1704,7 +1707,7 @@ struct lease *find_lease (packet, share, ours) /* If we find an abandoned lease, take it, but print a warning message, so that if it continues to lose, the administrator will eventually investigate. */ - if (lease -> flags & ABANDONED_LEASE) { + if (lease && lease -> flags & ABANDONED_LEASE) { warn ("Reclaiming REQUESTed abandoned IP address %s.\n", piaddr (lease -> ip_addr)); lease -> flags &= ~ABANDONED_LEASE;