From: David Hankins Date: Wed, 3 Oct 2007 20:15:15 +0000 (+0000) Subject: - Dynamic BOOTP leases are now load balanced in failover. [ISC-Bugs #17079] X-Git-Tag: v4_0_0b1~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c104546d56f643ee1fd6a456f2d784c565a64b03;p=thirdparty%2Fdhcp.git - Dynamic BOOTP leases are now load balanced in failover. [ISC-Bugs #17079] --- diff --git a/RELNOTES b/RELNOTES index fb8944b66..41c2e2cc3 100644 --- a/RELNOTES +++ b/RELNOTES @@ -241,6 +241,8 @@ suggested fixes to . - 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 3a48cb4d1..24afe9399 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -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; }