]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: make sure "show servers state" hides private bits
authorWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 19:40:31 +0000 (21:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Oct 2022 19:45:39 +0000 (21:45 +0200)
In the past we've seen "show servers state" dump some internal bits for
the check states, that were causing regtests to fail. The relevant bits
have been added to the doc to fix the public API and make sure they do
not change by accident, but the output doesn't take care of masking the
undesired ones, causing regtests (and possibly user programs) to fail
when new bits are added. Let's add the mask for the only documented ones
(0x0F for check and 0x1F for agent respectively).

This could be backported wherever the server state is present, though
there's a tiny risk that some undocumented bits might have already
leaked to some user scripts, so it might be wise to wait a bit before
doing that or even not to backport too far.

src/proxy.c

index 12125dd7f853d25865f0ce7fb554cab034885ed8..dc7a95fb8aac6674497ad05fe1953b68bbbe36e1 100644 (file)
@@ -2795,7 +2795,7 @@ static int dump_servers_state(struct stconn *sc)
                                     srv->cur_state, srv->cur_admin, srv->uweight, srv->iweight,
                                     (long int)srv_time_since_last_change,
                                     srv->check.status, srv->check.result, srv->check.health,
-                                    srv->check.state, srv->agent.state,
+                                    srv->check.state & 0x0F, srv->agent.state & 0x1F,
                                     bk_f_forced_id, srv_f_forced_id,
                                     srv->hostname ? HA_ANON_CLI(srv->hostname) : "-", srv->svc_port,
                                     srvrecord ? srvrecord : "-", srv->use_ssl, srv->check.port,