aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2021-01-21 04:02:04 +0000
committerKyle Evans <kevans@FreeBSD.org>2021-02-19 04:36:01 +0000
commit4c0bef07be071a1633ebc86a653f9bd59d40796e (patch)
tree8f810c697d522b44a506a2f9413208460e1bc17b
parent812c9f48a2b7bccc31b2a6077b299822357832e4 (diff)
downloadsrc-4c0bef07be071a1633ebc86a653f9bd59d40796e.tar.gz
src-4c0bef07be071a1633ebc86a653f9bd59d40796e.zip
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
-rw-r--r--sys/netinet/tcp_timer.h2
-rw-r--r--sys/netinet/tcp_usrreq.c2
-rw-r--r--sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c2
3 files changed, 0 insertions, 6 deletions
diff --git a/sys/netinet/tcp_timer.h b/sys/netinet/tcp_timer.h
index 6f0c3a46605a..9a711d173386 100644
--- a/sys/netinet/tcp_timer.h
+++ b/sys/netinet/tcp_timer.h
@@ -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 */
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index bfa96ce093b5..31b580bfafcc 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -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);
diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
index 46a43e1b8e3b..e7ae4e03365e 100644
--- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
+++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
@@ -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);
}