#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.91 2007/05/19 19:16:27 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.92 2007/06/08 18:56:30 dhankins Exp $ Copyright (c) 2004-2007 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
int propogate;
int pimmediate;
{
- int enter_uid = 0;
- int enter_hwaddr = 0;
struct lease *lp, **lq, *prev;
TIME lp_next_state;
#if defined (FAILOVER_PROTOCOL)
/* If there's a Unique ID, dissociate it from the hash
table and free it if necessary. */
- if (comp -> uid) {
- uid_hash_delete (comp);
- enter_uid = 1;
- if (comp -> uid != &comp -> uid_buf [0]) {
- dfree (comp -> uid, MDL);
- comp -> uid_max = 0;
- comp -> uid_len = 0;
+ if (comp->uid) {
+ uid_hash_delete(comp);
+ if (comp->uid != comp->uid_buf) {
+ dfree(comp->uid, MDL);
+ comp->uid_max = 0;
+ comp->uid_len = 0;
}
comp -> uid = (unsigned char *)0;
- } else
- enter_uid = 1;
-
- if (comp -> hardware_addr.hlen &&
- ((comp -> hardware_addr.hlen !=
- lease -> hardware_addr.hlen) ||
- memcmp (comp -> hardware_addr.hbuf,
- lease -> hardware_addr.hbuf,
- comp -> hardware_addr.hlen))) {
- hw_hash_delete (comp);
- enter_hwaddr = 1;
- } else if (!comp -> hardware_addr.hlen)
- enter_hwaddr = 1;
+ }
+
+ /* If there's a hardware address, remove the lease from its
+ * old position in the hash bucket's ordered list.
+ */
+ if (comp->hardware_addr.hlen)
+ hw_hash_delete(comp);
/* If the lease has been billed to a class, remove the billing. */
if (comp -> billing_class != lease -> billing_class) {
}
/* Record the lease in the uid hash if necessary. */
- if (enter_uid && comp -> uid) {
- uid_hash_add (comp);
- }
+ if (comp->uid)
+ uid_hash_add(comp);
/* Record it in the hardware address hash if necessary. */
- if (enter_hwaddr && lease -> hardware_addr.hlen) {
- hw_hash_add (comp);
- }
+ if (comp->hardware_addr.hlen)
+ hw_hash_add(comp);
comp->cltt = lease->cltt;
#if defined (FAILOVER_PROTOCOL)