From: Aurelien DARRAGON Date: Fri, 3 Feb 2023 10:43:05 +0000 (+0100) Subject: BUG/MINOR: stats: fix ctx->field update in stats_dump_proxy_to_buffer() X-Git-Tag: v2.8-dev4~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b07d4fecd9451ad1e373c6c52c0547885c29920;p=thirdparty%2Fhaproxy.git BUG/MINOR: stats: fix ctx->field update in stats_dump_proxy_to_buffer() When ctx->field was introduced with ("MINOR: stats: introduce stats field ctx") a mistake was made for the STAT_PX_ST_LI state in stats_dump_proxy_to_buffer(): current_field reset is placed after the for loop, ie: after multiple lines are dumped. Instead it should be placed right after each li line is dumped. This could cause some output inconsistencies (missing fields), especially when http dump is used with JSON output and "socket-stats" option is enabled on the proxy, because when htx is full we restore the ctx->field with current_field (which contains outdated value in this case). This should be backported with ("MINOR: stats: introduce stats field ctx") --- diff --git a/src/stats.c b/src/stats.c index eea5d7c923..5be66d4840 100644 --- a/src/stats.c +++ b/src/stats.c @@ -3249,9 +3249,9 @@ more: if (ctx->field) goto more; } + current_field = 0; } - current_field = 0; ctx->obj2 = px->srv; /* may be NULL */ ctx->px_st = STAT_PX_ST_SV; __fallthrough;