mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-01 14:55:30 +00:00
Add support for billing to classes.
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: memory.c,v 1.43 1998/11/09 02:44:32 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: memory.c,v 1.44 1998/11/11 07:52:35 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
@@ -288,7 +288,7 @@ void new_address_range (low, high, subnet, pool)
|
||||
address_range [i].ends = MIN_TIME;
|
||||
address_range [i].subnet = subnet;
|
||||
address_range [i].pool = pool;
|
||||
address_range [i].class = (struct class *)0;
|
||||
address_range [i].billing_class = (struct class *)0;
|
||||
address_range [i].shared_network = share;
|
||||
address_range [i].flags = 0;
|
||||
|
||||
@@ -476,7 +476,8 @@ int supersede_lease (comp, lease, commit)
|
||||
warn ("Lease conflict at %s",
|
||||
piaddr (comp -> ip_addr));
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
|
||||
/* If there's a Unique ID, dissociate it from the hash
|
||||
table and free it if necessary. */
|
||||
if (comp -> uid) {
|
||||
@@ -504,6 +505,11 @@ int supersede_lease (comp, lease, commit)
|
||||
} else if (!comp -> hardware_addr.htype)
|
||||
enter_hwaddr = 1;
|
||||
|
||||
/* If the lease has been billed to a class, remove the billing. */
|
||||
if (comp -> billing_class &&
|
||||
comp -> billing_class != lease -> billing_class)
|
||||
unbill_class (comp, comp -> billing_class);
|
||||
|
||||
/* Copy the data files, but not the linkages. */
|
||||
comp -> starts = lease -> starts;
|
||||
comp -> timestamp = lease -> timestamp;
|
||||
@@ -575,8 +581,7 @@ int supersede_lease (comp, lease, commit)
|
||||
lp = lp -> next;
|
||||
}
|
||||
if (lp -> ends > lease -> ends) {
|
||||
/* If we ran out of list, put comp
|
||||
at the end. */
|
||||
/* If we ran out of list, put comp at the end. */
|
||||
lp -> next = comp;
|
||||
comp -> prev = lp;
|
||||
comp -> next = (struct lease *)0;
|
||||
@@ -596,8 +601,7 @@ int supersede_lease (comp, lease, commit)
|
||||
lp = lp -> prev;
|
||||
}
|
||||
if (lp -> ends < lease -> ends) {
|
||||
/* If we ran out of list, put comp
|
||||
at the beginning. */
|
||||
/* If we ran out of list, put comp at the beginning. */
|
||||
lp -> prev = comp;
|
||||
comp -> next = lp;
|
||||
comp -> prev = (struct lease *)0;
|
||||
@@ -613,7 +617,6 @@ int supersede_lease (comp, lease, commit)
|
||||
}
|
||||
comp -> pool -> insertion_point = comp;
|
||||
comp -> ends = lease -> ends;
|
||||
}
|
||||
|
||||
/* Return zero if we didn't commit the lease to permanent storage;
|
||||
nonzero if we did. */
|
||||
@@ -629,6 +632,7 @@ void release_lease (lease)
|
||||
|
||||
lt = *lease;
|
||||
lt.ends = cur_time;
|
||||
lt.billing_class = (struct class *)0;
|
||||
supersede_lease (lease, <, 1);
|
||||
}
|
||||
|
||||
@@ -650,6 +654,7 @@ void abandon_lease (lease, message)
|
||||
lt.hardware_addr.hlen = 0;
|
||||
lt.uid = (unsigned char *)0;
|
||||
lt.uid_len = 0;
|
||||
lt.billing_class = (struct class *)0;
|
||||
supersede_lease (lease, <, 1);
|
||||
}
|
||||
|
||||
@@ -668,6 +673,7 @@ void dissociate_lease (lease)
|
||||
lt.hardware_addr.hlen = 0;
|
||||
lt.uid = (unsigned char *)0;
|
||||
lt.uid_len = 0;
|
||||
lt.billing_class = (struct class *)0;
|
||||
supersede_lease (lease, <, 1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user