aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2014-07-24 10:50:30 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-28 01:34:35 -0400
commitfb3cfe6e75b9d05c87265e85e67d7caf6e5b44a7 (patch)
tree3dfe9c9ddebc20bd61571db6d23ff660a67a3485 /net/ipv6
parent36c7778218b93d96d88d68f116a711f6a598b72f (diff)
inet: frag: remove hash size assumptions from callers
hide actual hash size from individual users: The _find function will now fold the given hash value into the required range. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c7
-rw-r--r--net/ipv6/reassembly.c8
2 files changed, 4 insertions, 11 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index c2c3f2116bc5..607e4a94ef41 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -147,12 +147,9 @@ static inline u8 ip6_frag_ecn(const struct ipv6hdr *ipv6h)
147static unsigned int nf_hash_frag(__be32 id, const struct in6_addr *saddr, 147static unsigned int nf_hash_frag(__be32 id, const struct in6_addr *saddr,
148 const struct in6_addr *daddr) 148 const struct in6_addr *daddr)
149{ 149{
150 u32 c;
151
152 net_get_random_once(&nf_frags.rnd, sizeof(nf_frags.rnd)); 150 net_get_random_once(&nf_frags.rnd, sizeof(nf_frags.rnd));
153 c = jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr), 151 return jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr),
154 (__force u32)id, nf_frags.rnd); 152 (__force u32)id, nf_frags.rnd);
155 return c & (INETFRAGS_HASHSZ - 1);
156} 153}
157 154
158 155
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 0c6932cc08cb..2b76549a1016 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -85,13 +85,9 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
85static unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr, 85static unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
86 const struct in6_addr *daddr) 86 const struct in6_addr *daddr)
87{ 87{
88 u32 c;
89
90 net_get_random_once(&ip6_frags.rnd, sizeof(ip6_frags.rnd)); 88 net_get_random_once(&ip6_frags.rnd, sizeof(ip6_frags.rnd));
91 c = jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr), 89 return jhash_3words(ipv6_addr_hash(saddr), ipv6_addr_hash(daddr),
92 (__force u32)id, ip6_frags.rnd); 90 (__force u32)id, ip6_frags.rnd);
93
94 return c & (INETFRAGS_HASHSZ - 1);
95} 91}
96 92
97static unsigned int ip6_hashfn(const struct inet_frag_queue *q) 93static unsigned int ip6_hashfn(const struct inet_frag_queue *q)