#ifndef lint
static char copyright[] =
-"$Id: class.c,v 1.8 1999/02/24 17:56:51 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: class.c,v 1.9 1999/03/16 00:54:09 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
memset (&data, 0, sizeof data);
/* If a class is for billing, don't put the client in the
class if we've already billed it to a different class. */
- if (class -> spawn) {
+ if (class -> submatch) {
status = evaluate_data_expression (&data, packet,
&packet -> options,
- class -> spawn);
+ class -> submatch);
if (status) {
if ((nc = ((struct class *)
hash_lookup (class -> hash,
matched = 1;
continue;
}
+ if (!class -> spawning)
+ continue;
#if defined (DEBUG_CLASS_MATCHING)
log_info ("spawning subclass %s.",
print_hex_1 (data.len, data.data, 60));
#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.62 1999/03/09 23:43:36 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.63 1999/03/16 00:56:02 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
backward compatibility, we have an implicit-vendor-class and an
implicit-user-class. vendor-class and user-class declarations
are turned into subclasses of the implicit classes, and the
- spawn expression of the implicit classes extracts the contents of
+ submatch expression of the implicit classes extracts the contents of
the vendor class or user class. */
if (type == 0 || type == 1) {
data.len = strlen (val);
}
token = next_token (&val, cfile);
token = next_token (&val, cfile);
- if (token != IF) {
- parse_warn ("expecting if after match");
- skip_to_semi (cfile);
- break;
- }
+ if (token != IF)
+ goto submatch;
parse_boolean_expression (&class -> expr, cfile,
&lose);
if (lose)
skip_to_semi (cfile);
break;
}
- if (class -> spawn) {
- parse_warn ("can't override spawn.");
- skip_to_semi (cfile);
- break;
- }
token = next_token (&val, cfile);
token = next_token (&val, cfile);
if (token != WITH) {
skip_to_semi (cfile);
break;
}
- parse_data_expression (&class -> spawn, cfile, &lose);
+ class -> spawning = 1;
+ submatch:
+ if (class -> submatch) {
+ parse_warn ("can't override existing %s.",
+ "submatch/spawn");
+ skip_to_semi (cfile);
+ break;
+ }
+ parse_data_expression (&class -> submatch,
+ cfile, &lose);
if (lose)
break;
#if defined (DEBUG_EXPRESSION_PARSE)
- print_expression ("class match", class -> spawn);
+ print_expression ("class submatch",
+ class -> submatch);
#endif
parse_semi (cfile);
} else if (token == LEASE) {