git: 4fadf2466468 - main - tcp_close: Use in6_pcbdisconnect for INET6 sockets

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 14 Apr 2026 18:37:18 UTC
The branch main has been updated by jhb:

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

commit 4fadf2466468dd6dcb6cf9e3739ed696a18c1bb4
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-04-14 18:07:51 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-04-14 18:07:51 +0000

    tcp_close: Use in6_pcbdisconnect for INET6 sockets
    
    This also fixes the LINT-NOINET builds.
    
    Fixes:          40dbb06fa73c ("inpcb: retire INP_DROPPED and in_pcbdrop()")
---
 sys/netinet/tcp_subr.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 443af020848f..4adc8d859f3e 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -2551,7 +2551,16 @@ tcp_close(struct tcpcb *tp)
 	tcp_timer_stop(tp);
 	if (tp->t_fb->tfb_tcp_timer_stop_all != NULL)
 		tp->t_fb->tfb_tcp_timer_stop_all(tp);
+#if defined(INET) && defined(INET6)
+	if ((inp->inp_vflag & INP_IPV6) != 0)
+		in6_pcbdisconnect(inp);
+	else
+		in_pcbdisconnect(inp);
+#elif defined(INET6)
+	in6_pcbdisconnect(inp);
+#else
 	in_pcbdisconnect(inp);
+#endif
 	TCPSTAT_INC(tcps_closed);
 	if (tp->t_state != TCPS_CLOSED)
 		tcp_state_change(tp, TCPS_CLOSED);