kern: net: remove TCP_LINGERTIME

TCP_LINGERTIME can be traced back to BSD 4.4 Lite and perhaps beyond, in
exactly the same form that it appears here modulo slightly different
context.  It used to be the case that there was a single pr_usrreq
method with requests dispatched to it; these exact two lines appeared in
tcp_usrreq's PRU_ATTACH handling.

The only purpose of this that I can find is to cause surprising behavior
on accepted connections. Newly-created sockets will never hit these
paths as one cannot set SO_LINGER prior to socket(2). If SO_LINGER is
set on a listening socket and inherited, one would expect the timeout to
be inherited rather than changed arbitrarily like this -- noting that
SO_LINGER is nonsense on a listening socket beyond inheritance, since
they cannot be 'connected' by definition.

Neither Illumos nor Linux reset the timer like this based on testing and
inspection of Illumos, and testing of Linux.

Reviewed by:	rscheff, tuexen
Differential Revision:	https://reviews.freebsd.org/D28265
This commit is contained in:
Kyle Evans 2021-01-20 22:02:04 -06:00
parent 812c9f48a2
commit 4c0bef07be
3 changed files with 0 additions and 6 deletions

View File

@ -115,8 +115,6 @@
#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */
#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
#define TCPTV_DELACK ( hz/25 ) /* 40ms timeout */

View File

@ -204,8 +204,6 @@ tcp_usr_attach(struct socket *so, int proto, struct thread *td)
tp->t_state = TCPS_CLOSED;
INP_WUNLOCK(inp);
TCPSTATES_INC(TCPS_CLOSED);
if ((so->so_options & SO_LINGER) && so->so_linger == 0)
so->so_linger = TCP_LINGERTIME;
out:
TCPDEBUG2(PRU_ATTACH);
TCP_PROBE2(debug__user, tp, PRU_ATTACH);

View File

@ -482,8 +482,6 @@ sdp_attach(struct socket *so, int proto, struct thread *td)
LIST_INSERT_HEAD(&sdp_list, ssk, list);
sdp_count++;
SDP_LIST_WUNLOCK();
if ((so->so_options & SO_LINGER) && so->so_linger == 0)
so->so_linger = TCP_LINGERTIME;
return (0);
}