]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/netfilter/nf_nat_core.c
Merge tag 'ecryptfs-3.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / net / netfilter / nf_nat_core.c
index 552f97cd9fde5c510ac055642affb66adbda181d..4e0b47831d43a25f021a1eeb2c62c2307b8630e1 100644 (file)
@@ -126,7 +126,8 @@ hash_by_src(const struct net *net, u16 zone,
        /* Original src, to ensure we map it consistently if poss. */
        hash = jhash2((u32 *)&tuple->src, sizeof(tuple->src) / sizeof(u32),
                      tuple->dst.protonum ^ zone ^ nf_conntrack_hash_rnd);
-       return ((u64)hash * net->ct.nat_htable_size) >> 32;
+
+       return reciprocal_scale(hash, net->ct.nat_htable_size);
 }
 
 /* Is this tuple already taken? (not by us) */
@@ -274,7 +275,7 @@ find_best_ips_proto(u16 zone, struct nf_conntrack_tuple *tuple,
                }
 
                var_ipp->all[i] = (__force __u32)
-                       htonl(minip + (((u64)j * dist) >> 32));
+                       htonl(minip + reciprocal_scale(j, dist));
                if (var_ipp->all[i] != range->max_addr.all[i])
                        full_range = true;