syslogd/tests: Improve loopback interface initialization

- In syslogd_start(), assign the lo0 address in the specified jail.
- Use the correct netmask.

Reviewed by:	jlduran
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D54799
This commit is contained in:
Mark Johnston
2026-01-22 15:51:42 +00:00
parent 560c22937b
commit 92d251472e
2 changed files with 5 additions and 7 deletions
-4
View File
@@ -380,10 +380,8 @@ allowed_peer_test_setup()
atf_check ifconfig ${epair}a vnet syslogd_allowed_peer
atf_check ifconfig ${epair}b vnet syslogd_client
atf_check jexec syslogd_allowed_peer ifconfig ${epair}a inet 169.254.0.1/16
atf_check jexec syslogd_allowed_peer ifconfig lo0 inet 127.0.0.1/8
atf_check jexec syslogd_client ifconfig ${epair}b inet 169.254.0.2/16
atf_check jexec syslogd_client ifconfig ${epair}b alias 169.254.0.3/16
atf_check jexec syslogd_client ifconfig lo0 inet 127.0.0.1/8
}
allowed_peer_test_cleanup()
@@ -529,12 +527,10 @@ forward_body()
atf_check ifconfig ${epair}a vnet syslogd_server
atf_check jexec syslogd_server ifconfig ${epair}a inet 169.254.0.1/16
atf_check jexec syslogd_server ifconfig ${epair}a alias 169.254.0.2/16
atf_check jexec syslogd_server ifconfig lo0 inet 127.0.0.1/8
syslogd_mkjail syslogd_client vnet
atf_check ifconfig ${epair}b vnet syslogd_client
atf_check jexec syslogd_client ifconfig ${epair}b inet 169.254.0.3/16
atf_check jexec syslogd_client ifconfig lo0 inet 127.0.0.1/8
cat <<__EOF__ > ./client_config
user.debug @169.254.0.1
@@ -23,9 +23,6 @@ syslogd_start()
local jail bind_arg conf_file pid_file socket privsocket
local opt next other_args
# Setup loopback so we can deliver messages to ourself.
atf_check ifconfig lo0 inet 127.0.0.1/16
OPTIND=1
while getopts ":b:f:j:P:p:S:" opt; do
case "${opt}" in
@@ -71,6 +68,11 @@ syslogd_start()
esac
done
# Setup loopback so we can deliver messages to ourself.
if [ $($jail sysctl -n security.jail.vnet) -ne 0 ]; then
atf_check $jail ifconfig lo0 inet 127.0.0.1/8
fi
$jail syslogd \
${bind_arg:--b :${SYSLOGD_UDP_PORT}} \
-C \