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:
@@ -2390,6 +2390,9 @@ extern struct hash_table *lease_hw_addr_hash;
|
|||||||
|
|
||||||
extern omapi_object_type_t *dhcp_type_host;
|
extern omapi_object_type_t *dhcp_type_host;
|
||||||
|
|
||||||
|
extern int numclasseswritten;
|
||||||
|
|
||||||
|
|
||||||
isc_result_t enter_class PROTO ((struct class *, int, int));
|
isc_result_t enter_class PROTO ((struct class *, int, int));
|
||||||
isc_result_t delete_class PROTO ((struct class *, int));
|
isc_result_t delete_class PROTO ((struct class *, int));
|
||||||
isc_result_t enter_host PROTO ((struct host_decl *, int, int));
|
isc_result_t enter_host PROTO ((struct host_decl *, int, int));
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -2029,7 +2029,10 @@ int parse_class_declaration (cp, cfile, group, type)
|
|||||||
;
|
;
|
||||||
class_reference (&c -> nic, class, MDL);
|
class_reference (&c -> nic, class, MDL);
|
||||||
}
|
}
|
||||||
|
} else if (type == 3 && dynamic) {
|
||||||
|
class->flags |= CLASS_DECL_DYNAMIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cp) /* should always be 0??? */
|
if (cp) /* should always be 0??? */
|
||||||
status = class_reference (cp, class, MDL);
|
status = class_reference (cp, class, MDL);
|
||||||
class_dereference (&class, MDL);
|
class_dereference (&class, MDL);
|
||||||
|
96
server/db.c
96
server/db.c
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -616,7 +616,7 @@ static int print_hash_string(FILE *fp, struct class *class)
|
|||||||
|
|
||||||
if (i == class -> hash_string.len) {
|
if (i == class -> hash_string.len) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
fprintf (fp, " \"%.*s\";",
|
fprintf (fp, " \"%.*s\"",
|
||||||
(int)class -> hash_string.len,
|
(int)class -> hash_string.len,
|
||||||
class -> hash_string.data);
|
class -> hash_string.data);
|
||||||
if (errno)
|
if (errno)
|
||||||
@@ -643,59 +643,63 @@ static int print_hash_string(FILE *fp, struct class *class)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* XXXJAB this needs to return non-zero on error. */
|
/* XXXJAB this needs to return non-zero on error. */
|
||||||
void write_named_billing_class (const char *name, unsigned len,
|
void write_named_billing_class (const char *name, unsigned len,
|
||||||
struct class *class)
|
struct class *class)
|
||||||
{
|
{
|
||||||
if (class->superclass == 0) {
|
if (class->flags & CLASS_DECL_DYNAMIC) {
|
||||||
fprintf(db_file, "class \"%s\" {\n", name);
|
numclasseswritten++;
|
||||||
} else {
|
if (class->superclass == 0) {
|
||||||
fprintf(db_file, "subclass \"%s\"", class->superclass->name);
|
fprintf(db_file, "class \"%s\" {\n", name);
|
||||||
print_hash_string(db_file, class);
|
|
||||||
fprintf(db_file, " {\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((class->flags & CLASS_DECL_DELETED) != 0) {
|
|
||||||
fprintf(db_file, " deleted;\n");
|
|
||||||
} else {
|
|
||||||
fprintf(db_file, " dynamic;\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (class->lease_limit > 0) {
|
|
||||||
fprintf(db_file, " lease limit %d;\n", class->lease_limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (class->expr != 0) {
|
|
||||||
fprintf(db_file, " match if ");
|
|
||||||
write_expression(db_file, class->expr, 5, 5, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (class->submatch != 0) {
|
|
||||||
if (class->spawning) {
|
|
||||||
fprintf(db_file, " spawn ");
|
|
||||||
} else {
|
} else {
|
||||||
fprintf(db_file, " match ");
|
fprintf(db_file, "subclass \"%s\"",
|
||||||
|
class->superclass->name);
|
||||||
|
print_hash_string(db_file, class);
|
||||||
|
fprintf(db_file, " {\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((class->flags & CLASS_DECL_DELETED) != 0) {
|
||||||
|
fprintf(db_file, " deleted;\n");
|
||||||
|
} else {
|
||||||
|
fprintf(db_file, " dynamic;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
write_expression(db_file, class->submatch, 5, 5, 0);
|
if (class->lease_limit > 0) {
|
||||||
|
fprintf(db_file, " lease limit %d;\n", class->lease_limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (class->spawning) {
|
||||||
|
fprintf(db_file, " spawn ");
|
||||||
|
} else {
|
||||||
|
fprintf(db_file, " match ");
|
||||||
|
}
|
||||||
|
|
||||||
|
write_expression(db_file, class->submatch, 5, 5, 0);
|
||||||
|
fprintf(db_file, ";\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (class->statements != 0) {
|
||||||
|
write_statements(db_file, class->statements, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* XXXJAB this isn't right, but classes read in off the leases file
|
||||||
|
don't get the root group assigned to them (due to clone_group()
|
||||||
|
call). */
|
||||||
|
if (class->group != 0 && class->group->authoritative != 0) {
|
||||||
|
write_statements (db_file,
|
||||||
|
class -> group -> statements, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(db_file, "}\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class->statements != 0) {
|
|
||||||
write_statements(db_file, class->statements, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXXJAB this isn't right, but classes read in off the leases file
|
|
||||||
don't get the root group assigned to them (due to clone_group()
|
|
||||||
call). */
|
|
||||||
if (class->group != 0 && class->group->authoritative != 0) {
|
|
||||||
write_statements (db_file,
|
|
||||||
class -> group -> statements, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(db_file, "}\n\n");
|
|
||||||
|
|
||||||
if (class -> hash != NULL) { /* yep. recursive. god help us. */
|
if (class -> hash != NULL) { /* yep. recursive. god help us. */
|
||||||
class_hash_foreach (class -> hash, write_named_billing_class);
|
class_hash_foreach (class -> hash, write_named_billing_class);
|
||||||
}
|
}
|
||||||
|
10
server/mdb.c
10
server/mdb.c
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -57,6 +57,8 @@ struct hash_table *lease_ip_addr_hash;
|
|||||||
struct hash_table *lease_hw_addr_hash;
|
struct hash_table *lease_hw_addr_hash;
|
||||||
struct hash_table *host_name_hash;
|
struct hash_table *host_name_hash;
|
||||||
|
|
||||||
|
int numclasseswritten;
|
||||||
|
|
||||||
omapi_object_type_t *dhcp_type_host;
|
omapi_object_type_t *dhcp_type_host;
|
||||||
|
|
||||||
isc_result_t enter_class(cd, dynamicp, commit)
|
isc_result_t enter_class(cd, dynamicp, commit)
|
||||||
@@ -1794,17 +1796,17 @@ int write_leases ()
|
|||||||
|
|
||||||
/* write all the dynamically-created class declarations. */
|
/* write all the dynamically-created class declarations. */
|
||||||
if (collections->classes) {
|
if (collections->classes) {
|
||||||
num_written = 0;
|
numclasseswritten = 0;
|
||||||
for (colp = collections ; colp ; colp = colp->next) {
|
for (colp = collections ; colp ; colp = colp->next) {
|
||||||
for (cp = colp->classes ; cp ; cp = cp->nic) {
|
for (cp = colp->classes ; cp ; cp = cp->nic) {
|
||||||
write_named_billing_class(cp->name,
|
write_named_billing_class(cp->name,
|
||||||
0, cp);
|
0, cp);
|
||||||
++num_written;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXXJAB this number doesn't include subclasses... */
|
/* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#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 (!omapi_ds_strcmp (name, "match")) {
|
||||||
if (value -> type == omapi_datatype_data ||
|
if (value -> type == omapi_datatype_data ||
|
||||||
value -> type == omapi_datatype_string) {
|
value -> type == omapi_datatype_string) {
|
||||||
/* XXXJAB support 'match hardware' here. */
|
int minlen = (value -> u.buffer.len > 8 ?
|
||||||
return ISC_R_INVALIDARG; /* XXX tmp */
|
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 {
|
} else {
|
||||||
return ISC_R_INVALIDARG;
|
return ISC_R_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user