]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Differentiate between spawning and subclass matching.
authorTed Lemon <source@isc.org>
Tue, 16 Mar 1999 00:56:02 +0000 (00:56 +0000)
committerTed Lemon <source@isc.org>
Tue, 16 Mar 1999 00:56:02 +0000 (00:56 +0000)
server/class.c
server/confpars.c

index 1b96372f9b16cf67eccce3d0523bac693756c5d7..bcd31c79c4a42e541f3237a1916450aa0fe09661 100644 (file)
@@ -42,7 +42,7 @@
 
 #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"
@@ -201,10 +201,10 @@ int check_collection (packet, collection)
                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,
@@ -221,6 +221,8 @@ int check_collection (packet, collection)
                                        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));
index 2c4cdd389cdf0be47439e00c8a5234cc2fb15212..f5bec8adbcbca8f99795f2b1c4362e3b4eca2db8 100644 (file)
@@ -42,7 +42,7 @@
 
 #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"
@@ -985,7 +985,7 @@ struct class *parse_class_declaration (cfile, group, type)
           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);
@@ -1130,11 +1130,8 @@ struct class *parse_class_declaration (cfile, group, type)
                        }
                        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)
@@ -1149,11 +1146,6 @@ struct class *parse_class_declaration (cfile, group, type)
                                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) {
@@ -1161,11 +1153,21 @@ struct class *parse_class_declaration (cfile, group, type)
                                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) {