Hash Function to Seperate Flows
cs83152 at csie.chu.edu.tw
Thu May 4 07:02:10 CEST 2006
I suggest to refer the net/ipv4/netfilter/ip_conntrack_core.c
Thehe is a example using jhash for reference.
static u_int32_t __hash_conntrack(const struct ip_conntrack_tuple
unsigned int size, unsigned int rnd)
(tuple->dst.ip ^ tuple->dst.protonum),
(tuple->src.u.all | (tuple->dst.u.all <<
rnd) % size);
>From: netfilter-devel-bounces at lists.netfilter.org
>[mailto:netfilter-devel-bounces at lists.netfilter.org] On Behalf
>Of Amin Azez
>Sent: Wednesday, May 03, 2006 5:35 PM
>To: netfilter-devel at lists.netfilter.org
>Subject: Re: Hash Function to Seperate Flows
>Srinivas Krishnan wrote:
>> i am trying to separate different flows, and was wondering
>if there is
>> a standard hash function with low collisions i can use to hash based
>> on src ip, dest ip, src port, dest port and protocol.
>> there seems to be as hash fn in freeBSD's dummynet code but I do not
>> know if it can be directly applied, as it does some bit
>> any help/thoughts would be greatly appreciated
>I suggest you read a few times through all kernel source files
>with "conntrack" in the name.
>I did, and it did me a world of good.
>jhash is probably the hash function you want. Look out for it,
>and happy reading.
More information about the netfilter-devel