diff options
-rw-r--r-- | include/net/inet6_hashtables.h | 7 | ||||
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 62a5b691858e..72f13a9928e4 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -28,7 +28,8 @@ | |||
28 | struct inet_hashinfo; | 28 | struct inet_hashinfo; |
29 | 29 | ||
30 | /* I have no idea if this is a good hash for v6 or not. -DaveM */ | 30 | /* I have no idea if this is a good hash for v6 or not. -DaveM */ |
31 | static inline unsigned int inet6_ehashfn(const struct in6_addr *laddr, const u16 lport, | 31 | static inline unsigned int inet6_ehashfn(struct net *net, |
32 | const struct in6_addr *laddr, const u16 lport, | ||
32 | const struct in6_addr *faddr, const __be16 fport) | 33 | const struct in6_addr *faddr, const __be16 fport) |
33 | { | 34 | { |
34 | u32 ports = (lport ^ (__force u16)fport); | 35 | u32 ports = (lport ^ (__force u16)fport); |
@@ -46,7 +47,9 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) | |||
46 | const struct in6_addr *faddr = &np->daddr; | 47 | const struct in6_addr *faddr = &np->daddr; |
47 | const __u16 lport = inet->num; | 48 | const __u16 lport = inet->num; |
48 | const __be16 fport = inet->dport; | 49 | const __be16 fport = inet->dport; |
49 | return inet6_ehashfn(laddr, lport, faddr, fport); | 50 | struct net *net = sock_net(sk); |
51 | |||
52 | return inet6_ehashfn(net, laddr, lport, faddr, fport); | ||
50 | } | 53 | } |
51 | 54 | ||
52 | extern void __inet6_hash(struct sock *sk); | 55 | extern void __inet6_hash(struct sock *sk); |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index b940156ca4f5..a9cc8ab33a49 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -68,7 +68,7 @@ struct sock *__inet6_lookup_established(struct net *net, | |||
68 | /* Optimize here for direct hit, only listening connections can | 68 | /* Optimize here for direct hit, only listening connections can |
69 | * have wildcards anyways. | 69 | * have wildcards anyways. |
70 | */ | 70 | */ |
71 | unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport); | 71 | unsigned int hash = inet6_ehashfn(net, daddr, hnum, saddr, sport); |
72 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | 72 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); |
73 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | 73 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); |
74 | 74 | ||
@@ -166,14 +166,14 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
166 | const struct in6_addr *saddr = &np->daddr; | 166 | const struct in6_addr *saddr = &np->daddr; |
167 | const int dif = sk->sk_bound_dev_if; | 167 | const int dif = sk->sk_bound_dev_if; |
168 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 168 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
169 | const unsigned int hash = inet6_ehashfn(daddr, lport, saddr, | 169 | struct net *net = sock_net(sk); |
170 | const unsigned int hash = inet6_ehashfn(net, daddr, lport, saddr, | ||
170 | inet->dport); | 171 | inet->dport); |
171 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 172 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
172 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); | 173 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); |
173 | struct sock *sk2; | 174 | struct sock *sk2; |
174 | const struct hlist_node *node; | 175 | const struct hlist_node *node; |
175 | struct inet_timewait_sock *tw; | 176 | struct inet_timewait_sock *tw; |
176 | struct net *net = sock_net(sk); | ||
177 | 177 | ||
178 | prefetch(head->chain.first); | 178 | prefetch(head->chain.first); |
179 | write_lock(lock); | 179 | write_lock(lock); |