2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-03 07:45:20 +00:00

Fixes for QoS support.

This commit is contained in:
James Brister
2001-07-10 20:36:06 +00:00
parent 0db87765e3
commit f3fe382d68
5 changed files with 82 additions and 54 deletions

View File

@@ -2390,6 +2390,9 @@ extern struct hash_table *lease_hw_addr_hash;
extern omapi_object_type_t *dhcp_type_host;
extern int numclasseswritten;
isc_result_t enter_class PROTO ((struct class *, int, int));
isc_result_t delete_class PROTO ((struct class *, int));
isc_result_t enter_host PROTO ((struct host_decl *, int, int));

View File

@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: confpars.c,v 1.145 2001/06/27 00:31:03 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: confpars.c,v 1.146 2001/07/10 20:36:02 brister Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -2029,7 +2029,10 @@ int parse_class_declaration (cp, cfile, group, type)
;
class_reference (&c -> nic, class, MDL);
}
} else if (type == 3 && dynamic) {
class->flags |= CLASS_DECL_DYNAMIC;
}
if (cp) /* should always be 0??? */
status = class_reference (cp, class, MDL);
class_dereference (&class, MDL);

View File

@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: db.c,v 1.66 2001/06/27 00:31:04 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: db.c,v 1.67 2001/07/10 20:36:03 brister Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -616,7 +616,7 @@ static int print_hash_string(FILE *fp, struct class *class)
if (i == class -> hash_string.len) {
errno = 0;
fprintf (fp, " \"%.*s\";",
fprintf (fp, " \"%.*s\"",
(int)class -> hash_string.len,
class -> hash_string.data);
if (errno)
@@ -643,15 +643,17 @@ static int print_hash_string(FILE *fp, struct class *class)
/* XXXJAB this needs to return non-zero on error. */
void write_named_billing_class (const char *name, unsigned len,
struct class *class)
{
if (class->flags & CLASS_DECL_DYNAMIC) {
numclasseswritten++;
if (class->superclass == 0) {
fprintf(db_file, "class \"%s\" {\n", name);
} else {
fprintf(db_file, "subclass \"%s\"", class->superclass->name);
fprintf(db_file, "subclass \"%s\"",
class->superclass->name);
print_hash_string(db_file, class);
fprintf(db_file, " {\n");
}
@@ -662,7 +664,6 @@ void write_named_billing_class (const char *name, unsigned len,
fprintf(db_file, " dynamic;\n");
}
if (class->lease_limit > 0) {
fprintf(db_file, " lease limit %d;\n", class->lease_limit);
}
@@ -670,6 +671,7 @@ void write_named_billing_class (const char *name, unsigned len,
if (class->expr != 0) {
fprintf(db_file, " match if ");
write_expression(db_file, class->expr, 5, 5, 0);
fprintf(db_file, ";\n");
}
if (class->submatch != 0) {
@@ -680,6 +682,7 @@ void write_named_billing_class (const char *name, unsigned len,
}
write_expression(db_file, class->submatch, 5, 5, 0);
fprintf(db_file, ";\n");
}
if (class->statements != 0) {
@@ -695,6 +698,7 @@ void write_named_billing_class (const char *name, unsigned len,
}
fprintf(db_file, "}\n\n");
}
if (class -> hash != NULL) { /* yep. recursive. god help us. */
class_hash_foreach (class -> hash, write_named_billing_class);

View File

@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
"$Id: mdb.c,v 1.70 2001/06/27 00:31:13 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
"$Id: mdb.c,v 1.71 2001/07/10 20:36:05 brister Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -57,6 +57,8 @@ struct hash_table *lease_ip_addr_hash;
struct hash_table *lease_hw_addr_hash;
struct hash_table *host_name_hash;
int numclasseswritten;
omapi_object_type_t *dhcp_type_host;
isc_result_t enter_class(cd, dynamicp, commit)
@@ -1794,17 +1796,17 @@ int write_leases ()
/* write all the dynamically-created class declarations. */
if (collections->classes) {
num_written = 0;
numclasseswritten = 0;
for (colp = collections ; colp ; colp = colp->next) {
for (cp = colp->classes ; cp ; cp = cp->nic) {
write_named_billing_class(cp->name,
0, cp);
++num_written;
}
}
/* XXXJAB this number doesn't include subclasses... */
log_info ("Wrote %d class decls to leases file.", num_written);
log_info ("Wrote %d class decls to leases file.",
numclasseswritten);
}

View File

@@ -50,7 +50,7 @@
#ifndef lint
static char copyright[] =
"$Id: omapi.c,v 1.49 2001/06/27 00:31:15 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
"$Id: omapi.c,v 1.50 2001/07/10 20:36:06 brister Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1762,11 +1762,27 @@ class_set_value (omapi_object_t *h,
}
/* note we do not support full expressions via omapi because the
expressions parser needs to be re-done to support parsing from
strings and not just files. */
if (!omapi_ds_strcmp (name, "match")) {
if (value -> type == omapi_datatype_data ||
value -> type == omapi_datatype_string) {
/* XXXJAB support 'match hardware' here. */
return ISC_R_INVALIDARG; /* XXX tmp */
int minlen = (value -> u.buffer.len > 8 ?
8 : value -> u.buffer.len);
if (strncmp("hardware", value -> u.buffer.value,
minlen) == 0) {
if (!expression_allocate(&class->submatch,
MDL)) {
return ISC_R_NOMEMORY;
}
class->expr->op = expr_hardware;
} else {
return ISC_R_INVALIDARG;
}
} else {
return ISC_R_INVALIDARG;
}