]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: server: make sure the HMAINT state is part of MAINT
authorWilly Tarreau <w@1wt.eu>
Fri, 27 Sep 2024 16:38:35 +0000 (18:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 Sep 2024 16:40:15 +0000 (18:40 +0200)
In 1.8 when adding "set server fqdn" with commit b418c1228c ("MINOR:
server: cli: Add server FQDNs to server-state file and stats socket."),
the HMAINT flag was not made part of the MAINT ones, so technically
speaking when changing the FQDN, the server is not completely considered
as in maintenance mode.

In its defense, the code location around that was completely messy, with
the aggregator flag being hidden between other values and purposely but
discretely ignoring one of the flags, so the comments were updated to
make the intent clearer (particularly regarding CMAINT which looked like
it was also forgotten while it was on purpose).

This can be backported anywhere.

include/haproxy/server-t.h

index 1c46de821af03ac34008a13a74285d56bbde4ffe..b29106d4c02f94f9476874b895d19e8aec6c8c4e 100644 (file)
@@ -77,13 +77,14 @@ enum srv_state {
 enum srv_admin {
        SRV_ADMF_FMAINT    = 0x01,        /* the server was explicitly forced into maintenance */
        SRV_ADMF_IMAINT    = 0x02,        /* the server has inherited the maintenance status from a tracked server */
-       SRV_ADMF_MAINT     = 0x23,        /* mask to check if any maintenance flag is present */
-       SRV_ADMF_CMAINT    = 0x04,        /* the server is in maintenance because of the configuration */
+       SRV_ADMF_CMAINT    = 0x04,        /* the server is in maintenance because of the configuration (separate) */
        SRV_ADMF_FDRAIN    = 0x08,        /* the server was explicitly forced into drain state */
        SRV_ADMF_IDRAIN    = 0x10,        /* the server has inherited the drain status from a tracked server */
        SRV_ADMF_DRAIN     = 0x18,        /* mask to check if any drain flag is present */
        SRV_ADMF_RMAINT    = 0x20,        /* the server is down because of an IP address resolution failure */
        SRV_ADMF_HMAINT    = 0x40,        /* the server FQDN has been set from socket stats */
+
+       SRV_ADMF_MAINT     = 0x63,        /* mask to check if any maintenance flag except CMAINT is present */
 } __attribute__((packed));
 
 /* options for servers' "init-addr" parameter