summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2006-05-05 20:09:13 +0000
committerDavid Hankins <dhankins@isc.org>2006-05-05 20:09:13 +0000
commit007852ed4eb8ccf448266640df2bdf74e491bd10 (patch)
tree69656a01a44257fe1e9716a27fd05202d4c7d625
parente82217e1d046ecb8cc98a4ddb67452c6d0c07335 (diff)
downloadisc-dhcp-007852ed4eb8ccf448266640df2bdf74e491bd10.tar.gz
- Added additional fatal error sanity checks surrounding lease binding
state count calculations (free/active counts used for failover pool balancing). [ISC Bugs #15898]
-rw-r--r--RELNOTES4
-rw-r--r--server/mdb.c32
2 files changed, 24 insertions, 12 deletions
diff --git a/RELNOTES b/RELNOTES
index a52185b8..d56a6329 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -89,6 +89,10 @@ and for prodding me into improving it.
was raised from 0 to 300. 0 is not thought to be sensible, and is
known to be damaging.
+- Added additional fatal error sanity checks surrounding lease binding
+ state count calculations (free/active counts used for failover pool
+ balancing).
+
Changes since 3.0.4rc1
- The dhcp-options.5 manpage was updated to correct indentation errors
diff --git a/server/mdb.c b/server/mdb.c
index 83984ef7..49627fb9 100644
--- a/server/mdb.c
+++ b/server/mdb.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.67.2.25 2005/10/10 16:56:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.67.2.26 2006/05/05 20:09:13 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1031,14 +1031,13 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate)
}
if (!lp) {
- log_error ("Lease with binding state %s not on its queue.",
- (comp -> binding_state < 1 ||
- comp -> binding_state > FTS_LAST)
- ? "unknown"
- : binding_state_names [comp -> binding_state - 1]);
- return 0;
+ log_fatal("Lease with binding state %s not on its queue.",
+ (comp->binding_state < 1 ||
+ comp->binding_state > FTS_LAST)
+ ? "unknown"
+ : binding_state_names[comp->binding_state - 1]);
}
-
+
if (prev) {
lease_dereference (&prev -> next, MDL);
if (comp -> next) {
@@ -2037,10 +2036,19 @@ void expire_all_pools ()
for (l = *(lptr [i]); l; l = l -> next) {
p -> lease_count++;
if (l -> ends <= cur_time) {
- if (l -> binding_state == FTS_FREE)
- p -> free_leases++;
- else if (l -> binding_state == FTS_BACKUP)
- p -> backup_leases++;
+ if (l->binding_state == FTS_FREE) {
+ if (i == FREE_LEASES)
+ p->free_leases++;
+ else
+ log_fatal("Impossible case "
+ "at %s:%d.", MDL);
+ } else if (l->binding_state == FTS_BACKUP) {
+ if (i == BACKUP_LEASES)
+ p->backup_leases++;
+ else
+ log_fatal("Impossible case "
+ "at %s:%d.", MDL);
+ }
}
#if defined (FAILOVER_PROTOCOL)
if (p -> failover_peer &&