]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- A bug was fixed where a server might load balance a DHCP REQUEST to its
authorDavid Hankins <dhankins@isc.org>
Wed, 2 Mar 2005 23:35:19 +0000 (23:35 +0000)
committerDavid Hankins <dhankins@isc.org>
Wed, 2 Mar 2005 23:35:19 +0000 (23:35 +0000)
  peer after already choosing not to load balance the preceeding DISCOVER.
  The peer cannot allocate the originating server's lease. (Merge from
  rt13624).

RELNOTES
server/dhcp.c

index 3f45ffd49a1d5196b37d63f0bc0b0102ecd5e03d..af8dfede1b7654851e9b0e1a9efe1b25ecbd3d23 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -43,8 +43,13 @@ 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
 
+- A bug was fixed where a server might load balance a DHCP REQUEST to its
+  peer after already choosing not to load balance the preceeding DISCOVER.
+  The peer cannot allocate the originating server's lease.
+
 - 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.
index 98690ab3806295c7301ab5fb9f65bf3d0b39fbe6..c2828d61c956bdd8647d3f1d514e529515e2e736 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.192.2.47 2005/03/02 23:30:37 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.192.2.48 2005/03/02 23:35:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -500,27 +500,25 @@ void dhcprequest (packet, ms_nulltp, ip_lease)
                                  msgbuf, peer -> nrr);
                        goto out;
                }
-               /* Don't load balance if the client is RENEWING or REBINDING.
-                  If it's RENEWING, we are the only server to hear it, so
-                  we have to serve it.   If it's REBINDING, it's out of
-                  communication with the other server, so there's no point
-                  in waiting to serve it.    However, if the lease we're
-                  offering is not a free lease, then we may be the only
-                  server that can offer it, so we can't load balance if
-                  the lease isn't in the free or backup state. */
-               if (peer -> service_state == cooperating &&
-                   !packet -> raw -> ciaddr.s_addr &&
-                   (lease -> binding_state == FTS_FREE ||
-                    lease -> binding_state == FTS_BACKUP)) {
-                       if (!load_balance_mine (packet, peer)) {
-                               log_debug ("%s: load balance to peer %s",
-                                          msgbuf, peer -> name);
-                               goto out;
-                       }
-               }
 
-               /* Don't let a client allocate a lease using DHCPREQUEST
-                  if the lease isn't ours to allocate. */
+               /* "load balance to peer" - is not done at all for request.
+                *
+                * If it's RENEWING, we are the only server to hear it, so
+                * we have to serve it.   If it's REBINDING, it's out of
+                * communication with the other server, so there's no point
+                * in waiting to serve it.    However, if the lease we're
+                * offering is not a free lease, then we may be the only
+                * server that can offer it, so we can't load balance if
+                * the lease isn't in the free or backup state.  If it is
+                * in the free or backup state, then that state is what
+                * mandates one server or the other should perform the
+                * allocation, not the LBA...we know the peer cannot
+                * allocate a request for an address in our free state.
+                *
+                * So our only compass is lease_mine_to_reallocate().  This
+                * effects both load balancing, and a sanity-check that we
+                * are not going to try to allocate a lease that isn't ours.
+                */
                if ((lease -> binding_state == FTS_FREE ||
                     lease -> binding_state == FTS_BACKUP) &&
                    !lease_mine_to_reallocate (lease)) {