]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: peers: accept to learn strings of different lengths
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Nov 2013 22:02:37 +0000 (23:02 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Nov 2013 22:15:06 +0000 (23:15 +0100)
commit86a446e685a50d952cdadbd98552c968028ba59f
tree35bffea5978cb8e97688415618317f3f363e73c5
parentd6e999b127ff478a6eae0b7dcf8bf170404eac1c
MINOR: peers: accept to learn strings of different lengths

While analysing old bug (9d9179b) with Emeric, we first believed
that the fix was wrong and that there was a potential for learning
one extra character in the peers learning code for strings due to
the use of table->key_size instead of table->key_size-1. In fact it
cannot happen with a normally behaving sender because the key sizes
are compared when synchronizing the table.

But this unveiled a suboptimal handling of strings. It can be quite
common to see admins reload haproxy to increase some key sizes when
seeing that user agents or cookies get truncated, or conversely to
reduce them after seeing they take too much memory and are never full.
The problem is that this will get rid of the table's contents because
of the size mismatch. While this is understandable for properly
formatted data (eg: IP addresses, integers, SSLIDs...) it's too bad
for strings.

So instead, make an exception to accept string of incompatible lengths
and let the synchronization code truncate them to the appropriate size
just as if the keys were learned normally.

Thanks to this change, it is now possible to change the "len" parameter
of a string stick-table and restart without losing its contents.
src/peers.c