Hello,

Recently, we were trying to segment our account provisioning using HAProxy.
 We are having HAProxy to port NAT traffic to a backend, using the djb2
hash to select the backend based on the Host header.  When attempting to
predict the backend that HAProxy would select, we were unable to come to
the same results as HAProxy did.

We dove into the code that HAProxy used to implement the djb2 hash, and
discovered a bug in the map_get_server_hash function declaration.  Where in
the rest of the code, it uses an unsigned long for the hash value, the
map_get_server_hash function uses an unsigned int.

The end result is that we have a consistent value chosen for a backend by
HAProxy, but one that is unpredictable by a standard implementation of djb2.

Attached is the patch we used that resolved this issue.

-- Dan.

Attachment: haproxy_fix_map_hash.patch
Description: Binary data

Reply via email to