git: c17a0f62da17 - main - pf tests: use unique pid files for inetd processes

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Wed, 02 Oct 2024 12:20:58 UTC
The branch main has been updated by kp:

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

commit c17a0f62da173df5e4a5433dfb90ef9f8dab98d4
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-10-02 09:59:23 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-10-02 10:03:19 +0000

    pf tests: use unique pid files for inetd processes
    
    Ensure that we don't conflict with other inetd processes running in other jails
    by setting an explicit pid file (rather than relying on the default /var/run/
    inetd.pid). This could lead to failure to start inetd, which in turn could cause
    test failures.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/ether.sh   | 4 ++--
 tests/sys/netpfil/pf/utils.subr | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/sys/netpfil/pf/ether.sh b/tests/sys/netpfil/pf/ether.sh
index 0369e0e57ee6..104baf468aa4 100644
--- a/tests/sys/netpfil/pf/ether.sh
+++ b/tests/sys/netpfil/pf/ether.sh
@@ -286,7 +286,7 @@ captive_body()
 
 	# Run the echo server only on the gw, so we know we've redirectly
 	# correctly if we get an echo message.
-	jexec gw /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf
+	jexec gw /usr/sbin/inetd -p ${PWD}/echo_inetd.pid $(atf_get_srcdir)/echo_inetd.conf
 
 	# Confirm that we're getting redirected
 	atf_check -s exit:0 -o match:"^foo$" -x "echo foo | nc -N 198.51.100.2 7"
@@ -304,7 +304,7 @@ captive_body()
 	atf_check -s exit:1 -x "echo foo | nc -N 198.51.100.2 7"
 
 	# Start a server in srv
-	jexec srv /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf
+	jexec srv /usr/sbin/inetd -p ${PWD}/echo_inetd.pid $(atf_get_srcdir)/echo_inetd.conf
 
 	# And now we can talk to that one.
 	atf_check -s exit:0 -o match:"^foo$" -x "echo foo | nc -N 198.51.100.2 7"
diff --git a/tests/sys/netpfil/pf/utils.subr b/tests/sys/netpfil/pf/utils.subr
index 0b7ee621e6fa..c854ad5e69d8 100644
--- a/tests/sys/netpfil/pf/utils.subr
+++ b/tests/sys/netpfil/pf/utils.subr
@@ -217,7 +217,7 @@ setup_router_server_ipv4()
 	jexec server route add -net ${net_tester} ${net_server_host_router}
 	inetd_conf=$(mktemp)
 	echo "discard stream tcp nowait root internal" > $inetd_conf
-	jexec server inetd $inetd_conf
+	jexec server inetd -p ${PWD}/inetd.pid $inetd_conf
 }
 
 # Create a bare router jail.
@@ -271,7 +271,7 @@ setup_router_server_ipv6()
 	jexec server route add -6 ${net_tester} ${net_server_host_router}
 	inetd_conf=$(mktemp)
 	echo "discard stream tcp6 nowait root internal" > $inetd_conf
-	jexec server inetd $inetd_conf
+	jexec server inetd -p ${PWD}/inetd.pid $inetd_conf
 }
 
 # Ping the dummy static NDP target.