mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 14:55:30 +00:00
Fix (I hope!) the billing-class bug.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -2654,8 +2654,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lease -> billing_class)
|
if (lease -> billing_class)
|
||||||
unbill_class (lease,
|
class_dereference (&lease -> billing_class,
|
||||||
lease -> billing_class);
|
MDL);
|
||||||
find_class (&class, val, MDL);
|
find_class (&class, val, MDL);
|
||||||
if (!class)
|
if (!class)
|
||||||
parse_warn (cfile,
|
parse_warn (cfile,
|
||||||
@@ -2663,8 +2663,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
parse_semi (cfile);
|
parse_semi (cfile);
|
||||||
} else if (token == SUBCLASS) {
|
} else if (token == SUBCLASS) {
|
||||||
if (lease -> billing_class)
|
if (lease -> billing_class)
|
||||||
unbill_class (lease,
|
class_dereference (&lease -> billing_class,
|
||||||
lease -> billing_class);
|
MDL);
|
||||||
parse_class_declaration
|
parse_class_declaration
|
||||||
(&class,
|
(&class,
|
||||||
cfile, (struct group *)0, 3);
|
cfile, (struct group *)0, 3);
|
||||||
@@ -2674,7 +2674,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
|
|||||||
skip_to_semi (cfile);
|
skip_to_semi (cfile);
|
||||||
}
|
}
|
||||||
if (class) {
|
if (class) {
|
||||||
bill_class (lease, class);
|
class_reference (&lease -> billing_class,
|
||||||
|
class, MDL);
|
||||||
class_dereference (&class, MDL);
|
class_dereference (&class, MDL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
20
server/mdb.c
20
server/mdb.c
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -1858,7 +1858,7 @@ int lease_enqueue (struct lease *comp)
|
|||||||
void lease_instantiate (const unsigned char *val, unsigned len,
|
void lease_instantiate (const unsigned char *val, unsigned len,
|
||||||
struct lease *lease)
|
struct lease *lease)
|
||||||
{
|
{
|
||||||
|
struct class *class;
|
||||||
/* XXX If the lease doesn't have a pool at this point, it's an
|
/* 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 orphan, which we *should* keep around until it expires,
|
||||||
XXX but which right now we just forget. */
|
XXX but which right now we just forget. */
|
||||||
@@ -1882,6 +1882,22 @@ void lease_instantiate (const unsigned char *val, unsigned len,
|
|||||||
hw_hash_add (lease);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user