aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2026-04-14 18:07:51 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2026-04-14 18:07:51 +0000
commit4fadf2466468dd6dcb6cf9e3739ed696a18c1bb4 (patch)
tree6aec0bf549909df97b8d731535471e79f57f7b52
parent6dd86310e54d3f2dd9f688670913b9176176246c (diff)
tcp_close: Use in6_pcbdisconnect for INET6 sockets
This also fixes the LINT-NOINET builds. Fixes: 40dbb06fa73c ("inpcb: retire INP_DROPPED and in_pcbdrop()")
-rw-r--r--sys/netinet/tcp_subr.c9
1 files changed, 9 insertions, 0 deletions
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);