diff options
Diffstat (limited to 'net/ipv6/inet6_hashtables.c')
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 580014aea4d6..00a8a5f9380c 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 | ||
@@ -104,7 +104,8 @@ struct sock *inet6_lookup_listener(struct net *net, | |||
104 | int score, hiscore = 0; | 104 | int score, hiscore = 0; |
105 | 105 | ||
106 | read_lock(&hashinfo->lhash_lock); | 106 | read_lock(&hashinfo->lhash_lock); |
107 | sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { | 107 | sk_for_each(sk, node, |
108 | &hashinfo->listening_hash[inet_lhashfn(net, hnum)]) { | ||
108 | if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum && | 109 | if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum && |
109 | sk->sk_family == PF_INET6) { | 110 | sk->sk_family == PF_INET6) { |
110 | const struct ipv6_pinfo *np = inet6_sk(sk); | 111 | const struct ipv6_pinfo *np = inet6_sk(sk); |
@@ -165,14 +166,14 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
165 | const struct in6_addr *saddr = &np->daddr; | 166 | const struct in6_addr *saddr = &np->daddr; |
166 | const int dif = sk->sk_bound_dev_if; | 167 | const int dif = sk->sk_bound_dev_if; |
167 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); | 168 | const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); |
168 | 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, | ||
169 | inet->dport); | 171 | inet->dport); |
170 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); | 172 | struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, hash); |
171 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); | 173 | rwlock_t *lock = inet_ehash_lockp(hinfo, hash); |
172 | struct sock *sk2; | 174 | struct sock *sk2; |
173 | const struct hlist_node *node; | 175 | const struct hlist_node *node; |
174 | struct inet_timewait_sock *tw; | 176 | struct inet_timewait_sock *tw; |
175 | struct net *net = sock_net(sk); | ||
176 | 177 | ||
177 | prefetch(head->chain.first); | 178 | prefetch(head->chain.first); |
178 | write_lock(lock); | 179 | write_lock(lock); |
@@ -209,11 +210,11 @@ unique: | |||
209 | 210 | ||
210 | if (twp != NULL) { | 211 | if (twp != NULL) { |
211 | *twp = tw; | 212 | *twp = tw; |
212 | NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED); | 213 | NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED); |
213 | } else if (tw != NULL) { | 214 | } else if (tw != NULL) { |
214 | /* Silly. Should hash-dance instead... */ | 215 | /* Silly. Should hash-dance instead... */ |
215 | inet_twsk_deschedule(tw, death_row); | 216 | inet_twsk_deschedule(tw, death_row); |
216 | NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED); | 217 | NET_INC_STATS_BH(twsk_net(tw), LINUX_MIB_TIMEWAITRECYCLED); |
217 | 218 | ||
218 | inet_twsk_put(tw); | 219 | inet_twsk_put(tw); |
219 | } | 220 | } |