]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: stick-table: change the API of the function used to calculate the shard
authorWilly Tarreau <w@1wt.eu>
Tue, 29 Nov 2022 16:36:44 +0000 (17:36 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 29 Nov 2022 17:06:42 +0000 (18:06 +0100)
commitd5cae6a0c70bb9b31c3973676eba3359f765592d
tree423f4c94bdcaeb444e07062b0775971e1332ba53
parent061a098c5c2b559a2b208d9c67145d98400ada2d
MINOR: stick-table: change the API of the function used to calculate the shard

The function used to calculate the shard number currently requires a
stktable_key on input for this. Unfortunately, it happens that peers
currently miss this calculation and they do not provide stktable_key
at all, instead they're open-coding all the low-level stick-table work
(hence why it's missing). Thus we'll need to be able to calculate the
shard number in keys coming from peers as well but the current API does
not make it possible.

This commit addresses this by inverting the order where the length and
the shard number are used. Now the low-level function is independent on
stksess and stktable_key, it takes a table, pointer and length and does
all the job. The upper function takes care of the type and key to get
the its length, and is for use only from stick-table code.

This doesn't change anything except that the low-level one will be usable
from outside (hence why it's exported now).
include/haproxy/stick_table.h
src/stick_table.c