#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.141 2001/04/27 22:23:44 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.142 2001/04/30 22:38:32 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
break;
}
if (lease -> billing_class)
- unbill_class (lease,
- lease -> billing_class);
+ class_dereference (&lease -> billing_class,
+ MDL);
find_class (&class, val, MDL);
if (!class)
parse_warn (cfile,
parse_semi (cfile);
} else if (token == SUBCLASS) {
if (lease -> billing_class)
- unbill_class (lease,
- lease -> billing_class);
+ class_dereference (&lease -> billing_class,
+ MDL);
parse_class_declaration
(&class,
cfile, (struct group *)0, 3);
skip_to_semi (cfile);
}
if (class) {
- bill_class (lease, class);
+ class_reference (&lease -> billing_class,
+ class, MDL);
class_dereference (&class, MDL);
}
break;
#ifndef lint
static char copyright[] =
-"$Id: mdb.c,v 1.65 2001/04/27 21:30:59 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: mdb.c,v 1.66 2001/04/30 22:38:34 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
void lease_instantiate (const unsigned char *val, unsigned len,
struct lease *lease)
{
-
+ struct class *class;
/* XXX If the lease doesn't have a pool at this point, it's an
XXX orphan, which we *should* keep around until it expires,
XXX but which right now we just forget. */
hw_hash_add (lease);
}
+ /* If the lease has a billing class, set up the billing. */
+ if (lease -> billing_class) {
+ class = (struct class *)0;
+ class_reference (&class, lease -> billing_class, MDL);
+ class_dereference (&lease -> billing_class, MDL);
+ /* If the lease is available for allocation, the billing
+ is invalid, so we don't keep it. */
+ if (lease -> binding_state == FTS_ACTIVE ||
+ lease -> binding_state == FTS_EXPIRED ||
+ lease -> binding_state == FTS_RELEASED ||
+ lease -> binding_state == FTS_RESET ||
+ lease -> binding_state == FTS_RESERVED ||
+ lease -> binding_state == FTS_BOOTP)
+ bill_class (lease, class);
+ class_dereference (&class, MDL);
+ }
return;
}