diff options
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 649a36d99c73..a2bcac9b388e 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
| @@ -1833,6 +1833,19 @@ static int tcp_v4_init_sock(struct sock *sk) | |||
| 1833 | tp->af_specific = &tcp_sock_ipv4_specific; | 1833 | tp->af_specific = &tcp_sock_ipv4_specific; |
| 1834 | #endif | 1834 | #endif |
| 1835 | 1835 | ||
| 1836 | /* TCP Cookie Transactions */ | ||
| 1837 | if (sysctl_tcp_cookie_size > 0) { | ||
| 1838 | /* Default, cookies without s_data_payload. */ | ||
| 1839 | tp->cookie_values = | ||
| 1840 | kzalloc(sizeof(*tp->cookie_values), | ||
| 1841 | sk->sk_allocation); | ||
| 1842 | if (tp->cookie_values != NULL) | ||
| 1843 | kref_init(&tp->cookie_values->kref); | ||
| 1844 | } | ||
| 1845 | /* Presumed zeroed, in order of appearance: | ||
| 1846 | * cookie_in_always, cookie_out_never, | ||
| 1847 | * s_data_constant, s_data_in, s_data_out | ||
| 1848 | */ | ||
| 1836 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; | 1849 | sk->sk_sndbuf = sysctl_tcp_wmem[1]; |
| 1837 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; | 1850 | sk->sk_rcvbuf = sysctl_tcp_rmem[1]; |
| 1838 | 1851 | ||
| @@ -1886,6 +1899,13 @@ void tcp_v4_destroy_sock(struct sock *sk) | |||
| 1886 | sk->sk_sndmsg_page = NULL; | 1899 | sk->sk_sndmsg_page = NULL; |
| 1887 | } | 1900 | } |
| 1888 | 1901 | ||
| 1902 | /* TCP Cookie Transactions */ | ||
| 1903 | if (tp->cookie_values != NULL) { | ||
| 1904 | kref_put(&tp->cookie_values->kref, | ||
| 1905 | tcp_cookie_values_release); | ||
| 1906 | tp->cookie_values = NULL; | ||
| 1907 | } | ||
| 1908 | |||
| 1889 | percpu_counter_dec(&tcp_sockets_allocated); | 1909 | percpu_counter_dec(&tcp_sockets_allocated); |
| 1890 | } | 1910 | } |
| 1891 | 1911 | ||
