Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111989
b: refs/heads/master
c: 93c8b90
h: refs/heads/master
i:
  111987: 86d7e89
v: v3
  • Loading branch information
Ilpo Järvinen authored and David S. Miller committed Oct 1, 2008
1 parent 5f1de8d commit d11a258
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2bcb4b0f111053d0e8fb4366f0708395d997e93a
refs/heads/master: 93c8b90f01f0dc73891da4e84b26524b61d29d66
2 changes: 2 additions & 0 deletions trunk/include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
struct group_filter __user *optval,
int __user *optlen);
extern unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
const struct in6_addr *daddr, u32 rnd);

#ifdef CONFIG_PROC_FS
extern int ac6_proc_init(struct net *net);
Expand Down
32 changes: 2 additions & 30 deletions trunk/net/ipv6/netfilter/nf_conntrack_reasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
#include <linux/random.h>
#include <linux/jhash.h>

#include <net/sock.h>
#include <net/snmp.h>
Expand Down Expand Up @@ -103,39 +102,12 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = {
};
#endif

static unsigned int ip6qhashfn(__be32 id, const struct in6_addr *saddr,
const struct in6_addr *daddr)
{
u32 a, b, c;

a = (__force u32)saddr->s6_addr32[0];
b = (__force u32)saddr->s6_addr32[1];
c = (__force u32)saddr->s6_addr32[2];

a += JHASH_GOLDEN_RATIO;
b += JHASH_GOLDEN_RATIO;
c += nf_frags.rnd;
__jhash_mix(a, b, c);

a += (__force u32)saddr->s6_addr32[3];
b += (__force u32)daddr->s6_addr32[0];
c += (__force u32)daddr->s6_addr32[1];
__jhash_mix(a, b, c);

a += (__force u32)daddr->s6_addr32[2];
b += (__force u32)daddr->s6_addr32[3];
c += (__force u32)id;
__jhash_mix(a, b, c);

return c & (INETFRAGS_HASHSZ - 1);
}

static unsigned int nf_hashfn(struct inet_frag_queue *q)
{
const struct nf_ct_frag6_queue *nq;

nq = container_of(q, struct nf_ct_frag6_queue, q);
return ip6qhashfn(nq->id, &nq->saddr, &nq->daddr);
return inet6_hash_frag(nq->id, &nq->saddr, &nq->daddr, nf_frags.rnd);
}

static void nf_skb_free(struct sk_buff *skb)
Expand Down Expand Up @@ -209,7 +181,7 @@ fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
arg.dst = dst;

read_lock_bh(&nf_frags.lock);
hash = ip6qhashfn(id, src, dst);
hash = inet6_hash_frag(id, src, dst, nf_frags.rnd);

q = inet_frag_find(&nf_init_frags, &nf_frags, &arg, hash);
local_bh_enable();
Expand Down
11 changes: 6 additions & 5 deletions trunk/net/ipv6/reassembly.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
* callers should be careful not to use the hash value outside the ipfrag_lock
* as doing so could race with ipfrag_hash_rnd being recalculated.
*/
static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
struct in6_addr *daddr)
unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
const struct in6_addr *daddr, u32 rnd)
{
u32 a, b, c;

Expand All @@ -110,7 +110,7 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,

a += JHASH_GOLDEN_RATIO;
b += JHASH_GOLDEN_RATIO;
c += ip6_frags.rnd;
c += rnd;
__jhash_mix(a, b, c);

a += (__force u32)saddr->s6_addr32[3];
Expand All @@ -125,13 +125,14 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,

return c & (INETFRAGS_HASHSZ - 1);
}
EXPORT_SYMBOL_GPL(inet6_hash_frag);

static unsigned int ip6_hashfn(struct inet_frag_queue *q)
{
struct frag_queue *fq;

fq = container_of(q, struct frag_queue, q);
return ip6qhashfn(fq->id, &fq->saddr, &fq->daddr);
return inet6_hash_frag(fq->id, &fq->saddr, &fq->daddr, ip6_frags.rnd);
}

int ip6_frag_match(struct inet_frag_queue *q, void *a)
Expand Down Expand Up @@ -247,7 +248,7 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst,
arg.dst = dst;

read_lock(&ip6_frags.lock);
hash = ip6qhashfn(id, src, dst);
hash = inet6_hash_frag(id, src, dst, ip6_frags.rnd);

q = inet_frag_find(&net->ipv6.frags, &ip6_frags, &arg, hash);
if (q == NULL)
Expand Down

0 comments on commit d11a258

Please sign in to comment.