summaryrefslogtreecommitdiff
path: root/server/mdb.c
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-10-25 01:55:40 +0000
committerTed Lemon <source@isc.org>1999-10-25 01:55:40 +0000
commit394d5a3dc103bf37eaab79a53d03ed4ec9531548 (patch)
tree9d892e8a97c2181f927a15dcfac522c5c9d9e273 /server/mdb.c
parentb86799bfcb271b832dc0988f77c7e11a6518cdcc (diff)
downloadisc-dhcp-394d5a3dc103bf37eaab79a53d03ed4ec9531548.tar.gz
Clean up deleted vs. undeleted leases.
Diffstat (limited to 'server/mdb.c')
-rw-r--r--server/mdb.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/server/mdb.c b/server/mdb.c
index 57bb07ef..9ed3e077 100644
--- a/server/mdb.c
+++ b/server/mdb.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.13 1999/10/24 23:27:52 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.14 1999/10/25 01:55:40 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -68,7 +68,7 @@ isc_result_t enter_host (hd, dynamicp, commit)
/* If the old entry wasn't dynamic, then we
always have to keep the deletion. */
if (!hp -> flags & HOST_DECL_DYNAMIC)
- hd -> flags &= ~HOST_DECL_DYNAMIC;
+ hd -> flags |= HOST_DECL_STATIC;
}
/* If there isn't already a host decl matching this
@@ -292,7 +292,7 @@ isc_result_t delete_host (hd, commit)
strlen (hd -> name));
if (hp) {
- if (hp == hd && (hp -> flags & HOST_DECL_DYNAMIC)) {
+ if (hp == hd && !(hp -> flags & HOST_DECL_STATIC)) {
delete_hash_entry (host_name_hash,
(unsigned char *)hd -> name,
strlen (hd -> name));
@@ -1385,20 +1385,31 @@ void write_leases ()
}
}
- /* Write all the dynamically-created group declarations. */
+ /* Write all the deleted host declarations. */
if (host_name_hash) {
for (i = 0; i < host_name_hash -> hash_count; i++) {
for (hb = host_name_hash -> buckets [i];
hb; hb = hb -> next) {
hp = (struct host_decl *)hb -> value;
- if ((hp -> flags & HOST_DECL_DYNAMIC) ||
- (!(hp -> flags & HOST_DECL_DYNAMIC) &&
+ if (((hp -> flags & HOST_DECL_STATIC) &&
(hp -> flags & HOST_DECL_DELETED)))
write_host (hp);
}
}
}
+ /* Write all the new, dynamic host declarations. */
+ if (host_name_hash) {
+ for (i = 0; i < host_name_hash -> hash_count; i++) {
+ for (hb = host_name_hash -> buckets [i];
+ hb; hb = hb -> next) {
+ hp = (struct host_decl *)hb -> value;
+ if ((hp -> flags & HOST_DECL_DYNAMIC))
+ write_host (hp);
+ }
+ }
+ }
+
/* Write all the leases. */
for (s = shared_networks; s; s = s -> next) {
for (p = s -> pools; p; p = p -> next) {