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

Add debugging. Fix break statement.

This commit is contained in:
Ted Lemon
2000-04-13 21:48:34 +00:00
parent f20a57ed9b
commit 9615e0e6b3

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: execute.c,v 1.30 2000/03/17 03:59:01 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: execute.c,v 1.31 2000/04/13 21:48:34 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -89,6 +89,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
case on_statement: case on_statement:
if (lease) { if (lease) {
if (r -> data.on.evtypes & ON_EXPIRY) { if (r -> data.on.evtypes & ON_EXPIRY) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: on expiry");
#endif
if (lease -> on_expiry) if (lease -> on_expiry)
executable_statement_dereference executable_statement_dereference
(&lease -> on_expiry, MDL); (&lease -> on_expiry, MDL);
@@ -98,6 +101,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
r -> data.on.statements, MDL); r -> data.on.statements, MDL);
} }
if (r -> data.on.evtypes & ON_RELEASE) { if (r -> data.on.evtypes & ON_RELEASE) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: on release");
#endif
if (lease -> on_release) if (lease -> on_release)
executable_statement_dereference executable_statement_dereference
(&lease -> on_release, MDL); (&lease -> on_release, MDL);
@@ -107,6 +113,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
r -> data.on.statements, MDL); r -> data.on.statements, MDL);
} }
if (r -> data.on.evtypes & ON_COMMIT) { if (r -> data.on.evtypes & ON_COMMIT) {
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: on commit");
#endif
if (lease -> on_commit) if (lease -> on_commit)
executable_statement_dereference executable_statement_dereference
(&lease -> on_commit, MDL); (&lease -> on_commit, MDL);
@@ -119,14 +128,21 @@ int execute_statements (packet, lease, in_options, out_options, scope,
break; break;
case switch_statement: case switch_statement:
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: switch");
#endif
e = find_matching_case (packet, lease, e = find_matching_case (packet, lease,
in_options, out_options, scope, in_options, out_options, scope,
r -> data.s_switch.expr, r -> data.s_switch.expr,
r -> data.s_switch.statements); r -> data.s_switch.statements);
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: switch: case %lx", (unsigned long)e);
#endif
if (e && !execute_statements (packet, lease, if (e && !execute_statements (packet, lease,
in_options, out_options, in_options, out_options,
scope, e)) scope, e))
return 0; return 0;
break;
/* These have no effect when executed. */ /* These have no effect when executed. */
case case_statement: case case_statement:
@@ -159,7 +175,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
out_options, scope, r -> data.eval); out_options, scope, r -> data.eval);
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: evaluate: %s", log_debug ("exec: evaluate: %s",
(status "succeeded" : "failed")); (status ? "succeeded" : "failed"));
#endif #endif
break; break;
@@ -176,7 +192,7 @@ int execute_statements (packet, lease, in_options, out_options, scope,
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: break"); log_debug ("exec: break");
#endif #endif
return 0; return 1;
case supersede_option_statement: case supersede_option_statement:
#if defined (DEBUG_EXPRESSIONS) #if defined (DEBUG_EXPRESSIONS)
@@ -216,6 +232,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
case set_statement: case set_statement:
binding = find_binding (scope, r -> data.set.name); binding = find_binding (scope, r -> data.set.name);
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: set %s", r -> data.set.name);
#endif
if (!binding && status) { if (!binding && status) {
binding = dmalloc (sizeof *binding, MDL); binding = dmalloc (sizeof *binding, MDL);
if (binding) { if (binding) {
@@ -259,6 +278,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
case unset_statement: case unset_statement:
binding = find_binding (scope, r -> data.unset); binding = find_binding (scope, r -> data.unset);
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: unset %s", r -> data.unset);
#endif
if (binding) { if (binding) {
if (binding -> value) if (binding -> value)
binding_value_dereference binding_value_dereference
@@ -273,6 +295,9 @@ int execute_statements (packet, lease, in_options, out_options, scope,
break; break;
case let_statement: case let_statement:
#if defined (DEBUG_EXPRESSIONS)
log_debug ("exec: let %s", r -> data.let.name);
#endif
ns = (struct binding_scope *)0; ns = (struct binding_scope *)0;
binding_scope_allocate (&ns, MDL); binding_scope_allocate (&ns, MDL);
e = r; e = r;