summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2005-02-22 20:34:52 +0000
committerDavid Hankins <dhankins@isc.org>2005-02-22 20:34:52 +0000
commit7f6e34fd1a651c6586ffefeb86d3fd2447deed06 (patch)
treedb18dc974b647129e9ab5efeec3fd03c19efaa50
parenta90015796297b53b58406014d432e9755a91ae78 (diff)
downloadisc-dhcp-7f6e34fd1a651c6586ffefeb86d3fd2447deed06.tar.gz
- Version to "3.0.3-head".
- Merge from rt12977.
-rw-r--r--RELNOTES8
-rw-r--r--includes/failover.h2
-rw-r--r--server/failover.c27
3 files changed, 35 insertions, 2 deletions
diff --git a/RELNOTES b/RELNOTES
index 4f318f02..21cd225b 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -43,6 +43,14 @@ Murrell at BC Tel Advanced Communications. I'd like to express my
thanks to all of these good people here, both for working on the code
and for prodding me into improving it.
+ Changes since 3.0.2
+
+- In the case where a secondary server lost its stable storage while the
+ primary was still in communications-interrupted, and came back online,
+ the lease databases would not be fully transferred to the secondary.
+ This was due to the secondary errantly sending an extra UPDREQ message
+ when the primary made its state transition to PARTNER-DOWN known.
+
Changes since 3.0.2rc3
- A previously undocumented configuration directive, 'local-address',
diff --git a/includes/failover.h b/includes/failover.h
index 2fd880d1..62273412 100644
--- a/includes/failover.h
+++ b/includes/failover.h
@@ -307,6 +307,8 @@ typedef struct _dhcp_failover_state {
queue. */
int pool_count; /* Number of pools referencing this
failover state object. */
+ int curUPD; /* If an UPDREQ* message is in motion,
+ this value indicates which one. */
} dhcp_failover_state_t;
#define DHCP_FAILOVER_VERSION 1
diff --git a/server/failover.c b/server/failover.c
index 8b3db614..df1a4dfa 100644
--- a/server/failover.c
+++ b/server/failover.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: failover.c,v 1.53.2.35 2004/11/24 17:39:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: failover.c,v 1.53.2.36 2005/02/22 20:34:52 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1946,7 +1946,15 @@ isc_result_t dhcp_failover_peer_state_changed (dhcp_failover_state_t *state,
XXX clever detection of when we should send an
XXX UPDREQALL message rather than an UPDREQ
XXX message. What to do, what to do? */
- dhcp_failover_send_update_request (state);
+ /* Currently when we enter recover state, no matter
+ * the reason, we send an UPDREQALL. So, it makes
+ * the most sense to stick to that until something
+ * better is done.
+ * Furthermore, we only went to send the update
+ * request if we are not in startup state.
+ */
+ if (state -> me.state == recover)
+ dhcp_failover_send_update_request_all (state);
break;
case shut_down:
@@ -4338,11 +4346,17 @@ isc_result_t dhcp_failover_send_update_request (dhcp_failover_state_t *state)
if (!link -> outer || link -> outer -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
+ if (state -> curUPD)
+ return ISC_R_ALREADYRUNNING;
+
status = (dhcp_failover_put_message
(link, link -> outer,
FTM_UPDREQ,
(failover_option_t *)0));
+ if (status == ISC_R_SUCCESS)
+ state -> curUPD = FTM_UPDREQ;
+
#if defined (DEBUG_FAILOVER_MESSAGES)
if (status != ISC_R_SUCCESS)
failover_print (FMA, " (failed)");
@@ -4378,11 +4392,18 @@ isc_result_t dhcp_failover_send_update_request_all (dhcp_failover_state_t
if (!link -> outer || link -> outer -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
+ /* If there is an UPDREQ in progress, then upgrade to UPDREQALL. */
+ if (state -> curUPD && (state -> curUPD != FTM_UPDREQ))
+ return ISC_R_ALREADYRUNNING;
+
status = (dhcp_failover_put_message
(link, link -> outer,
FTM_UPDREQALL,
(failover_option_t *)0));
+ if (status == ISC_R_SUCCESS)
+ state -> curUPD = FTM_UPDREQALL;
+
#if defined (DEBUG_FAILOVER_MESSAGES)
if (status != ISC_R_SUCCESS)
failover_print (FMA, " (failed)");
@@ -4827,6 +4848,8 @@ dhcp_failover_process_update_done (dhcp_failover_state_t *state,
log_info ("failover peer %s: peer update completed.",
state -> name);
+ state -> curUPD = 0;
+
switch (state -> me.state) {
case unknown_state:
case partner_down: