]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Finished up function call support.
authorDamien Neil <source@isc.org>
Mon, 28 Aug 2000 19:36:39 +0000 (19:36 +0000)
committerDamien Neil <source@isc.org>
Mon, 28 Aug 2000 19:36:39 +0000 (19:36 +0000)
14 files changed:
client/dhclient.c
common/conflex.c
common/dhcp-eval.5
common/execute.c
common/parse.c
common/tree.c
includes/dhcpd.h
includes/dhctoken.h
includes/statement.h
server/bootp.c
server/class.c
server/dhcp.c
server/dhcpd.c
server/mdb.c

index 2af3e96798fb37157ef3c0392c8c80207aa26391..c33fdc50124bc75f5a01fa8c819766991a8ce803 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.110 2000/07/27 09:02:23 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.111 2000/08/28 19:36:39 neild Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1696,7 +1696,8 @@ void make_client_options (client, lease, type, sid, rip, prl, op)
        /* Run statements that need to be run on transmission. */
        if (client -> config -> on_transmission)
                execute_statements_in_scope
-                       ((struct packet *)0, (struct lease *)0,
+                       ((struct binding_value **)0,
+                        (struct packet *)0, (struct lease *)0,
                         (lease ? lease -> options : (struct option_state *)0),
                         *op, &global_scope,
                         client -> config -> on_transmission,
@@ -2226,7 +2227,8 @@ void script_write_params (client, prefix, lease)
                client_envadd (client, prefix, "server_name",
                               "%s", lease -> server_name);
 
-       execute_statements_in_scope ((struct packet *)0,
+       execute_statements_in_scope ((struct binding_value **)0,
+                                    (struct packet *)0,
                                     (struct lease *)0, lease -> options,
                                     lease -> options, &global_scope,
                                     client -> config -> on_receipt,
index 28af696f083b0c1cf46825aea1a9dfac516e5a78..a06e2e490c5bda092fcb3fde6ddca2ac2e66a6d2 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: conflex.c,v 1.79 2000/08/24 18:20:47 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: conflex.c,v 1.80 2000/08/28 19:36:27 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -860,6 +860,8 @@ static enum dhcp_token intern (atom, dfv)
                        return REQUIRE;
                if (!strcasecmp (atom + 1, "etry"))
                        return RETRY;
+               if (!strcasecmp (atom + 1, "eturn"))
+                       return RETURN;
                if (!strcasecmp (atom + 1, "enew"))
                        return RENEW;
                if (!strcasecmp (atom + 1, "ebind"))
index 7d33bd6756f8bd66149898be91f3991c654e6b96..59cfc75bffcb1f5f147dd74fe70a6d590c949108 100644 (file)
@@ -350,6 +350,33 @@ the current time and the time that the lease expires.
 Any number between zero and the maximum representable size may be
 specified as a numeric expression.
 .RE
+.SH
+FUNCTIONS
+Functions may be defined with the \fBdefine\fR statement.  A function
+definition may occur anywhere that regular statement may appear.
+Functions occupy the same namespace as variables, and obey the same
+scoping rules.
+.PP
+.nf
+define set-hostname(prefix) {
+  option host-name
+    concat (prefix, binary-to-ascii (16, 32, "", leased-address));
+}
+.fi
+.PP
+A function may return a value when used in an expression with the
+\fBreturn\fR statement.  A function with no return statement has a
+value of null.
+.PP
+.nf
+define make-hostname(prefix) {
+  return concat (prefix, binary-to-ascii (16, 32, "", leased-address));
+}
+
+option host-name make-hostname("dyn-");
+.fi
+.PP
+.RE
 .SH REFERENCE: LOGGING
 Logging statements may be used to send information to the standard logging
 channels.  A logging statement includes an optional priority (\fBfatal\fR,
index e665ee795e81d57432d2aac9ab5b8c8be29fbf2e..9451bf200deb1dd4a9a6276aa435e413214760c9 100644 (file)
 
 #ifndef lint
 static char copyright[] =
-"$Id: execute.c,v 1.38 2000/08/23 00:32:46 neild Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: execute.c,v 1.39 2000/08/28 19:36:30 neild Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 #include <omapip/omapip_p.h>
 
-int execute_statements (packet, lease, in_options, out_options, scope,
+int execute_statements (result, packet, lease, in_options, out_options, scope,
                        statements)
+       struct binding_value **result;
        struct packet *packet;
        struct lease *lease;
        struct option_state *in_options;
@@ -59,7 +60,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
        struct executable_statement *statements;
 {
        struct executable_statement *r, *e, *next;
-       int result;
+       int rc;
        int status;
        unsigned long num;
        struct binding_scope *outer;
@@ -74,7 +75,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
        next = (struct executable_statement *)0;
        e = (struct executable_statement *)0;
        executable_statement_reference (&r, statements, MDL);
-       while (r) {
+       while (r && !(result && *result)) {
                if (r -> next)
                        executable_statement_reference (&next, r -> next, MDL);
                switch (r -> op) {
@@ -82,8 +83,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: statements");
 #endif
-                       status = execute_statements (packet, lease, in_options,
-                                                    out_options, scope,
+                       status = execute_statements (result, packet, lease,
+                                                    in_options, out_options,
+                                                    scope,
                                                     r -> data.statements);
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: statements returns %d", status);
@@ -147,7 +149,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
 #endif
                        if (status) {
                                if (!(execute_statements
-                                     (packet, lease,
+                                     (result, packet, lease,
                                       in_options, out_options, scope, e))) {
                                        executable_statement_dereference
                                                (&e, MDL);
@@ -164,20 +166,21 @@ int execute_statements (packet, lease, in_options, out_options, scope,
 
                      case if_statement:
                        status = (evaluate_boolean_expression
-                                 (&result, packet, lease, in_options,
+                                 (&rc, packet, lease, in_options,
                                   out_options, scope, r -> data.ie.expr));
                        
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: if %s", (status
-                                             ? (result ? "true" : "false")
+                                             ? (rc ? "true" : "false")
                                              : "NULL"));
 #endif
                        /* XXX Treat NULL as false */
                        if (!status)
-                               result = 0;
+                               rc = 0;
                        if (!execute_statements
-                           (packet, lease, in_options, out_options, scope,
-                            result ? r -> data.ie.true : r -> data.ie.false))
+                           (result, packet, lease,
+                            in_options, out_options, scope,
+                            rc ? r -> data.ie.true : r -> data.ie.false))
                                return 0;
                        break;
 
@@ -192,6 +195,16 @@ int execute_statements (packet, lease, in_options, out_options, scope,
 #endif
                        break;
 
+                     case return_statement:
+                       status = evaluate_expression
+                               (result, packet, lease, in_options,
+                                out_options, scope, r -> data.retval);
+#if defined (DEBUG_EXPRESSIONS)
+                       log_debug ("exec: return: %s",
+                                  (status ? "succeeded" : "failed"));
+#endif
+                       break;
+
                      case add_statement:
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: add %s", (r -> data.add -> name
@@ -244,6 +257,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
                        break;
 
                      case set_statement:
+                     case define_statement:
                        if (!scope) {
                                log_error ("set %s: no scope",
                                           r -> data.set.name);
@@ -286,10 +300,27 @@ int execute_statements (packet, lease, in_options, out_options, scope,
                                if (binding -> value)
                                        binding_value_dereference
                                                (&binding -> value, MDL);
-                               status = (evaluate_expression
-                                         (&binding -> value, packet, lease,
-                                          in_options, out_options,
-                                          scope, r -> data.set.expr));
+                               if (r -> op == set_statement) {
+                                       status = (evaluate_expression
+                                                 (&binding -> value, packet,
+                                                  lease, in_options,
+                                                  out_options, scope,
+                                                  r -> data.set.expr));
+                               } else {
+                                   if (!(binding_value_allocate
+                                         (&binding -> value, MDL))) {
+                                           dfree (binding, MDL);
+                                           binding = (struct binding *)0;
+                                   }
+                                   if (binding -> value) {
+                                       binding -> value -> type =
+                                               binding_function;
+                                       (fundef_reference
+                                        (&binding -> value -> value.fundef,
+                                         r -> data.set.expr -> data.func,
+                                         MDL));
+                                   }
+                               }
                        }
 #if defined (DEBUG_EXPRESSIONS)
                        log_debug ("exec: set %s%s", r -> data.set.name,
@@ -372,7 +403,8 @@ int execute_statements (packet, lease, in_options, out_options, scope,
                                        binding_scope_reference (&ns -> outer,
                                                                 *scope, MDL);
                                execute_statements
-                                     (packet, lease, in_options, out_options,
+                                     (result, packet, lease,
+                                      in_options, out_options,
                                       &ns, e -> data.let.statements);
                        }
                        if (ns)
@@ -433,8 +465,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
    specific scopes, so we recursively traverse the scope list, executing
    the most outer scope first. */
 
-void execute_statements_in_scope (packet, lease, in_options, out_options,
-                                 scope, group, limiting_group)
+void execute_statements_in_scope (result, packet, lease, in_options,
+                                 out_options, scope, group, limiting_group)
+       struct binding_value **result;
        struct packet *packet;
        struct lease *lease;
        struct option_state *in_options;
@@ -478,11 +511,11 @@ void execute_statements_in_scope (packet, lease, in_options, out_options,
        }
 
        if (group -> next)
-               execute_statements_in_scope (packet, lease,
+               execute_statements_in_scope (result, packet, lease,
                                             in_options, out_options, scope,
                                             group -> next, limiting_group);
-       execute_statements (packet, lease, in_options, out_options, scope,
-                           group -> statements);
+       execute_statements (result, packet, lease, in_options, out_options,
+                           scope, group -> statements);
 }
 
 /* Dereference or free any subexpressions of a statement being freed. */
@@ -571,6 +604,12 @@ int executable_statement_dereference (ptr, file, line)
                                                file, line);
                break;
 
+             case return_statement:
+               if ((*ptr) -> data.eval)
+                       expression_dereference (&(*ptr) -> data.eval,
+                                               file, line);
+               break;
+
              case set_statement:
                if ((*ptr)->data.set.name)
                        dfree ((*ptr)->data.set.name, file, line);
@@ -722,6 +761,11 @@ void write_statements (file, statements, indent)
                        fprintf (file, ";");
                        break;
 
+                     case return_statement:
+                       indent_spaces (file, indent);
+                       fprintf (file, "return;");
+                       break;
+
                      case add_statement:
                        indent_spaces (file, indent);
                        fprintf (file, "add \"%s\"", r -> data.add -> name);
index aa30e75e116dfee663e388163101a56b4f6ad05e..9b3f5a3081a0cd7202e39efa497fb81bb154b401 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: parse.c,v 1.79 2000/08/22 21:51:30 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: parse.c,v 1.80 2000/08/28 19:36:31 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1650,8 +1650,29 @@ int parse_executable_statement (result, cfile, lose, case_context)
                parse_semi (cfile);
                break;
 
+             case RETURN:
+               token = next_token (&val, cfile);
+
+               if (!executable_statement_allocate (result, MDL))
+                       log_fatal ("no memory for return statement.");
+               (*result) -> op = return_statement;
+
+               if (!parse_expression (&(*result) -> data.retval,
+                                      cfile, lose, context_data,
+                                      (struct expression **)0, expr_none)) {
+                       if (!*lose)
+                               parse_warn (cfile,
+                                           "expecting data expression.");
+                       else
+                               *lose = 1;
+                       skip_to_semi (cfile);
+                       executable_statement_dereference (result, MDL);
+                       return 0;
+               }
+               parse_semi (cfile);
+               break;
+
              case LOG:
-                     /** XXXDPN: At work. **/
                token = next_token (&val, cfile);
 
                if (!executable_statement_allocate (result, MDL))
@@ -1772,6 +1793,31 @@ int parse_executable_statement (result, cfile, lose, case_context)
                                         supersede_option_statement);
                        }
                }
+
+               if (token == NUMBER_OR_NAME || token == NAME) {
+                       /* This is rather ugly.  Since function calls are
+                          data expressions, fake up an eval statement. */
+                       if (!executable_statement_allocate (result, MDL))
+                               log_fatal ("no memory for eval statement.");
+                       (*result) -> op = eval_statement;
+
+                       if (!parse_expression (&(*result) -> data.eval,
+                                              cfile, lose, context_data,
+                                              (struct expression **)0,
+                                              expr_none)) {
+                               if (!*lose)
+                                       parse_warn (cfile, "expecting "
+                                                   "function call.");
+                               else
+                                       *lose = 1;
+                               skip_to_semi (cfile);
+                               executable_statement_dereference (result, MDL);
+                               return 0;
+                       }
+                       parse_semi (cfile);
+                       break;
+               }
+
                *lose = 0;
                return 0;
        }
index 5c0ed5d507b277359e03397f41f8a41e8e83f858..dd0f44fee900088227ac223786745e9d64c4fa05 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tree.c,v 1.86 2000/08/22 21:21:54 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: tree.c,v 1.87 2000/08/28 19:36:32 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -531,27 +531,13 @@ int evaluate_expression (result, packet, lease,
                if (scope && *scope)
                        binding_scope_reference (&ns -> outer, *scope, MDL);
 
-               if (execute_statements
-                   (packet, lease, in_options, cfg_options, &ns,
-                    binding -> value -> value.fundef -> statements)) {
-                       if (ns -> bindings && ns -> bindings -> name) {
-                           binding_value_reference (result,
-                                                    ns -> bindings -> value,
-                                                    MDL);
-                           status = 1;
-                       } else
-                           status = 0;
-               } else
-                       status = 0;
+               status = (execute_statements
+                         (&bv, packet, lease, in_options, cfg_options, &ns,
+                          binding -> value -> value.fundef -> statements));
                binding_scope_dereference (&ns, MDL);
-               return status;
-       } else if (expr -> op == expr_funcall) {
-               /* XXXDPN: This can never happen.  Huh? */
-               if (!binding_value_allocate (&bv, MDL))
-                       return 0;
-               bv -> type = binding_function;
-               fundef_reference (&bv -> value.fundef, expr -> data.func, MDL);
-               return 1;
+
+               if (!bv)
+                       return 1;
         } else if (is_boolean_expression (expr)) {
                if (!binding_value_allocate (&bv, MDL))
                        return 0;
@@ -585,6 +571,7 @@ int evaluate_expression (result, packet, lease,
        } else {
                log_error ("%s: invalid expression type: %d",
                           "evaluate_expression", expr -> op);
+               return 0;
        }
        if (result)
                binding_value_reference (result, bv, MDL);
index 1fef33ff7b3ebb8367662e5ab67b9eac5f9eec0d..bba992d0cda730e0eb2b07ebd222b4be6291fb1b 100644 (file)
@@ -1790,12 +1790,14 @@ int unbill_class PROTO ((struct lease *, struct class *));
 int bill_class PROTO ((struct lease *, struct class *));
 
 /* execute.c */
-int execute_statements PROTO ((struct packet *,
+int execute_statements PROTO ((struct binding_value **result,
+                              struct packet *,
                               struct lease *,
                               struct option_state *, struct option_state *,
                               struct binding_scope **,
                               struct executable_statement *));
-void execute_statements_in_scope PROTO ((struct packet *,
+void execute_statements_in_scope PROTO ((struct binding_value **result,
+                                        struct packet *,
                                         struct lease *,
                                         struct option_state *,
                                         struct option_state *,
index 2dc096fa8d0e29ac91f662aacd4c5f4accea8586..8adbd3ab0c51ce0e49226e2727d1153aceda31c0 100644 (file)
@@ -283,7 +283,8 @@ enum dhcp_token {
        FATAL = 582,
        ERROR = 583,
        TOKEN_DEBUG = 584,
-       INFO = 585
+       INFO = 585,
+       RETURN = 586
 };
 
 #define is_identifier(x)       ((x) >= FIRST_TOKEN &&  \
index 80898000717cbf10ef43fa1dcf14d2f1f55dbb5b..0d93b36cca268849b53a513773be012b96ac193f 100644 (file)
@@ -63,7 +63,8 @@ struct executable_statement {
                unset_statement,
                let_statement,
                define_statement,
-               log_statement
+               log_statement,
+               return_statement
        } op;
        union {
                struct {
@@ -71,6 +72,7 @@ struct executable_statement {
                        struct expression *expr;
                } ie;
                struct expression *eval;
+               struct expression *retval;
                struct class *add;
                struct option_cache *option;
                struct option_cache *supersede;
index 88d0694cb9951ad5f3ea17bdddbb62db55d5ecc0..24e45075c116914e474b408fdb8ba7d97803fee5 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.64 2000/08/24 18:43:11 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.65 2000/08/28 19:36:08 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -155,20 +155,23 @@ void bootp (packet)
        option_state_allocate (&options, MDL);
        
        /* Execute the subnet statements. */
-       execute_statements_in_scope (packet, lease, packet -> options, options,
+       execute_statements_in_scope ((struct binding_value **)0,
+                                    packet, lease, packet -> options, options,
                                     &lease -> scope, lease -> subnet -> group,
                                     (struct group *)0);
        
        /* Execute statements from class scopes. */
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
-                       (packet, lease, packet -> options, options,
+                       ((struct binding_value **)0,
+                        packet, lease, packet -> options, options,
                         &lease -> scope, packet -> classes [i - 1] -> group,
                         lease -> subnet -> group);
        }
 
        /* Execute the host statements. */
-       execute_statements_in_scope (packet, lease, packet -> options, options,
+       execute_statements_in_scope ((struct binding_value **)0,
+                                    packet, lease, packet -> options, options,
                                     &lease -> scope,
                                     hp -> group, subnet -> group);
        
@@ -315,7 +318,8 @@ void bootp (packet)
        }
 
        /* Execute the commit statements, if there are any. */
-       execute_statements (packet, lease, packet -> options,
+       execute_statements ((struct binding_value **)0,
+                           packet, lease, packet -> options,
                            options, &lease -> scope, lease -> on_commit);
 
        /* We're done with the option state. */
index d02ce08dbbc3642dbcbcf4c289fdf10af5c7838f..fb1b66b6dbe752e192f03b28ed1f08a567e890bf 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: class.c,v 1.20 2000/05/16 23:03:36 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: class.c,v 1.21 2000/08/28 19:36:09 neild Exp $ Copyright (c) 1998-2000 The Internet Software Consortium.  All rights reserved.\n";
 
 #endif /* not lint */
 
@@ -84,7 +84,8 @@ void classification_setup ()
 void classify_client (packet)
        struct packet *packet;
 {
-       execute_statements (packet, (struct lease *)0, packet -> options,
+       execute_statements ((struct binding_value **)0,
+                           packet, (struct lease *)0, packet -> options,
                            (struct option_state *)0, &global_scope,
                            default_classification_rules);
 }
index 399c8d55b9cc5fed26cdf94f06d51812f0aa01c8..57ff9c3cd39a0f5e89aa6b5f5de725e6e14f5bae 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.160 2000/08/24 18:49:34 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.161 2000/08/28 19:36:10 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -578,7 +578,8 @@ void dhcpdecline (packet, ms_nulltp)
 
        /* Execute statements in scope starting with the subnet scope. */
        if (lease)
-               execute_statements_in_scope (packet, (struct lease *)0,
+               execute_statements_in_scope ((struct binding_value **)0,
+                                            packet, (struct lease *)0,
                                             packet -> options, options,
                                             &global_scope,
                                             lease -> subnet -> group,
@@ -587,7 +588,8 @@ void dhcpdecline (packet, ms_nulltp)
        /* Execute statements in the class scopes. */
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
-                       (packet, (struct lease *)0, packet -> options, options,
+                       ((struct binding_value **)0,
+                        packet, (struct lease *)0, packet -> options, options,
                         &global_scope, packet -> classes [i - 1] -> group,
                         lease ? lease -> subnet -> group : (struct group *)0);
        }
@@ -718,7 +720,8 @@ void dhcpinform (packet, ms_nulltp)
 
        /* Execute statements in scope starting with the subnet scope. */
        if (subnet)
-               execute_statements_in_scope (packet, (struct lease *)0,
+               execute_statements_in_scope ((struct binding_value **)0,
+                                            packet, (struct lease *)0,
                                             packet -> options, options,
                                             &global_scope, subnet -> group,
                                             (struct group *)0);
@@ -726,7 +729,8 @@ void dhcpinform (packet, ms_nulltp)
        /* Execute statements in the class scopes. */
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
-                       (packet, (struct lease *)0, packet -> options, options,
+                       ((struct binding_value **)0,
+                        packet, (struct lease *)0, packet -> options, options,
                         &global_scope, packet -> classes [i - 1] -> group,
                         subnet ? subnet -> group : (struct group *)0);
        }
@@ -1249,7 +1253,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
        }
 
        /* Execute statements in scope starting with the subnet scope. */
-       execute_statements_in_scope (packet, lease,
+       execute_statements_in_scope ((struct binding_value **)0,
+                                    packet, lease,
                                     packet -> options,
                                     state -> options, &lease -> scope,
                                     lease -> subnet -> group,
@@ -1257,7 +1262,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
 
        /* If the lease is from a pool, run the pool scope. */
        if (lease -> pool)
-               execute_statements_in_scope (packet, lease,
+               execute_statements_in_scope ((struct binding_value **)0,
+                                            packet, lease,
                                             packet -> options,
                                             state -> options, &lease -> scope,
                                             lease -> pool -> group,
@@ -1266,7 +1272,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
        /* Execute statements from class scopes. */
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
-                       (packet, lease, packet -> options, state -> options,
+                       ((struct binding_value **)0,
+                        packet, lease, packet -> options, state -> options,
                         &lease -> scope, packet -> classes [i - 1] -> group,
                         (lease -> pool
                          ? lease -> pool -> group
@@ -1276,7 +1283,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
        /* If we have a host_decl structure, run the options associated
           with its group. */
        if (lease -> host)
-               execute_statements_in_scope (packet, lease, packet -> options,
+               execute_statements_in_scope ((struct binding_value **)0,
+                                            packet, lease, packet -> options,
                                             state -> options, &lease -> scope,
                                             lease -> host -> group,
                                             (lease -> pool
@@ -1786,7 +1794,8 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
        /* If there are statements to execute when the lease is
           committed, execute them. */
        if (lease -> on_commit && (!offer || offer == DHCPACK)) {
-               execute_statements (packet, lt, packet -> options,
+               execute_statements ((struct binding_value **)0,
+                                   packet, lt, packet -> options,
                                    state -> options, &lease -> scope,
                                    lease -> on_commit);
                if (lease -> on_commit)
index b96eb8cb5400a5f12aa6b91feace22231df57788..6b8351047c3cfe677aaa7de7823b4e4056932d11 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhcpd.c,v 1.99 2000/08/07 20:28:13 neild Exp $ Copyright 1995-2000 Internet Software Consortium.";
+"$Id: dhcpd.c,v 1.100 2000/08/28 19:36:12 neild Exp $ Copyright 1995-2000 Internet Software Consortium.";
 #endif
 
   static char copyright[] =
@@ -377,7 +377,8 @@ int main (argc, argv, envp)
        /* Now try to get the lease file name. */
        option_state_allocate (&options, MDL);
 
-       execute_statements_in_scope ((struct packet *)0,
+       execute_statements_in_scope ((struct binding_value **)0,
+                                    (struct packet *)0,
                                     (struct lease *)0,
                                     (struct option_state *)0,
                                     options, &global_scope,
index d9bf52a05e2cceb9d55c0cb94afafcf631a0da98..8475c456c7d97c4db9a92eeb2f5818e5990b6cf6 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: mdb.c,v 1.41 2000/07/27 09:03:08 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: mdb.c,v 1.42 2000/08/28 19:36:13 neild Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -1033,7 +1033,8 @@ void process_state_transition (struct lease *lease)
             lease -> binding_state == FTS_RESERVED) &&
            lease -> next_binding_state != FTS_RELEASED) {
                if (lease -> on_expiry) {
-                       execute_statements ((struct packet *)0, lease,
+                       execute_statements ((struct binding_value **)0,
+                                           (struct packet *)0, lease,
                                            (struct option_state *)0,
                                            (struct option_state *)0, /* XXX */
                                            &lease -> scope,
@@ -1058,7 +1059,8 @@ void process_state_transition (struct lease *lease)
             lease -> binding_state == FTS_RESERVED) &&
            lease -> next_binding_state == FTS_RELEASED) {
                if (lease -> on_release) {
-                       execute_statements ((struct packet *)0, lease,
+                       execute_statements ((struct binding_value **)0,
+                                           (struct packet *)0, lease,
                                            (struct option_state *)0,
                                            (struct option_state *)0, /* XXX */
                                            &lease -> scope,
@@ -1174,7 +1176,8 @@ void release_lease (lease, packet)
        /* If there are statements to execute when the lease is
           released, execute them. */
        if (lease -> on_release) {
-               execute_statements (packet, lease, packet -> options,
+               execute_statements ((struct binding_value **)0,
+                                   packet, lease, packet -> options,
                                    (struct option_state *)0, /* XXX */
                                    &lease -> scope, lease -> on_release);
                if (lease -> on_release)