git: 4c0bef07be07 - main - kern: net: remove TCP_LINGERTIME

Kyle Evans kevans at FreeBSD.org
Fri Feb 19 04:37:23 UTC 2021


The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=4c0bef07be071a1633ebc86a653f9bd59d40796e

commit 4c0bef07be071a1633ebc86a653f9bd59d40796e
Author:     Kyle Evans <kevans at FreeBSD.org>
AuthorDate: 2021-01-21 04:02:04 +0000
Commit:     Kyle Evans <kevans at FreeBSD.org>
CommitDate: 2021-02-19 04:36:01 +0000

    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
---
 sys/netinet/tcp_timer.h                        | 2 --
 sys/netinet/tcp_usrreq.c                       | 2 --
 sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c | 2 --
 3 files changed, 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);
 }


More information about the dev-commits-src-all mailing list