diff options
author | David Hankins <dhankins@isc.org> | 2006-05-05 20:09:13 +0000 |
---|---|---|
committer | David Hankins <dhankins@isc.org> | 2006-05-05 20:09:13 +0000 |
commit | 007852ed4eb8ccf448266640df2bdf74e491bd10 (patch) | |
tree | 69656a01a44257fe1e9716a27fd05202d4c7d625 | |
parent | e82217e1d046ecb8cc98a4ddb67452c6d0c07335 (diff) | |
download | isc-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-- | RELNOTES | 4 | ||||
-rw-r--r-- | server/mdb.c | 32 |
2 files changed, 24 insertions, 12 deletions
@@ -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 && |