summaryrefslogtreecommitdiff
path: root/server/db.c
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2010-02-03 23:25:25 +0000
committerDavid Hankins <dhankins@isc.org>2010-02-03 23:25:25 +0000
commitfdfebedf3e1e048d6f12a2332a72156c28ace88b (patch)
tree01347d8bf5ee2fd5c28f8e3cd0a87fba3976a246 /server/db.c
parent176c2a7d2d6f65597ce9957456b1b3371b5fd3f9 (diff)
downloadisc-dhcp-fdfebedf3e1e048d6f12a2332a72156c28ace88b.tar.gz
- An optimization described in the failover protocol draft is now included,
which permits a DHCP server operating in communications-interrupted state to 'rewind' a lease to the state most recently transmitted to its peer, greatly increasing a server's endurance in communications-interrupted. This is supported using a new 'rewind state' record on the dhcpd.leases entry for each lease. [ISC-Bugs #19601]
Diffstat (limited to 'server/db.c')
-rw-r--r--server/db.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/db.c b/server/db.c
index b5dc7e5f..9a903e04 100644
--- a/server/db.c
+++ b/server/db.c
@@ -168,6 +168,20 @@ int write_lease (lease)
: "abandoned")) < 0)
++errors;
+ /*
+ * In this case, if the rewind state is not present in the lease file,
+ * the reader will use the current binding state as the most
+ * conservative (safest) state. So if the in-memory rewind state is
+ * for some reason invalid, the best thing to do is not to write a
+ * state and let the reader take on a safe state.
+ */
+ if ((lease->binding_state != lease->rewind_binding_state) &&
+ (lease->rewind_binding_state > 0) &&
+ (lease->rewind_binding_state <= FTS_LAST) &&
+ (fprintf(db_file, "\n rewind binding state %s;",
+ binding_state_names[lease->rewind_binding_state-1])) < 0)
+ ++errors;
+
if (lease->flags & RESERVED_LEASE)
if (fprintf(db_file, "\n reserved;") < 0)
++errors;