Re: Question about tcp hash function tcp_hashfn()

Brian F. G. Bidulock
2006-05-31T07:45:43Z

David,

On Wed, 31 May 2006, David Miller wrote:

> From: "Brian F. G. Bidulock" <bidulock@openss7.org>
> Date: Tue, 30 May 2006 23:55:26 -0600
>
> > For example, it goes to great pains to permute upper order bits in
> > the local address, which for most connections will be a constant
> > value.
>
> Consider an apache server hosting thousands of virtual
> hosts. The local address will be different for every
> such host.
>

If you mean named virtual hosts, no. They have the same
addresses.

If you mean actual hosts (with an IP address), perhaps in
the low order bits (host number), but unlikely in the high
order bits of the local address (network mask bits).

Also, in such a case the local port number will be rather
constant (80, etc); a condition also not exploited by the
function.

Also consider that the function simply folds the values
rather than permuting bits across the key field by shifting
by some other value than a multiple of 8 between XOR
operations. This will result in a longer collision list
because the entropy of the key value has not been
sufficiently reduced.

It might sound like I'm complaining, but I'm not. The
function works for me. But from a purist point of view,
the hash function is not as efficient as it could be and
there is room for improvement.