diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-13 01:43:25 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-02-13 01:43:25 -0500 |
commit | d9bc125caf592b7d081021f32ce5b717efdf70c8 (patch) | |
tree | 263b7066ba22ddce21db610c0300f6eaac6f2064 /net/ipv6/inet6_hashtables.c | |
parent | 43d78ef2ba5bec26d0315859e8324bfc0be23766 (diff) | |
parent | ec2f9d1331f658433411c58077871e1eef4ee1b4 (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Conflicts:
net/sunrpc/auth_gss/gss_krb5_crypto.c
net/sunrpc/auth_gss/gss_spkm3_token.c
net/sunrpc/clnt.c
Merge with mainline and fix conflicts.
Diffstat (limited to 'net/ipv6/inet6_hashtables.c')
-rw-r--r-- | net/ipv6/inet6_hashtables.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index b7e5bae0e347..30b16da739c2 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -79,7 +79,7 @@ struct sock *__inet6_lookup_established(struct inet_hashinfo *hashinfo, | |||
79 | goto hit; /* You sunk my battleship! */ | 79 | goto hit; /* You sunk my battleship! */ |
80 | } | 80 | } |
81 | /* Must check for a TIME_WAIT'er before going to listener hash. */ | 81 | /* Must check for a TIME_WAIT'er before going to listener hash. */ |
82 | sk_for_each(sk, node, &(head + hashinfo->ehash_size)->chain) { | 82 | sk_for_each(sk, node, &head->twchain) { |
83 | const struct inet_timewait_sock *tw = inet_twsk(sk); | 83 | const struct inet_timewait_sock *tw = inet_twsk(sk); |
84 | 84 | ||
85 | if(*((__portpair *)&(tw->tw_dport)) == ports && | 85 | if(*((__portpair *)&(tw->tw_dport)) == ports && |
@@ -115,7 +115,7 @@ struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, | |||
115 | sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { | 115 | sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { |
116 | if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) { | 116 | if (inet_sk(sk)->num == hnum && sk->sk_family == PF_INET6) { |
117 | const struct ipv6_pinfo *np = inet6_sk(sk); | 117 | const struct ipv6_pinfo *np = inet6_sk(sk); |
118 | 118 | ||
119 | score = 1; | 119 | score = 1; |
120 | if (!ipv6_addr_any(&np->rcv_saddr)) { | 120 | if (!ipv6_addr_any(&np->rcv_saddr)) { |
121 | if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) | 121 | if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) |
@@ -183,7 +183,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
183 | write_lock(&head->lock); | 183 | write_lock(&head->lock); |
184 | 184 | ||
185 | /* Check TIME-WAIT sockets first. */ | 185 | /* Check TIME-WAIT sockets first. */ |
186 | sk_for_each(sk2, node, &(head + hinfo->ehash_size)->chain) { | 186 | sk_for_each(sk2, node, &head->twchain) { |
187 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk2); | 187 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk2); |
188 | 188 | ||
189 | tw = inet_twsk(sk2); | 189 | tw = inet_twsk(sk2); |
@@ -249,81 +249,81 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row, | |||
249 | { | 249 | { |
250 | struct inet_hashinfo *hinfo = death_row->hashinfo; | 250 | struct inet_hashinfo *hinfo = death_row->hashinfo; |
251 | const unsigned short snum = inet_sk(sk)->num; | 251 | const unsigned short snum = inet_sk(sk)->num; |
252 | struct inet_bind_hashbucket *head; | 252 | struct inet_bind_hashbucket *head; |
253 | struct inet_bind_bucket *tb; | 253 | struct inet_bind_bucket *tb; |
254 | int ret; | 254 | int ret; |
255 | 255 | ||
256 | if (snum == 0) { | 256 | if (snum == 0) { |
257 | const int low = sysctl_local_port_range[0]; | 257 | const int low = sysctl_local_port_range[0]; |
258 | const int high = sysctl_local_port_range[1]; | 258 | const int high = sysctl_local_port_range[1]; |
259 | const int range = high - low; | 259 | const int range = high - low; |
260 | int i, port; | 260 | int i, port; |
261 | static u32 hint; | 261 | static u32 hint; |
262 | const u32 offset = hint + inet6_sk_port_offset(sk); | 262 | const u32 offset = hint + inet6_sk_port_offset(sk); |
263 | struct hlist_node *node; | 263 | struct hlist_node *node; |
264 | struct inet_timewait_sock *tw = NULL; | 264 | struct inet_timewait_sock *tw = NULL; |
265 | 265 | ||
266 | local_bh_disable(); | 266 | local_bh_disable(); |
267 | for (i = 1; i <= range; i++) { | 267 | for (i = 1; i <= range; i++) { |
268 | port = low + (i + offset) % range; | 268 | port = low + (i + offset) % range; |
269 | head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; | 269 | head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
270 | spin_lock(&head->lock); | 270 | spin_lock(&head->lock); |
271 | 271 | ||
272 | /* Does not bother with rcv_saddr checks, | 272 | /* Does not bother with rcv_saddr checks, |
273 | * because the established check is already | 273 | * because the established check is already |
274 | * unique enough. | 274 | * unique enough. |
275 | */ | 275 | */ |
276 | inet_bind_bucket_for_each(tb, node, &head->chain) { | 276 | inet_bind_bucket_for_each(tb, node, &head->chain) { |
277 | if (tb->port == port) { | 277 | if (tb->port == port) { |
278 | BUG_TRAP(!hlist_empty(&tb->owners)); | 278 | BUG_TRAP(!hlist_empty(&tb->owners)); |
279 | if (tb->fastreuse >= 0) | 279 | if (tb->fastreuse >= 0) |
280 | goto next_port; | 280 | goto next_port; |
281 | if (!__inet6_check_established(death_row, | 281 | if (!__inet6_check_established(death_row, |
282 | sk, port, | 282 | sk, port, |
283 | &tw)) | 283 | &tw)) |
284 | goto ok; | 284 | goto ok; |
285 | goto next_port; | 285 | goto next_port; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, | 289 | tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, |
290 | head, port); | 290 | head, port); |
291 | if (!tb) { | 291 | if (!tb) { |
292 | spin_unlock(&head->lock); | 292 | spin_unlock(&head->lock); |
293 | break; | 293 | break; |
294 | } | 294 | } |
295 | tb->fastreuse = -1; | 295 | tb->fastreuse = -1; |
296 | goto ok; | 296 | goto ok; |
297 | 297 | ||
298 | next_port: | 298 | next_port: |
299 | spin_unlock(&head->lock); | 299 | spin_unlock(&head->lock); |
300 | } | 300 | } |
301 | local_bh_enable(); | 301 | local_bh_enable(); |
302 | 302 | ||
303 | return -EADDRNOTAVAIL; | 303 | return -EADDRNOTAVAIL; |
304 | 304 | ||
305 | ok: | 305 | ok: |
306 | hint += i; | 306 | hint += i; |
307 | 307 | ||
308 | /* Head lock still held and bh's disabled */ | 308 | /* Head lock still held and bh's disabled */ |
309 | inet_bind_hash(sk, tb, port); | 309 | inet_bind_hash(sk, tb, port); |
310 | if (sk_unhashed(sk)) { | 310 | if (sk_unhashed(sk)) { |
311 | inet_sk(sk)->sport = htons(port); | 311 | inet_sk(sk)->sport = htons(port); |
312 | __inet6_hash(hinfo, sk); | 312 | __inet6_hash(hinfo, sk); |
313 | } | 313 | } |
314 | spin_unlock(&head->lock); | 314 | spin_unlock(&head->lock); |
315 | 315 | ||
316 | if (tw) { | 316 | if (tw) { |
317 | inet_twsk_deschedule(tw, death_row); | 317 | inet_twsk_deschedule(tw, death_row); |
318 | inet_twsk_put(tw); | 318 | inet_twsk_put(tw); |
319 | } | 319 | } |
320 | 320 | ||
321 | ret = 0; | 321 | ret = 0; |
322 | goto out; | 322 | goto out; |
323 | } | 323 | } |
324 | 324 | ||
325 | head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; | 325 | head = &hinfo->bhash[inet_bhashfn(snum, hinfo->bhash_size)]; |
326 | tb = inet_csk(sk)->icsk_bind_hash; | 326 | tb = inet_csk(sk)->icsk_bind_hash; |
327 | spin_lock_bh(&head->lock); | 327 | spin_lock_bh(&head->lock); |
328 | 328 | ||
329 | if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { | 329 | if (sk_head(&tb->owners) == sk && sk->sk_bind_node.next == NULL) { |