From: David Hankins Date: Wed, 27 Sep 2006 18:27:27 +0000 (+0000) Subject: - The servers now try harder to transmit pending binding updates when X-Git-Tag: v4_0_0a1~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=616d67cb0a23363bfd07550dc9f317e15f67e8dc;p=thirdparty%2Fdhcp.git - The servers now try harder to transmit pending binding updates when entering normal state. [ISC-Bugs #16412] - UPDREQ/UPDREQALL handling was optimized - it no longer dequeues and requeues all pending updates. This should reduce the number of spurious 'xid mismatch' log mesasges. [ISC-Bugs #16412] --- diff --git a/RELNOTES b/RELNOTES index b551b62f1..30a1d223a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -31,6 +31,13 @@ the README file. - A bug in the FQDN universe that added FQDN codes to the NWIP universe's hash table was repaired. +- The servers now try harder to transmit pending binding updates when + entering normal state. + +- UPDREQ/UPDREQALL handling was optimized - it no longer dequeues and + requeues all pending updates. This should reduce the number of spurious + 'xid mismatch' log mesasges. + Changes since 3.0 (New Features) - A workaround for certain STSN servers that send a mangled domain-name diff --git a/server/failover.c b/server/failover.c index 85c5571a4..68a8d1075 100644 --- a/server/failover.c +++ b/server/failover.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: failover.c,v 1.65 2006/08/28 21:35:03 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: failover.c,v 1.66 2006/09/27 18:27:27 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1743,6 +1743,12 @@ isc_result_t dhcp_failover_set_state (dhcp_failover_state_t *state, * all pending binding updates. */ dhcp_failover_generate_update_queue(state, 0); + + if (state->update_queue_tail != NULL) { + dhcp_failover_send_updates(state); + log_info("Sending updates to %s.", state->name); + } + if (state -> partner.state == normal) dhcp_failover_state_pool_check (state); break; @@ -5155,56 +5161,14 @@ isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *state, struct pool *p; struct lease *l, *n; int i; - struct lease **lptr [5]; #define FREE_LEASES 0 #define ACTIVE_LEASES 1 #define EXPIRED_LEASES 2 #define ABANDONED_LEASES 3 #define BACKUP_LEASES 4 +#define RESERVED_LEASES 5 + struct lease **lptr[RESERVED_LEASES+1]; - /* First remove everything from the update and ack queues. */ - l = n = (struct lease *)0; - if (state -> update_queue_head) { - lease_reference (&l, state -> update_queue_head, MDL); - lease_dereference (&state -> update_queue_head, MDL); - do { - l -> flags &= ~ON_UPDATE_QUEUE; - if (l -> next_pending) { - lease_reference (&n, - l -> next_pending, MDL); - lease_dereference (&l -> next_pending, MDL); - } - lease_dereference (&l, MDL); - if (n) { - lease_reference (&l, n, MDL); - lease_dereference (&n, MDL); - } - } while (l); - lease_dereference (&state -> update_queue_tail, MDL); - } - - if (state -> ack_queue_head) { - lease_reference (&l, state -> ack_queue_head, MDL); - lease_dereference (&state -> ack_queue_head, MDL); - do { - l -> flags &= ~ON_ACK_QUEUE; - if (l -> next_pending) { - lease_reference (&n, - l -> next_pending, MDL); - lease_dereference (&l -> next_pending, MDL); - } - lease_dereference (&l, MDL); - if (n) { - lease_reference (&l, n, MDL); - lease_dereference (&n, MDL); - } - } while (l); - lease_dereference (&state -> ack_queue_tail, MDL); - } - if (state -> send_update_done) - lease_dereference (&state -> send_update_done, MDL); - state -> cur_unacked_updates = 0; - /* Loop through each pool in each shared network and call the expiry routine on the pool. */ for (s = shared_networks; s; s = s -> next) { @@ -5212,19 +5176,19 @@ isc_result_t dhcp_failover_generate_update_queue (dhcp_failover_state_t *state, if (p->failover_peer != state) continue; - lptr [FREE_LEASES] = &p -> free; - lptr [ACTIVE_LEASES] = &p -> active; - lptr [EXPIRED_LEASES] = &p -> expired; - lptr [ABANDONED_LEASES] = &p -> abandoned; - lptr [BACKUP_LEASES] = &p -> backup; + lptr[FREE_LEASES] = &p->free; + lptr[ACTIVE_LEASES] = &p->active; + lptr[EXPIRED_LEASES] = &p->expired; + lptr[ABANDONED_LEASES] = &p->abandoned; + lptr[BACKUP_LEASES] = &p->backup; + lptr[RESERVED_LEASES] = &p->reserved; - for (i = FREE_LEASES; i <= BACKUP_LEASES; i++) { + for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { for (l = *(lptr [i]); l; l = l -> next) { - if ((everythingp && - (l->starts != MIN_TIME || - l->ends != MIN_TIME)) || - (l->tstp > l->atsfp) || - (i == EXPIRED_LEASES)) { + if (l->flags & (ON_UPDATE_QUEUE | ON_ACK_QUEUE) == 0 && + (everythingp || + (l->tstp > l->atsfp) || + (i == EXPIRED_LEASES))) { l -> desired_binding_state = l -> binding_state; dhcp_failover_queue_update (l, 0); } @@ -5239,6 +5203,12 @@ isc_result_t dhcp_failover_process_update_request (dhcp_failover_state_t *state, failover_message_t *msg) { + if (state->send_update_done) { + log_info("Received update request while old update still " + "flying! Silently discarding old request."); + lease_dereference(&state->send_update_done, MDL); + } + /* Generate a fresh update queue. */ dhcp_failover_generate_update_queue (state, 0); @@ -5268,6 +5238,12 @@ isc_result_t dhcp_failover_process_update_request_all (dhcp_failover_state_t *state, failover_message_t *msg) { + if (state->send_update_done) { + log_info("Received update request while old update still " + "flying! Silently discarding old request."); + lease_dereference(&state->send_update_done, MDL); + } + /* Generate a fresh update queue that includes every lease. */ dhcp_failover_generate_update_queue (state, 1); diff --git a/server/mdb.c b/server/mdb.c index 0372e6250..6dc3b947b 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: mdb.c,v 1.84 2006/08/28 21:35:03 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; +"$Id: mdb.c,v 1.85 2006/09/27 18:27:27 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -1578,23 +1578,23 @@ void pool_timer (vpool) struct lease *lt = (struct lease *)0; struct lease *next = (struct lease *)0; struct lease *lease = (struct lease *)0; - struct lease **lptr[6]; +#define FREE_LEASES 0 +#define ACTIVE_LEASES 1 +#define EXPIRED_LEASES 2 +#define ABANDONED_LEASES 3 +#define BACKUP_LEASES 4 +#define RESERVED_LEASES 5 + struct lease **lptr[RESERVED_LEASES+1]; TIME next_expiry = MAX_TIME; int i; pool = (struct pool *)vpool; -#define FREE_LEASES 0 lptr [FREE_LEASES] = &pool -> free; -#define ACTIVE_LEASES 1 lptr [ACTIVE_LEASES] = &pool -> active; -#define EXPIRED_LEASES 2 lptr [EXPIRED_LEASES] = &pool -> expired; -#define ABANDONED_LEASES 3 lptr [ABANDONED_LEASES] = &pool -> abandoned; -#define BACKUP_LEASES 4 lptr [BACKUP_LEASES] = &pool -> backup; -#define RESERVED_LEASES 5 lptr[RESERVED_LEASES] = &pool->reserved; for (i = FREE_LEASES; i <= RESERVED_LEASES; i++) { @@ -1862,7 +1862,7 @@ int write_leases () struct collection *colp; int i; int num_written; - struct lease **lptr[6]; + struct lease **lptr[RESERVED_LEASES+1]; /* write all the dynamically-created class declarations. */ if (collections->classes) { @@ -2172,7 +2172,7 @@ void expire_all_pools () struct hash_bucket *hb; int i; struct lease *l; - struct lease **lptr[6]; + struct lease **lptr[RESERVED_LEASES+1]; /* Indicate that we are in the startup phase */ server_starting = SS_NOSYNC | SS_QFOLLOW; @@ -2244,7 +2244,7 @@ void dump_subnets () struct shared_network *s; struct subnet *n; struct pool *p; - struct lease **lptr[6]; + struct lease **lptr[RESERVED_LEASES+1]; int i; log_info ("Subnets:"); @@ -2442,7 +2442,7 @@ void free_everything () if (nc -> pools) { pool_reference (&pn, nc -> pools, MDL); do { - struct lease **lptr[6]; + struct lease **lptr[RESERVED_LEASES+1]; if (pn) { pool_reference (&pc, pn, MDL);