BUG/MEDIUM: stats: fix resolvers dump
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 2 Feb 2023 16:27:27 +0000 (17:27 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Feb 2023 06:53:03 +0000 (07:53 +0100)
commite5958d0292222c6cc122b1b19b79c959ec27370b
tree35b35d8de808e739988c0d01df3cd26f72725ba2
parent14656844cc68794d0c6994c10a07a5f7ebce50f6
BUG/MEDIUM: stats: fix resolvers dump

In ("BUG/MEDIUM: stats: Rely on a local trash buffer to dump the stats"),
we forgot to apply the patch in resolvers.c which provides the
stats_dump_resolvers() function that is involved when dumping with "resolvers"
domain.

As a consequence, resolvers dump was broken because stats_dump_one_line(),
which is used in stats_dump_resolv_to_buffer(), implicitely uses trash_chunk
from stats.c to prepare the dump, and stats_putchk() is then called with
global trash (currently empty) as output data.

Given that trash_dump variable is static and thus only available within stats.c
we change stats_putchk() function prototype so that the function does not take
the output buffer as an argument. Instead, stats_putchk() will implicitly use
the local trash_dump variable declared in stats.c.

It will also prevent further mixups between stats_dump_* functions and
stats_putchk().

This needs to be backported with ("BUG/MEDIUM: stats: Rely on a local trash
buffer to dump the stats")
include/haproxy/stats.h
src/resolvers.c
src/stats.c