netfilter: nfnetlink_queue: use xor hash function to distribute instances
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 14 Mar 2013 06:03:17 +0000 (06:03 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 15 Mar 2013 11:38:40 +0000 (12:38 +0100)
Thanks to Eric Dumazet for suggesting this during the NFWS.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nfnetlink_queue_core.c

index 858fd52c10408393a901a9afb686226638f32f07..350c50fbfd4ded03cf4485ddd6d6a2cb87e433a6 100644 (file)
@@ -73,7 +73,7 @@ static struct hlist_head instance_table[INSTANCE_BUCKETS] __read_mostly;
 
 static inline u_int8_t instance_hashfn(u_int16_t queue_num)
 {
-       return ((queue_num >> 8) | queue_num) % INSTANCE_BUCKETS;
+       return ((queue_num >> 8) ^ queue_num) % INSTANCE_BUCKETS;
 }
 
 static struct nfqnl_instance *