Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: xt_NFQUEUE: remove modulo operations

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>

authored by

Changli Gao and committed by
Patrick McHardy
ca361810 e5fc9e7a

+4 -2
+4 -2
net/netfilter/xt_NFQUEUE.c
··· 72 72 73 73 if (info->queues_total > 1) { 74 74 if (par->family == NFPROTO_IPV4) 75 - queue = hash_v4(skb) % info->queues_total + queue; 75 + queue = (((u64) hash_v4(skb) * info->queues_total) >> 76 + 32) + queue; 76 77 #if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE) 77 78 else if (par->family == NFPROTO_IPV6) 78 - queue = hash_v6(skb) % info->queues_total + queue; 79 + queue = (((u64) hash_v6(skb) * info->queues_total) >> 80 + 32) + queue; 79 81 #endif 80 82 } 81 83 return NF_QUEUE_NR(queue);