Skip to content

Commit 33de014

Browse files
xemuldavem330
authored andcommitted
inet6: add struct net argument to inet6_ehashfn
Same as for inet_hashfn, prepare its ipv6 incarnation. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9f26b3a commit 33de014

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

include/net/inet6_hashtables.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
struct inet_hashinfo;
2929

3030
/* 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,
3233
const struct in6_addr *faddr, const __be16 fport)
3334
{
3435
u32 ports = (lport ^ (__force u16)fport);
@@ -46,7 +47,9 @@ static inline int inet6_sk_ehashfn(const struct sock *sk)
4647
const struct in6_addr *faddr = &np->daddr;
4748
const __u16 lport = inet->num;
4849
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);
5053
}
5154

5255
extern void __inet6_hash(struct sock *sk);

net/ipv6/inet6_hashtables.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct sock *__inet6_lookup_established(struct net *net,
6868
/* Optimize here for direct hit, only listening connections can
6969
* have wildcards anyways.
7070
*/
71-
unsigned int hash = inet6_ehashfn(daddr, hnum, saddr, sport);
71+
unsigned int hash = inet6_ehashfn(net, daddr, hnum, saddr, sport);
7272
struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash);
7373
rwlock_t *lock = inet_ehash_lockp(hashinfo, hash);
7474

@@ -166,14 +166,14 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
166166
const struct in6_addr *saddr = &np->daddr;
167167
const int dif = sk->sk_bound_dev_if;
168168
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,
170171
inet->dport);
171172
struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash);
172173
rwlock_t *lock = inet_ehash_lockp(hinfo, hash);
173174
struct sock *sk2;
174175
const struct hlist_node *node;
175176
struct inet_timewait_sock *tw;
176-
struct net *net = sock_net(sk);
177177

178178
prefetch(head->chain.first);
179179
write_lock(lock);

0 commit comments

Comments
 (0)