]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Dynamic BOOTP leases are now load balanced in failover. [ISC-Bugs #17079]
authorDavid Hankins <dhankins@isc.org>
Wed, 3 Oct 2007 20:15:15 +0000 (20:15 +0000)
committerDavid Hankins <dhankins@isc.org>
Wed, 3 Oct 2007 20:15:15 +0000 (20:15 +0000)
RELNOTES
server/bootp.c

index fb8944b666b7ee9ca83bc707fbfa6506c33ada0e..41c2e2cc36b10233c45d603ed36f4564f4fc8fd4 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -241,6 +241,8 @@ suggested fixes to <dhcp-users@isc.org>.
 - The FQDN option is only supplied if the client supplied an FQDN option or
   if the FQDN option was explicitly requested on the PRL.
 
+- Dynamic BOOTP leases are now load balanced in failover.
+
                        Changes since 3.1.0rc1
 
 - The parse warning that 'deny dyanmic bootp;' must be configured for
index 3a48cb4d1637ec7176390d330d01add467bc989d..24afe9399376dae4408428a1e0d8ae30d4cfb21d 100644 (file)
@@ -86,6 +86,7 @@ void bootp (packet)
 
        if (!lease || ((lease->flags & STATIC_LEASE) == 0)) {
                struct host_decl *h;
+
                /* We didn't find an applicable fixed-address host
                   declaration.  Just in case we may be able to dynamically
                   assign an address, see if there's a host declaration
@@ -117,12 +118,39 @@ void bootp (packet)
                                        packet -> shared_network -> pools,
                                        &peer_has_leases);
 
-               if (lease)
-                       ack_lease (packet, lease, 0, 0, msgbuf, 0, hp);
-               else
-                       log_info ("%s: BOOTP from dynamic client and no "
-                                 "dynamic leases", msgbuf);
+               if (lease == NULL) {
+                       log_info("%s: BOOTP from dynamic client and no "
+                                "dynamic leases", msgbuf);
+                       goto out;
+               }
+
+#if defined(FAILOVER_PROTOCOL)
+               if ((lease->pool != NULL) &&
+                   (lease->pool->failover_peer != NULL)) {
+                       dhcp_failover_state_t *peer;
+
+                       peer = lease->pool->failover_peer;
+
+                       /* If we are in a failover state that bars us from
+                        * answering, do not do so.
+                        * If we are in a cooperative state, load balance
+                        * (all) responses.
+                        */
+                       if ((peer->service_state == not_responding) ||
+                           (peer->service_state == service_startup)) {
+                               log_info("%s: not responding%s",
+                                        msgbuf, peer->nrr);
+                               goto out;
+                       } else if((peer->service_state == cooperating) &&
+                                 !load_balance_mine(packet, peer)) {
+                               log_info("%s: load balance to peer %s",
+                                        msgbuf, peer->name);
+                               goto out;
+                       }
+               }
+#endif
 
+               ack_lease (packet, lease, 0, 0, msgbuf, 0, hp);
                goto out;
        }