]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: peers: forget the remote table when ignoring an unknown key type
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 23 Oct 2026 16:18:36 +0000 (18:18 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 26 Oct 2026 10:39:42 +0000 (11:39 +0100)
Commit 1696cfaa1 ("BUG/MEDIUM: peers: enforce check on incoming table key
type") makes peer_treat_definemsg() ignore a table definition with an
unknown key type. But contrary to all other paths ignoring a definition,
it leaves p->remote_table set to the local table matched by name. The
update messages which follow are thus not ignored but decoded using the
local table's key type and applied to it, while they were built for a
different key type. This is precisely the situation the commit wanted to
cover (a newer peer supporting new key types).

Let's reset p->remote_table as the other paths do.

HAProxy never emits such a value: peer_net_key_type[] only covers the five
supported key types, so a compliant peer stays below PEER_KT_TYPES. This is
therefore latent today, and becomes reachable the day a new key type is
added, when a newer peer talks to an older one in a mixed-version cluster.

This must be backported to all stable versions.

src/peers.c

index 4fffcf352cc1c478a13a869ac450708adeba7b07..64fdfdd9c9ccd989902d96674960d0e045847687 100644 (file)
@@ -2412,6 +2412,7 @@ static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
        }
 
        if (table_type < 0 || table_type >= PEER_KT_TYPES) {
+               p->remote_table = NULL;
                TRACE_PROTO("ignore table definition message: unknown table type", PEERS_EV_SESS_IO|PEERS_EV_RX_MSG|PEERS_EV_PROTO_DEF, appctx, p);
                goto ignore_msg;
        }