2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-04 08:15:14 +00:00

Tweak load balance handling.

This commit is contained in:
Ted Lemon
2000-08-31 04:40:55 +00:00
parent 3505ef685d
commit 0142936f90

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dhcp.c,v 1.161 2000/08/28 19:36:10 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: dhcp.c,v 1.162 2000/08/31 04:40:55 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -293,16 +293,12 @@ void dhcprequest (packet, ms_nulltp)
} }
if (peer -> service_state == cooperating) { if (peer -> service_state == cooperating) {
/* XXX */ /* XXX */
/* We have to ignore load balancing for /* If the client is in RENEWING state and sends
clients with giaddr set to zero because us a DHCPREQUEST, we're going to ignore it,
we need to respond to clients in RENEWING so it's going to have to fall back to REBINDING
state, that the other server can't hear, state before it can get a response from the
but not to clients in REBINDING state, other server. Ick. */
which the other server _can_ hear, but if (!load_balance_mine (packet, peer)) {
we can't tell which state the client is
in if it's on the local network. */
if (packet -> raw -> giaddr.s_addr == 0 ||
!load_balance_mine (packet, peer)) {
log_debug ("%s: load balance to peer %s", log_debug ("%s: load balance to peer %s",
msgbuf, peer -> name); msgbuf, peer -> name);
goto out; goto out;
@@ -1654,19 +1650,21 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
XXX What do we do in this case? XXX What do we do in this case?
XXX should the expiry timer on the lease XXX should the expiry timer on the lease
XXX set tsfp and tstp to zero? */ XXX set tsfp and tstp to zero? */
if (lease -> tsfp == 0) if (lease -> tsfp < cur_time) {
lease_time = peer -> mclt; lease_time = peer -> mclt;
else } else {
lease_time = (lease -> tsfp - cur_time lease_time = (lease -> tsfp - cur_time
+ peer -> mclt); + peer -> mclt);
}
} else { } else {
if (cur_time + lease_time > lease -> tsfp && if (cur_time + lease_time > lease -> tsfp &&
lease_time > peer -> mclt / 2) lease_time > peer -> mclt / 2) {
lt -> tstp = (cur_time + lease_time + lt -> tstp = (cur_time + lease_time +
peer -> mclt / 2); peer -> mclt / 2);
else } else {
lt -> tstp = (cur_time + lease_time + lt -> tstp = (cur_time + lease_time +
lease_time / 2); lease_time / 2);
}
} }
lt -> cltt = cur_time; lt -> cltt = cur_time;