git: e7381521aa75 - main - tcp: remove unused code in tcp_usr_attach

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Thu, 30 May 2024 19:41:12 UTC
The branch main has been updated by tuexen:

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

commit e7381521aa755682f42e7b2d1a435ce7768aa708
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2024-05-30 19:23:45 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2024-05-30 19:23:45 +0000

    tcp: remove unused code in tcp_usr_attach
    
    pr_attach is only called on a socket (so) with so->so_listen != NULL
    via sonewconn. However, sonewconn is not called from the TCP code.
    The listening sockets are handled in tcp_syncache.c without using
    sonewconn. Therefore, the code removed is never executed.
    No functional change intended.
    
    Reviewed by:            rrs, peter.lei_ieee.org
    MFC after:              1 week
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D45412
---
 sys/netinet/tcp_usrreq.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 9e0a702a6c0f..f768f42114d4 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -179,12 +179,6 @@ tcp_usr_attach(struct socket *so, int proto, struct thread *td)
 		goto out;
 	}
 	tp->t_state = TCPS_CLOSED;
-	/* Can we inherit anything from the listener? */
-	if ((so->so_listen != NULL) &&
-	    (so->so_listen->so_pcb != NULL) &&
-	    (tp->t_fb->tfb_inherit != NULL)) {
-		(*tp->t_fb->tfb_inherit)(tp, sotoinpcb(so->so_listen));
-	}
 	tcp_bblog_pru(tp, PRU_ATTACH, error);
 	INP_WUNLOCK(inp);
 	TCPSTATES_INC(TCPS_CLOSED);