]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
don't print module name when inside of call{}
authorAlan T. DeKok <aland@freeradius.org>
Tue, 4 Aug 2026 19:49:54 +0000 (15:49 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 4 Aug 2026 20:24:44 +0000 (16:24 -0400)
the debug output is confusing when it prints messages about the
virtual server, but the initial and final messages are prefixed
with the module name.

src/lib/unlang/call.c
src/lib/unlang/call_priv.h

index 1e01a7d96a670892c654870d732168b064a78283..956e32ff8ebf7038659108d32e7c9a58d03828a2 100644 (file)
@@ -36,6 +36,7 @@ static unlang_action_t unlang_call_resume(UNUSED unlang_result_t *p_result, requ
        unlang_group_t                  *g = unlang_generic_to_group(frame->instruction);
        unlang_call_t                   *gext = unlang_group_to_call(g);
        fr_pair_t                       *packet_type_vp = NULL;
+       unlang_frame_state_call_t       *state = frame->state;
 
        switch (pair_update_reply(&packet_type_vp, gext->attr_packet_type)) {
        case 0:
@@ -46,9 +47,12 @@ static unlang_action_t unlang_call_resume(UNUSED unlang_result_t *p_result, requ
                break;  /* Don't change */
 
        default:
+               request->module = state->module;
                RETURN_UNLANG_FAIL;
        }
 
+       request->module = state->module;
+
        return UNLANG_ACTION_CALCULATE_RESULT;
 }
 
@@ -156,6 +160,8 @@ unlang_action_t unlang_call_push(unlang_result_t *p_result, request_t *request,
        char const                      *name;
        fr_dict_t const                 *dict;
        fr_dict_attr_t const            *attr_packet_type;
+       unlang_stack_frame_t            *frame;
+       unlang_frame_state_call_t       *state;
 
        /*
         *      Temporary hack until packet->code is removed
@@ -206,6 +212,11 @@ unlang_action_t unlang_call_push(unlang_result_t *p_result, request_t *request,
                return UNLANG_ACTION_FAIL;
        }
 
+       frame = &stack->frame[stack->depth];
+       state = frame->state;
+       state->module = request->module;
+       request->module = NULL;
+
        return UNLANG_ACTION_PUSHED_CHILD;
 }
 
@@ -340,5 +351,8 @@ void unlang_call_init(void)
 
                        .unlang_size    = sizeof(unlang_call_t),
                        .unlang_name    = "unlang_call_t",
+
+                       .frame_state_size = sizeof(unlang_frame_state_call_t),
+                       .frame_state_type = "unlang_frame_state_call_t",
                });
 }
index 2b88c95ae323f1bfb8659dfc27188f6e3d48ca45..f97341f15ec70f0f8a7f2ce0f91258f74bca20db 100644 (file)
@@ -42,6 +42,15 @@ typedef struct {
                                                                ///< sections run in the server_cs.
 } unlang_call_t;
 
+/** A module stack entry
+ *
+ * Represents a single module call on the unlang stack.
+ */
+typedef struct {
+       char const                      *module;                //!< module name from request->module
+} unlang_frame_state_call_t;
+
+
 /** Cast a group structure to the call keyword extension
  *
  */