On Die, 2008-05-06 at 00:51 +0200, Hagen Paul Pfeifer wrote:
> now I know why olsrd is so incredible fast ... the hashing is complete broken!
> ;)
> 
> The following patch fix the hash functionality for IP{v4,v6} addresses.
> Currently the code is _really_ buggy, especially for IPv6 (where nearly[tm]
> every address result in a collision). This patch try to fix them. "Try"

Yes, for IPv6 it was - ahemm - very simple.
I never touched the hashing as the real cleanup would be to make a
container data structure and use it instead the open-coded hash+array
implementations.
And if then the hash survive, was left to be seen.

> because the hash result should be mixed with an additional magic cookie to
> prevent some kind of spoofing attacks. But because that isn't a hot topic at
> the moment this patch should be fine.

Hmm, the hash function with lots of "+=" looks quite CPU-consuming for
200MHz MIPS CPUs just to avoid a (long) single linked list and replace
it with n hashed shorter ones.

And we hash either a 4 byte IPv4 address or a 16 byte IPv6 address
(which one can see as 4 IPv4 addresses. But I never did some tests how
bad that hash function should be) into a (IIRC) 4 bit value to index
arrays.

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services




