]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[master] Disable load balancing when load balance max secs is 0
authorThomas Markwalder <tmark@isc.org>
Mon, 27 Nov 2017 12:18:48 +0000 (07:18 -0500)
committerThomas Markwalder <tmark@isc.org>
Mon, 27 Nov 2017 12:18:48 +0000 (07:18 -0500)
    Merges in rt39669.

RELNOTES
server/dhcpd.conf.5
server/failover.c

index bd1a14a4f0db48eb1a27cb79279ef575634dd4ac..e52051d3117321983fd79a979e78049ee405710f 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -177,6 +177,12 @@ dhcp-users@lists.isc.org.
   the MPL 2.0 license terms.
   [ISC-Bugs #45541]
 
+- Load balancing for failover peers can now be disabled by setting
+  "load balance max secs" to 0. Doing so for both peers means both
+  servers will respond to all DHCPDISCOVERs or DHCPREQUESTs as soon as
+  they are received.
+  [ISC-Bugs #39669]
+
                        Changes since 4.3.0 (bug fixes)
 
 - Tidy up several small tickets.
index a5ab07e2e12fb2be8066074edf43276850ec4b37..02f854a932566d9fa61aa7ce228fa30ef3eb6149 100644 (file)
@@ -749,6 +749,10 @@ failover peers gets into a state where it is responding to failover
 messages but not responding to some client requests, the other
 failover peer will take over its client load automatically as the
 clients retry.
+.PP
+It is possible to disable load balancing between peers by setting this
+value to 0 on both peers.  Bear in mind that this means both peers will
+respond to all DHCPDISCOVERs or DHCPREQUESTs.
 .RE
 .PP
 The
index 6630660db9633179e861d7a8bd1fffba37eaa83d..25e1b72b5ed1705981fa7867d7c6172daa27f5a0 100644 (file)
@@ -76,11 +76,19 @@ void dhcp_failover_sanity_check() {
                                   state->name);
                        fail_count++;
                }
+
+               if (state->load_balance_max_secs == 0) {
+                       log_info ("WARNING: load balancing will be disabled "
+                                  "for failover peer, %s, "
+                                 "because its load balance max secs is 0",
+                                 state->name);
+               }
        }
 
        if (fail_count) {
                log_fatal ("Failover configuration sanity check failed");
        }
+
 }
 
 void dhcp_failover_startup ()
@@ -5968,7 +5976,8 @@ int load_balance_mine (struct packet *packet, dhcp_failover_state_t *state)
        }
 #endif
 
-       if (state->load_balance_max_secs < ec) {
+       if ((state->load_balance_max_secs == 0) ||
+           (state->load_balance_max_secs < ec)) {
                return (1);
        }