From: Alan T. DeKok Date: Mon, 14 Nov 2022 15:09:13 +0000 (-0500) Subject: add timeout keyword X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dce4a04d2f74cee844020e209eaedfae8c2ffb2c;p=thirdparty%2Ffreeradius-server.git add timeout keyword --- diff --git a/src/lib/unlang/all.mk b/src/lib/unlang/all.mk index de66bda6621..1498d1dcd3c 100644 --- a/src/lib/unlang/all.mk +++ b/src/lib/unlang/all.mk @@ -21,6 +21,7 @@ SOURCES := base.c \ subrequest.c \ subrequest_child.c \ switch.c \ + timeout.c \ tmpl.c \ xlat.c \ xlat_builtin.c \ diff --git a/src/lib/unlang/base.c b/src/lib/unlang/base.c index 3a83b1c8384..ad73c6b2031 100644 --- a/src/lib/unlang/base.c +++ b/src/lib/unlang/base.c @@ -101,6 +101,7 @@ int unlang_init_global(void) unlang_caller_init(); unlang_tmpl_init(); unlang_edit_init(); + unlang_timeout_init(); instance_count++; diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index b7f34b59691..ab314ecabfd 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -40,6 +40,7 @@ RCSID("$Id$") #include "subrequest_priv.h" #include "switch_priv.h" #include "edit_priv.h" +#include "timeout_priv.h" #define UNLANG_IGNORE ((unlang_t *) -1) @@ -723,10 +724,11 @@ static void unlang_dump(unlang_t *instruction, int depth) case UNLANG_TYPE_LOAD_BALANCE: case UNLANG_TYPE_PARALLEL: case UNLANG_TYPE_POLICY: - case UNLANG_TYPE_SUBREQUEST: - case UNLANG_TYPE_SWITCH: case UNLANG_TYPE_REDUNDANT: case UNLANG_TYPE_REDUNDANT_LOAD_BALANCE: + case UNLANG_TYPE_SUBREQUEST: + case UNLANG_TYPE_SWITCH: + case UNLANG_TYPE_TIMEOUT: g = unlang_generic_to_group(c); DEBUG("%.*s%s {", depth, unlang_spaces, c->debug_name); unlang_dump(g->children, depth + 1); @@ -1992,6 +1994,7 @@ static bool compile_action_subsection(unlang_t *c, CONF_SECTION *cs, CONF_SECTIO case UNLANG_TYPE_ELSE: case UNLANG_TYPE_ELSIF: case UNLANG_TYPE_GROUP: + case UNLANG_TYPE_TIMEOUT: break; default: @@ -2731,6 +2734,54 @@ static unlang_t *compile_case(unlang_t *parent, unlang_compile_t *unlang_ctx, CO return c; } +static unlang_t *compile_timeout(unlang_t *parent, unlang_compile_t *unlang_ctx, CONF_SECTION *cs) +{ + char const *name2; + unlang_t *c; + unlang_group_t *g; + unlang_timeout_t *gext; + fr_time_delta_t timeout; + + static unlang_ext_t const timeout_ext = { + .type = UNLANG_TYPE_TIMEOUT, + .len = sizeof(unlang_timeout_t), + .type_name = "unlang_timeout_t", + }; + + /* + * Timeout