]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: resolvers: preserve nameserver identity on "clear counters all"
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 29 Sep 2026 07:28:02 +0000 (09:28 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 10 Nov 2026 14:47:52 +0000 (15:47 +0100)
commit47eca42f8cce9df9a326dc90002e3d01b0e06e97
tree9ae9b49b1ec8011d95352ffd909787538f128e94
parentb5232b12f79b0365c99414f44c9df0c0f473936b
BUG/MINOR: resolvers: preserve nameserver identity on "clear counters all"

The resolvers statistics module stores the nameserver's id, its parent
resolvers' id and the nameserver's puid in the counters structure, next
to the counters themselves. "clear counters all" resets all counters by
copying the module's template over them in resolv_stats_clear_counters(),
which also clears these fields. As a result, "show stat domain resolvers"
reports empty "id" and "pid" fields for all nameservers afterwards, and
ns_puid becomes zero, so that server address changes performed by a DNS
resolution are then attributed to the wrong nameserver
(SERVER_INETADDR_UPDATER_DNS_RESOLVER(counters->ns_puid)).

This can be reproduced with any resolvers section:

  > clear counters all
  > show stat domain resolvers
  # id,pid,sent,...
  ,,0,0,...

Let's restore these fields after the reset, as done when allocating the
counters.

This patch should be backported to all stable branches.
src/resolvers.c