]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Store and restore log indentation when frames are popped
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 25 Apr 2025 18:36:29 +0000 (14:36 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 25 Apr 2025 18:57:42 +0000 (14:57 -0400)
This helps us get back to sane indentation when we're forcefully cancelling frames.

src/lib/unlang/interpret.c
src/lib/unlang/unlang_priv.h

index 33d14f63b67a845153e86d774a284406e409bc6e..9e6ce1db6aa50fa277b24c4aaa324b92343ed9dd 100644 (file)
@@ -202,6 +202,7 @@ int unlang_interpret_push(request_t *request, unlang_t const *instruction,
 
        frame->result = default_rcode;
        frame->priority = -1;
+       frame->indent = request->log.indent;
 
        if (!instruction) return 0;
 
index e72a1f4b4bcec5214dbfb88fa6e91b3df4ef104c..57424099c770bb5df8f311f6a47712861346a3e7 100644 (file)
@@ -302,7 +302,12 @@ struct unlang_stack_frame_s {
                                                                ///< this priority will be compared with the one of the
                                                                ///< frame lower in the stack to determine if the
                                                                ///< result stored in the lower stack frame should
+       rindent_t               indent;                         //!< Indent level of the request when the frame was
+                                                               ///< created.  This is used to restore the indent
+                                                               ///< level when the stack is being forcefully unwound.
        uint8_t                 uflags;                         //!< Unwind markers
+
+
 #ifdef WITH_PERF
        fr_time_tracking_t      tracking;                       //!< track this instance of this instruction
 #endif
@@ -496,6 +501,13 @@ static inline void frame_pop(request_t *request, unlang_stack_t *stack)
         */
        TALLOC_FREE(frame->retry);
 
+       /*
+        *      Ensure log indent is at the same level as it was when
+        *      the frame was pushed.  This is important when we're
+        *      unwinding the stack and forcefully cancelling calls.
+        */
+       request->log.indent = frame->indent;
+
        frame_cleanup(frame);
 
        frame = &stack->frame[--stack->depth];