From: Alan T. DeKok Date: Tue, 4 Aug 2026 20:16:20 +0000 (-0400) Subject: move debug "Running foo bar { } from file baz" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;p=thirdparty%2Ffreeradius-server.git move debug "Running foo bar { } from file baz" to the main interpreter loop, which cleans up the debug output a bit, and makes it easier to parse --- diff --git a/src/lib/eap/base.c b/src/lib/eap/base.c index 0f97e3b1610..54c7c3a597c 100644 --- a/src/lib/eap/base.c +++ b/src/lib/eap/base.c @@ -389,7 +389,7 @@ unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_sessio fr_assert(request->parent); fr_assert(virtual_server); - RDEBUG2("Running request through virtual server \"%s\"", cf_section_name2(virtual_server_cs(virtual_server))); + RIDEBUG("Running virtual_server = %s", cf_section_name2(virtual_server_cs(virtual_server))); /* * Re-present the previously stored child's session state if there is one diff --git a/src/lib/server/process.h b/src/lib/server/process.h index 8a97555ce91..c333cb62d60 100644 --- a/src/lib/server/process.h +++ b/src/lib/server/process.h @@ -253,8 +253,6 @@ RECV(generic) RETURN_UNLANG_FAIL; } - - if (cs) RDEBUG("Running '%s %s' from file %s", cf_section_name1(cs), cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(RESULT_P, request, cs, state->default_rcode, state->resume, NULL, 0, mctx->rctx); @@ -361,9 +359,7 @@ SEND_NO_RESULT(generic) MEM(0); } - if (cs) { - RDEBUG("Running '%s %s' from file %s", cf_section_name1(cs), cf_section_name2(cs), cf_filename(cs)); - } else { + if (!cs) { char const *name; name = fr_dict_enum_name_by_value(attr_packet_type, fr_box_uint32(request->reply->code)); @@ -514,7 +510,6 @@ RESUME(new_client) return UNLANG_ACTION_CALCULATE_RESULT; } - RDEBUG("Running '%s %s' from file %s", cf_section_name1(cs), cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(RESULT_P, request, cs, RLM_MODULE_FAIL, resume_new_client_done, NULL, 0, mctx->rctx); @@ -532,7 +527,6 @@ static inline unlang_action_t new_client(UNUSED unlang_result_t *p_result, modul fr_assert(inst->sections.new_client != NULL); cs = inst->sections.new_client; - RDEBUG("Running '%s %s' from file %s", cf_section_name1(cs), cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(RESULT_P, request, cs, RLM_MODULE_FAIL, resume_new_client, NULL, 0, mctx->rctx); diff --git a/src/lib/unlang/call.c b/src/lib/unlang/call.c index 956e32ff8eb..33257708ce4 100644 --- a/src/lib/unlang/call.c +++ b/src/lib/unlang/call.c @@ -193,6 +193,7 @@ unlang_action_t unlang_call_push(unlang_result_t *p_result, request_t *request, .debug_name = name, .ci = CF_TO_ITEM(server_cs), .actions = MOD_ACTIONS_FAIL_TIMEOUT_RETURN, + .add_filename = true, }, .cs = server_cs, diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index 019248df928..5db0ed83181 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -2241,6 +2241,7 @@ int unlang_compile(virtual_server_t const *vs, */ cf_data_add(cs, c, NULL, false); cf_item_mark_parsed(cs); + c->add_filename = true; if (instruction) *instruction = c; return 0; diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index e8adb97ca81..2f77e2585ca 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -1125,7 +1125,11 @@ unlang_frame_action_t frame_eval(request_t *request, unlang_stack_frame_t *frame */ if (!is_repeatable(frame)) { if (has_debug_braces(frame)) { - RDEBUG2("%s {", instruction->debug_name); + if (unlikely(instruction->add_filename)) { + RDEBUG2("%s { # from file %s", instruction->debug_name, cf_filename(instruction->ci)); + } else { + RDEBUG2("%s {", instruction->debug_name); + } RINDENT(); } /* diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index ca46610485a..705cd70647d 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -139,6 +139,7 @@ struct unlang_s { char const *debug_name; //!< Printed in log messages when the node is executed. unlang_type_t type; //!< The specialisation of this node. bool closed; //!< whether or not this section is closed to new statements + bool add_filename; //!< add the filename when printing in debug mode CONF_ITEM *ci; //!< used to generate this item unsigned int number; //!< unique node number unlang_mod_actions_t actions; //!< Priorities, etc. for the various return codes. diff --git a/src/process/radius/base.c b/src/process/radius/base.c index c8144d98bc9..96c1be51e03 100644 --- a/src/process/radius/base.c +++ b/src/process/radius/base.c @@ -367,7 +367,6 @@ RESUME(access_request) * * And continue with sending the generic reply. */ - RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(RESULT_P, request, cs, RLM_MODULE_NOOP, resume_auth_type, NULL, 0, mctx->rctx); @@ -718,8 +717,6 @@ static unlang_action_t mod_process(unlang_result_t *p_result, module_ctx_t const RETURN_UNLANG_FAIL; } - LOG_PACKET_DEBUG(request, request->packet, &request->request_pairs, fr_radius_packet_name, true, (request->packet->id >= 0)); - if (unlikely(request_is_dynamic_client(request))) { return new_client(p_result, mctx, request); } diff --git a/src/process/tacacs/base.c b/src/process/tacacs/base.c index 498889a31cd..9915a48c351 100644 --- a/src/process/tacacs/base.c +++ b/src/process/tacacs/base.c @@ -541,7 +541,6 @@ RESUME(auth_start) * * And continue with sending the generic reply. */ - RDEBUG("Running 'authenticate %s' from file %s", cf_section_name2(cs), cf_filename(cs)); return unlang_module_yield_to_section(RESULT_P, request, cs, RLM_MODULE_NOOP, resume_auth_type, NULL, 0, mctx->rctx);