Date: Tue, 21 Apr 2026 16:13:44 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 69e8d8b49d4b - main - tests/sys/netinet/tcp_hpts: Make a socket available in mock inpcbs Message-ID: <69e7a238.39e04.4dc2f3d2@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=69e8d8b49d4bd889a42ba354f290f05d88bcd4b1 commit 69e8d8b49d4bd889a42ba354f290f05d88bcd4b1 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2026-04-21 14:31:18 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-04-21 16:13:19 +0000 tests/sys/netinet/tcp_hpts: Make a socket available in mock inpcbs After commit 9b76228006d8, tcp_hptsi() dereferences inp_socket in order to get the inpcb's VNET. This means that mock inpcbs created by the HPTS test fixture must set inp_socket. Also set the current VNET there; previously, it was NULL, and this was not noticed since VNET_DEBUG is disabled even in debug kernels. Fixes: 9b76228006d8 ("inpcb: retire inp_vnet") --- sys/netinet/tcp_hpts_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netinet/tcp_hpts_test.c b/sys/netinet/tcp_hpts_test.c index ea088f5c71cf..a664e9fafcc3 100644 --- a/sys/netinet/tcp_hpts_test.c +++ b/sys/netinet/tcp_hpts_test.c @@ -35,6 +35,7 @@ #include <sys/mutex.h> #include <sys/refcount.h> #include <sys/socket.h> +#include <sys/socketvar.h> #include <sys/sysctl.h> #include <sys/systm.h> @@ -369,9 +370,15 @@ static struct tcpcb * test_hpts_create_tcpcb(struct ktest_test_context *ctx, struct tcp_hptsi *pace) { struct tcpcb *tp; + struct socket *so; tp = malloc(sizeof(struct tcpcb), M_TCPHPTS, M_WAITOK | M_ZERO); if (tp) { + so = malloc(sizeof(struct socket), M_TCPHPTS, + M_WAITOK | M_ZERO); + so->so_vnet = curvnet; + tp->t_inpcb.inp_socket = so; + rw_init_flags(&tp->t_inpcb.inp_lock, "test-inp", RW_RECURSE | RW_DUPOK); refcount_init(&tp->t_inpcb.inp_refcount, 1); @@ -399,6 +406,7 @@ test_hpts_free_tcpcb(struct tcpcb *tp) return; INP_LOCK_DESTROY(&tp->t_inpcb); + free(tp->t_inpcb.inp_socket, M_TCPHPTS); free(tp, M_TCPHPTS); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e7a238.39e04.4dc2f3d2>
