p; /* Check TIME-WAIT sockets first. */ 24. sk_nulls_for_each(sk2, node, &head->twchain) { 25. tw = inet_twsk(sk2); 26. 27. 28. if (INET_TW_MATCH(sk2, net, hash, acookie, 29. saddr, daddr, ports, dif)) { 30. if (twsk_unique(sk, sk2, twp)) 31. goto unique; 32. else 33. goto not_unique; 34. } 35. } 36. tw = NULL; 37. 38. /* And established part... */ 39. sk_nulls_for_each(sk2, node, &head->chain) { 40. if (INET_MATCH(sk2, net, hash, acookie, 41. saddr, daddr, ports, dif)) 42. goto not_unique; 43. } 44. 45.unique: 46. ...... 47. return 0; 48. 49.not_unique: 50. spin_unlock(lock); 51. return -EADDRNOTAVAIL; 52.} /* called with local bh disabled */ static int __inet_check_established(struct inet_timewait_death_row *death_row, struct sock *sk, __u16 lport, struct inet_timewait_sock **twp) { struct inet_hashinfo *hinfo = death_row->hashinfo; struct inet_sock *inet = inet_sk(sk); __be32 daddr = inet->rcv_saddr; __be32 saddr = inet->daddr; int dif = sk->sk_bound_dev_if; INET_ADDR_COOKIE(acookie, saddr, daddr) const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); struct net *net = sock_net(sk); unsigned int hash = inet_ehashfn(net, daddr, lport, saddr, inet->dport); struct inet_ehash_bucket *head = inet_ehash_bucket(hinfo, has << 上一页 [11] [12] [13] [14] [15] 下一页
|