]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: stktable: fix big-endian compatiblity in smp_to_stkey()
authorAurelien DARRAGON <adarragon@haproxy.com>
Thu, 9 Jan 2025 08:05:43 +0000 (09:05 +0100)
committerAurelien DARRAGON <adarragon@haproxy.com>
Thu, 9 Jan 2025 09:56:43 +0000 (10:56 +0100)
commitb59d1fd911045c37b3fc88795a1f2c1947e6e59d
tree1de80491beb4997ff4d6861ab76cdd8e16b553eb
parent7be596b35c546a76716d7ab3fdc9042bf78fb584
BUG/MINOR: stktable: fix big-endian compatiblity in smp_to_stkey()

When smp_to_stkey() deals with SINT samples, since stick-tables deals with
32 bits integers while SINT sample is 64 bit integer, inplace conversion
was done in smp_to_stkey. For that the 64 bit integer was truncated before
the key would point to it. Unfortunately this only works on little endian
architectures because with big endian ones, the key would point to the
wrong 32bit range.

To fix the issue and make the conversion endian-proof, let's re-assign
the sample as 32bit integer before the key points to it.

Thanks to Willy for having spotted the bug and suggesting the above fix.

It should be backported to all stable versions.
src/stick_table.c