tcp_minisocks.c (a108772d03d8bdb43258218b00bfe43bbe1e8800) tcp_minisocks.c (08eaef90403110e51861d93e8008a355af467bbe)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Implementation of the Transmission Control Protocol(TCP).
8 *

--- 233 unchanged lines hidden (view full) ---

242
243/*
244 * Move a socket to time-wait or dead fin-wait-2 state.
245 */
246void tcp_time_wait(struct sock *sk, int state, int timeo)
247{
248 const struct inet_connection_sock *icsk = inet_csk(sk);
249 const struct tcp_sock *tp = tcp_sk(sk);
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Implementation of the Transmission Control Protocol(TCP).
8 *

--- 233 unchanged lines hidden (view full) ---

242
243/*
244 * Move a socket to time-wait or dead fin-wait-2 state.
245 */
246void tcp_time_wait(struct sock *sk, int state, int timeo)
247{
248 const struct inet_connection_sock *icsk = inet_csk(sk);
249 const struct tcp_sock *tp = tcp_sk(sk);
250 struct net *net = sock_net(sk);
250 struct inet_timewait_sock *tw;
251 struct inet_timewait_sock *tw;
251 struct inet_timewait_death_row *tcp_death_row = sock_net(sk)->ipv4.tcp_death_row;
252
252
253 tw = inet_twsk_alloc(sk, tcp_death_row, state);
253 tw = inet_twsk_alloc(sk, net->ipv4.tcp_death_row, state);
254
255 if (tw) {
256 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
257 const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1);
258 struct inet_sock *inet = inet_sk(sk);
259
260 tw->tw_transparent = inet->transparent;
261 tw->tw_mark = sk->sk_mark;

--- 59 unchanged lines hidden (view full) ---

321 */
322 inet_twsk_hashdance(tw, sk, &tcp_hashinfo);
323 local_bh_enable();
324 } else {
325 /* Sorry, if we're out of memory, just CLOSE this
326 * socket up. We've got bigger problems than
327 * non-graceful socket closings.
328 */
254
255 if (tw) {
256 struct tcp_timewait_sock *tcptw = tcp_twsk((struct sock *)tw);
257 const int rto = (icsk->icsk_rto << 2) - (icsk->icsk_rto >> 1);
258 struct inet_sock *inet = inet_sk(sk);
259
260 tw->tw_transparent = inet->transparent;
261 tw->tw_mark = sk->sk_mark;

--- 59 unchanged lines hidden (view full) ---

321 */
322 inet_twsk_hashdance(tw, sk, &tcp_hashinfo);
323 local_bh_enable();
324 } else {
325 /* Sorry, if we're out of memory, just CLOSE this
326 * socket up. We've got bigger problems than
327 * non-graceful socket closings.
328 */
329 NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPTIMEWAITOVERFLOW);
329 NET_INC_STATS(net, LINUX_MIB_TCPTIMEWAITOVERFLOW);
330 }
331
332 tcp_update_metrics(sk);
333 tcp_done(sk);
334}
335EXPORT_SYMBOL(tcp_time_wait);
336
337void tcp_twsk_destructor(struct sock *sk)

--- 515 unchanged lines hidden ---
330 }
331
332 tcp_update_metrics(sk);
333 tcp_done(sk);
334}
335EXPORT_SYMBOL(tcp_time_wait);
336
337void tcp_twsk_destructor(struct sock *sk)

--- 515 unchanged lines hidden ---