Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Apr 2021 13:08:48 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5a5623397c73 - main - pf tests: make synproxy and nat work correctly even if inetd is running
Message-ID:  <202104071308.137D8mK1022371@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

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

commit 5a5623397c73e46b206289d32d1d6b9de420da9c
Author:     Kurosawa Takahiro <takahiro.kurosawa@gmail.com>
AuthorDate: 2021-04-07 06:17:51 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-04-07 11:05:23 +0000

    pf tests: make synproxy and nat work correctly even if inetd is running
    
    tests/sys/netfil/pf/synproxy fails if inetd has been running
    outside of the jail because pidfile_open() fails with EEXIST.
    tests/sys/netfil/pf/nat has the same problem but the test succeeds
    because whether inetd is running is not so important.
    
    Fix the problem by changing the pidfile path from the default
    location.
    
    Reviewed by:    kp
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D29622
---
 tests/sys/netpfil/pf/nat.sh      | 3 ++-
 tests/sys/netpfil/pf/synproxy.sh | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/sys/netpfil/pf/nat.sh b/tests/sys/netpfil/pf/nat.sh
index 499c137eee9c..3fabb32db80f 100644
--- a/tests/sys/netpfil/pf/nat.sh
+++ b/tests/sys/netpfil/pf/nat.sh
@@ -52,7 +52,7 @@ exhaust_body()
 	jexec nat sysctl net.inet.ip.forwarding=1
 
 	jexec echo ifconfig ${epair_echo}b 198.51.100.2/24 up
-	jexec echo /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf
+	jexec echo /usr/sbin/inetd -p inetd-echo.pid $(atf_get_srcdir)/echo_inetd.conf
 
 	# Enable pf!
 	jexec nat pfctl -e
@@ -80,6 +80,7 @@ exhaust_body()
 
 exhaust_cleanup()
 {
+	rm -f inetd-echo.pid
 	pft_cleanup
 }
 
diff --git a/tests/sys/netpfil/pf/synproxy.sh b/tests/sys/netpfil/pf/synproxy.sh
index f4d6df46fa78..aedbb8885129 100644
--- a/tests/sys/netpfil/pf/synproxy.sh
+++ b/tests/sys/netpfil/pf/synproxy.sh
@@ -53,7 +53,7 @@ synproxy_body()
 	jexec singsing ifconfig ${link}b 198.51.100.2/24 up
 	jexec singsing route add default 198.51.100.1
 
-	jexec singsing /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf
+	jexec singsing /usr/sbin/inetd -p inetd-singsing.pid $(atf_get_srcdir)/echo_inetd.conf
 
 	jexec alcatraz pfctl -e
 	pft_set_rules alcatraz "set fail-policy return" \
@@ -75,6 +75,7 @@ synproxy_body()
 
 synproxy_cleanup()
 {
+	rm -f inetd-singsing.pid
 	pft_cleanup
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104071308.137D8mK1022371>