mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-22 09:57:20 +00:00
- The peer_wants_leases() changes pulled up from 3.1.0 were corrected,
'never used' leases will no longer consistently shift between servers on every pool rebalance run. [ISC-Bugs #17211]
This commit is contained in:
parent
f765ec3672
commit
edb1283e10
4
RELNOTES
4
RELNOTES
@ -57,6 +57,10 @@ suggested fixes to <dhcp-users@isc.org>.
|
|||||||
- A number of bugs with the internal handling of lease state on the
|
- A number of bugs with the internal handling of lease state on the
|
||||||
server have been fixed. Some of these could cause server crashes.
|
server have been fixed. Some of these could cause server crashes.
|
||||||
|
|
||||||
|
- The peer_wants_leases() changes pulled up from 3.1.0 were corrected,
|
||||||
|
'never used' leases will no longer consistently shift between servers
|
||||||
|
on every pool rebalance run.
|
||||||
|
|
||||||
Changes since 4.0.0a3
|
Changes since 4.0.0a3
|
||||||
|
|
||||||
- The DHCP server no longer requires a "ddns-update-style" statement,
|
- The DHCP server no longer requires a "ddns-update-style" statement,
|
||||||
|
@ -2362,17 +2362,40 @@ static int dhcp_failover_pool_dobalance(dhcp_failover_state_t *state)
|
|||||||
pass = 0;
|
pass = 0;
|
||||||
lease_reference(&lp, *lq, MDL);
|
lease_reference(&lp, *lq, MDL);
|
||||||
|
|
||||||
/* In the case where there are 2 leases, hold is zero, and
|
while (lp) {
|
||||||
* lts is 1 if both leases are on the local server. If
|
|
||||||
* there is only 1 lease, both lts and hold are zero. Let's
|
|
||||||
* not play ping pong.
|
|
||||||
*/
|
|
||||||
while (lp && (lts > (pass ? hold : -hold))) {
|
|
||||||
if (next)
|
if (next)
|
||||||
lease_dereference(&next, MDL);
|
lease_dereference(&next, MDL);
|
||||||
if (lp->next)
|
if (lp->next)
|
||||||
lease_reference(&next, lp->next, MDL);
|
lease_reference(&next, lp->next, MDL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stop if the pool is 'balanced enough.'
|
||||||
|
*
|
||||||
|
* The pool is balanced enough if:
|
||||||
|
*
|
||||||
|
* 1) We're on the first run through and the peer has
|
||||||
|
* its fair share of leases already (lts reaches
|
||||||
|
* -hold).
|
||||||
|
* 2) We're on the second run through, we are shifting
|
||||||
|
* never-used leases, and there is a perfectly even
|
||||||
|
* balance (lts reaches zero).
|
||||||
|
* 3) Second run through, we are shifting previously
|
||||||
|
* used leases, and the local system has its fair
|
||||||
|
* share but no more (lts reaches hold).
|
||||||
|
*
|
||||||
|
* Note that this is implemented below in 3,2,1 order.
|
||||||
|
*/
|
||||||
|
if (pass) {
|
||||||
|
if (lp->ends) {
|
||||||
|
if (lts <= hold)
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
if (lts <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (lts <= -hold)
|
||||||
|
break;
|
||||||
|
|
||||||
if (pass || peer_wants_lease(lp)) {
|
if (pass || peer_wants_lease(lp)) {
|
||||||
--lts;
|
--lts;
|
||||||
++leases_queued;
|
++leases_queued;
|
||||||
@ -5512,8 +5535,8 @@ peer_wants_lease(struct lease *lp)
|
|||||||
*/
|
*/
|
||||||
hbaix = loadb_p_hash(lp->hardware_addr.hbuf + 1,
|
hbaix = loadb_p_hash(lp->hardware_addr.hbuf + 1,
|
||||||
lp->hardware_addr.hlen - 1);
|
lp->hardware_addr.hlen - 1);
|
||||||
else /* Consistent 50/50 split */
|
else /* impossible to categorize into LBA */
|
||||||
return(lp->ip_addr.iabuf[lp->ip_addr.len-1] & 0x01);
|
return 0;
|
||||||
|
|
||||||
hm = state->hba[(hbaix >> 3) & 0x1F] & (1 << (hbaix & 0x07));
|
hm = state->hba[(hbaix >> 3) & 0x1F] & (1 << (hbaix & 0x07));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user