- A number of bugs with the internal handling of lease state on the
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
- The DHCP server no longer requires a "ddns-update-style" statement,
pass = 0;
lease_reference(&lp, *lq, MDL);
- /* In the case where there are 2 leases, hold is zero, and
- * 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))) {
+ while (lp) {
if (next)
lease_dereference(&next, MDL);
if (lp->next)
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)) {
--lts;
++leases_queued;
*/
hbaix = loadb_p_hash(lp->hardware_addr.hbuf + 1,
lp->hardware_addr.hlen - 1);
- else /* Consistent 50/50 split */
- return(lp->ip_addr.iabuf[lp->ip_addr.len-1] & 0x01);
+ else /* impossible to categorize into LBA */
+ return 0;
hm = state->hba[(hbaix >> 3) & 0x1F] & (1 << (hbaix & 0x07));