From: Arran Cudbard-Bell Date: Fri, 25 Apr 2025 18:36:29 +0000 (-0400) Subject: Store and restore log indentation when frames are popped X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11f672136eb6610e0cc0de04e41a6f586f9e8a6b;p=thirdparty%2Ffreeradius-server.git Store and restore log indentation when frames are popped This helps us get back to sane indentation when we're forcefully cancelling frames. --- diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 33d14f63b6..9e6ce1db6a 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -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; diff --git a/src/lib/unlang/unlang_priv.h b/src/lib/unlang/unlang_priv.h index e72a1f4b4b..57424099c7 100644 --- a/src/lib/unlang/unlang_priv.h +++ b/src/lib/unlang/unlang_priv.h @@ -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];