]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: always initialize the stksess shard value
authorWilly Tarreau <w@1wt.eu>
Tue, 29 Nov 2022 15:08:35 +0000 (16:08 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 29 Nov 2022 15:33:37 +0000 (16:33 +0100)
We need to initialize the shard value in __stksess_init() because there is
not necessarily a key to make it happen later, resulting in an uninitialized
shard value appearing in the entry, typically when entries are learned from
peers. This fixes commit 36d156564 ("MINOR: peers: Support for peer shards"),
no backport is needed.

Note however that it is not sufficient to completely fix the peers code, the
shard value remains zero because the setting of the key was open-coded in
the peers code and these parts were not identified when adding support for
shards.

src/stick_table.c

index 3ca2c887f54e789d033184260c09be43965cdb94..152abf7e22a9c9c2a2aabc24310534196e8da302 100644 (file)
@@ -199,6 +199,7 @@ static struct stksess *__stksess_init(struct stktable *t, struct stksess * ts)
 {
        memset((void *)ts - t->data_size, 0, t->data_size);
        ts->ref_cnt = 0;
+       ts->shard = 0;
        ts->key.node.leaf_p = NULL;
        ts->exp.node.leaf_p = NULL;
        ts->upd.node.leaf_p = NULL;