]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: server: distinguish name references with new SRV_F_NAME_REFD flag
authorAlexander Stephan <alexander.stephan@sap.com>
Thu, 25 Jun 2026 09:04:59 +0000 (09:04 +0000)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 1 Jul 2026 07:11:18 +0000 (09:11 +0200)
commit47b20a72e204fbe5347ab270afdbef327642d4aa
treef21b59f2ca9d58acf533120d1d3ed01609f5486d
parent9475e69920f04174496caf71fcabf6e72824f5c2
MINOR: server: distinguish name references with new SRV_F_NAME_REFD flag

Until now, every form of "this server is referenced by something in the
running config" was collapsed onto a single flag, SRV_F_NON_PURGEABLE,
which prevents the server from being removed via 'del server'. This
catches everything but conflates two distinct properties:

  - the server object itself is pinned by another runtime structure
    (e.g. DNS resolution attached to it), versus
  - the server's *name* is referenced statically (use-server rules,
    track chains, sample-fetch arguments of type ARGT_SRV)

These differ for any operation that touches the name but not the
object identity, e.g. the runtime rename feature added next. Removing
a name-referenced server is still forbidden (the rule text would
dangle), but renaming such a server should also be forbidden for the
same reason - while renaming a resolver-pinned server is fine, since
the resolver holds the object pointer and doesn't care about the name.

Introduce SRV_F_NAME_REFD for the name-reference case and move the
three name-based setters (sample.c ARGT_SRV resolution, proxy.c
use-server resolution, server.c track chain setup) from
SRV_F_NON_PURGEABLE to SRV_F_NAME_REFD. The resolvers.c call site
keeps SRV_F_NON_PURGEABLE since it is the object-pinned case.

Adjust 'del server' to check both flags so the set of servers it
refuses to remove is unchanged: same observable behavior, just a
richer internal taxonomy.

A subsequent patch introducing 'set server name' will gate on
SRV_F_NAME_REFD only.
include/haproxy/server-t.h
src/proxy.c
src/sample.c
src/server.c