diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 77c1939a2b0d..63414ea427c5 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -108,22 +108,6 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { | |||
108 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), | 108 | .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static int tcp_v4_get_port(struct sock *sk, unsigned short snum) | ||
112 | { | ||
113 | return inet_csk_get_port(&tcp_hashinfo, sk, snum, | ||
114 | inet_csk_bind_conflict); | ||
115 | } | ||
116 | |||
117 | static void tcp_v4_hash(struct sock *sk) | ||
118 | { | ||
119 | inet_hash(&tcp_hashinfo, sk); | ||
120 | } | ||
121 | |||
122 | void tcp_unhash(struct sock *sk) | ||
123 | { | ||
124 | inet_unhash(&tcp_hashinfo, sk); | ||
125 | } | ||
126 | |||
127 | static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) | 111 | static inline __u32 tcp_v4_init_sequence(struct sk_buff *skb) |
128 | { | 112 | { |
129 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, | 113 | return secure_tcp_sequence_number(ip_hdr(skb)->daddr, |
@@ -1478,8 +1462,8 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1478 | } | 1462 | } |
1479 | #endif | 1463 | #endif |
1480 | 1464 | ||
1481 | __inet_hash_nolisten(&tcp_hashinfo, newsk); | 1465 | __inet_hash_nolisten(newsk); |
1482 | __inet_inherit_port(&tcp_hashinfo, sk, newsk); | 1466 | __inet_inherit_port(sk, newsk); |
1483 | 1467 | ||
1484 | return newsk; | 1468 | return newsk; |
1485 | 1469 | ||
@@ -1827,6 +1811,7 @@ struct inet_connection_sock_af_ops ipv4_specific = { | |||
1827 | .getsockopt = ip_getsockopt, | 1811 | .getsockopt = ip_getsockopt, |
1828 | .addr2sockaddr = inet_csk_addr2sockaddr, | 1812 | .addr2sockaddr = inet_csk_addr2sockaddr, |
1829 | .sockaddr_len = sizeof(struct sockaddr_in), | 1813 | .sockaddr_len = sizeof(struct sockaddr_in), |
1814 | .bind_conflict = inet_csk_bind_conflict, | ||
1830 | #ifdef CONFIG_COMPAT | 1815 | #ifdef CONFIG_COMPAT |
1831 | .compat_setsockopt = compat_ip_setsockopt, | 1816 | .compat_setsockopt = compat_ip_setsockopt, |
1832 | .compat_getsockopt = compat_ip_getsockopt, | 1817 | .compat_getsockopt = compat_ip_getsockopt, |
@@ -1926,7 +1911,7 @@ int tcp_v4_destroy_sock(struct sock *sk) | |||
1926 | 1911 | ||
1927 | /* Clean up a referenced TCP bind bucket. */ | 1912 | /* Clean up a referenced TCP bind bucket. */ |
1928 | if (inet_csk(sk)->icsk_bind_hash) | 1913 | if (inet_csk(sk)->icsk_bind_hash) |
1929 | inet_put_port(&tcp_hashinfo, sk); | 1914 | inet_put_port(sk); |
1930 | 1915 | ||
1931 | /* | 1916 | /* |
1932 | * If sendmsg cached page exists, toss it. | 1917 | * If sendmsg cached page exists, toss it. |
@@ -2435,9 +2420,9 @@ struct proto tcp_prot = { | |||
2435 | .getsockopt = tcp_getsockopt, | 2420 | .getsockopt = tcp_getsockopt, |
2436 | .recvmsg = tcp_recvmsg, | 2421 | .recvmsg = tcp_recvmsg, |
2437 | .backlog_rcv = tcp_v4_do_rcv, | 2422 | .backlog_rcv = tcp_v4_do_rcv, |
2438 | .hash = tcp_v4_hash, | 2423 | .hash = inet_hash, |
2439 | .unhash = tcp_unhash, | 2424 | .unhash = inet_unhash, |
2440 | .get_port = tcp_v4_get_port, | 2425 | .get_port = inet_csk_get_port, |
2441 | .enter_memory_pressure = tcp_enter_memory_pressure, | 2426 | .enter_memory_pressure = tcp_enter_memory_pressure, |
2442 | .sockets_allocated = &tcp_sockets_allocated, | 2427 | .sockets_allocated = &tcp_sockets_allocated, |
2443 | .orphan_count = &tcp_orphan_count, | 2428 | .orphan_count = &tcp_orphan_count, |
@@ -2450,6 +2435,7 @@ struct proto tcp_prot = { | |||
2450 | .obj_size = sizeof(struct tcp_sock), | 2435 | .obj_size = sizeof(struct tcp_sock), |
2451 | .twsk_prot = &tcp_timewait_sock_ops, | 2436 | .twsk_prot = &tcp_timewait_sock_ops, |
2452 | .rsk_prot = &tcp_request_sock_ops, | 2437 | .rsk_prot = &tcp_request_sock_ops, |
2438 | .hashinfo = &tcp_hashinfo, | ||
2453 | #ifdef CONFIG_COMPAT | 2439 | #ifdef CONFIG_COMPAT |
2454 | .compat_setsockopt = compat_tcp_setsockopt, | 2440 | .compat_setsockopt = compat_tcp_setsockopt, |
2455 | .compat_getsockopt = compat_tcp_getsockopt, | 2441 | .compat_getsockopt = compat_tcp_getsockopt, |
@@ -2467,7 +2453,6 @@ void __init tcp_v4_init(struct net_proto_family *ops) | |||
2467 | EXPORT_SYMBOL(ipv4_specific); | 2453 | EXPORT_SYMBOL(ipv4_specific); |
2468 | EXPORT_SYMBOL(tcp_hashinfo); | 2454 | EXPORT_SYMBOL(tcp_hashinfo); |
2469 | EXPORT_SYMBOL(tcp_prot); | 2455 | EXPORT_SYMBOL(tcp_prot); |
2470 | EXPORT_SYMBOL(tcp_unhash); | ||
2471 | EXPORT_SYMBOL(tcp_v4_conn_request); | 2456 | EXPORT_SYMBOL(tcp_v4_conn_request); |
2472 | EXPORT_SYMBOL(tcp_v4_connect); | 2457 | EXPORT_SYMBOL(tcp_v4_connect); |
2473 | EXPORT_SYMBOL(tcp_v4_do_rcv); | 2458 | EXPORT_SYMBOL(tcp_v4_do_rcv); |