summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hankins <dhankins@isc.org>2007-10-03 20:16:06 +0000
committerDavid Hankins <dhankins@isc.org>2007-10-03 20:16:06 +0000
commitd137be33ac7e5e4ebce41f56dd17c66a9a347f4d (patch)
treead5fc4b522c6f8dada93039459d629f53de8fdc8
parent776399c38bc72a072e052582b0f3a25af7d80afc (diff)
downloadisc-dhcp-d137be33ac7e5e4ebce41f56dd17c66a9a347f4d.tar.gz
- Dynamic BOOTP leases are now load balanced in failover. [ISC-Bugs #17079]
-rw-r--r--RELNOTES2
-rw-r--r--server/bootp.c40
2 files changed, 36 insertions, 6 deletions
diff --git a/RELNOTES b/RELNOTES
index 5f034b6b..097a3595 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -74,6 +74,8 @@ the README file.
- 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
diff --git a/server/bootp.c b/server/bootp.c
index 6976f6d1..8eae4778 100644
--- a/server/bootp.c
+++ b/server/bootp.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: bootp.c,v 1.76 2006/08/09 14:57:48 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: bootp.c,v 1.76.2.1 2007/10/03 20:16:06 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -90,6 +90,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
@@ -121,12 +122,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;
}