]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[v4_1_esv] Server will move FTS_BACKUP to FTS_FREE when pool has no peer
authorThomas Markwalder <tmark@isc.org>
Wed, 10 Dec 2014 21:32:24 +0000 (16:32 -0500)
committerThomas Markwalder <tmark@isc.org>
Wed, 10 Dec 2014 21:32:24 +0000 (16:32 -0500)
    Merges in rt36960.  Note that for v4_1_esv a new compile switch,
    CONVERT_BACKUP_TO_FREE, was created which must be defined to
    enable the conversion of leases.  It is off by default.

RELNOTES
includes/site.h
server/mdb.c

index 19e26538ada81d60d2300f4e0fdcc334adf9a620..02dfcaf3b71a657333465d9e2a6fa01202a30a1b 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -143,6 +143,16 @@ by Eric Young (eay@cryptsoft.com).
   components.
   [ISC-Bugs #20558]
 
+- During startup, when the server encounters a lease whose binding state is
+  FTS_BACKUP but whose pool has no configured failover peer, it will reset the
+  lease's binding state to FTS_FREE.  This allows the leases to be reclaimed
+  by the server after a pool's configuration has changed from failover to
+  standalone. Prior to this such leases would remain stuck in the backup state
+  making them unavailable for assignment.  This behavior is off by default.
+  It is enabled by defining CONVERT_BACKUP_TO_FREE in includes/site.h and
+  will occur whether or not the server is compiled for failover.
+  [ISC-Bugs #36960]
+
                        Changes since 4.1-ESV-R10rc1
 
 - None
index 6a5b724ef74182a168cc7595e7d92b7568f08e1a..c4168f811816fd76585221739a5fa41e3fcf3299 100644 (file)
    64 indicates that the first 64 bits are the subnet or on-link
    prefix. */
 #define DHCLIENT_DEFAULT_PREFIX_LEN 64
+
+/* Enable conversion at startup of leases from FTS_BACKUP to FTS_FREE
+   when either their pool has no configured failover peer or 
+   FAILOVER_PROTOCOL is not enabled.  This allows the leases to be
+   reclaimed by the server after a pool's configuration has changed
+   from failover to standalone. Prior to this such leases would remain
+   stuck in the backup state. */
+/* #define CONVERT_BACKUP_TO_FREE */
+
index 4bb7117641950309b8bee63a1712410cbcebfe16..b605ed5110c0c9936dafa86b0ad28a9255047333 100644 (file)
@@ -2475,6 +2475,23 @@ lease_instantiate(const void *key, unsigned len, void *object)
                                     lease->ip_addr.len, MDL);
                return ISC_R_SUCCESS;
        }
+
+#if defined (CONVERT_BACKUP_TO_FREE)
+#if defined (FAILOVER_PROTOCOL)
+       /* If the lease is in FTS_BACKUP but there is no peer, then the
+        * pool must have been formerly configured for failover and
+        * is now configured as standalone. This means we need to
+        * move the lease to FTS_FREE to make it available. */
+       if ((lease->binding_state == FTS_BACKUP) && 
+           (lease->pool->failover_peer == NULL)) {
+#else
+       /* We aren't compiled for failover, so just move to FTS_FREE */
+       if (lease->binding_state == FTS_BACKUP) { 
+#endif
+               lease->binding_state = FTS_FREE;
+               lease->next_binding_state = FTS_FREE;
+       }
+#endif
                
        /* Put the lease on the right queue.  Failure to queue is probably
         * due to a bogus binding state.  In such a case, we claim success,