Date: Thu, 28 May 2026 10:45:01 +0000 From: Olivier Cochard <olivier@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: ff873565bc2c - main - ping: fix test timestamp_origin when tstamprepl is disabled Message-ID: <6a181cad.3ae9b.32d308de@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by olivier: URL: https://cgit.FreeBSD.org/src/commit/?id=ff873565bc2c3e47fe1d070305aa851189ee8bcf commit ff873565bc2c3e47fe1d070305aa851189ee8bcf Author: Olivier Cochard <olivier@FreeBSD.org> AuthorDate: 2026-05-28 10:40:48 +0000 Commit: Olivier Cochard <olivier@FreeBSD.org> CommitDate: 2026-05-28 10:40:48 +0000 ping: fix test timestamp_origin when tstamprepl is disabled The timestamp_origin test sends an ICMP Timestamp Request (ping -Mt) and parses the tso/tsr fields out of the reply. When the sysctl net.inet.icmp.tstamprepl is 0, the kernel silently drops the request, ping receives no reply, and the sed extraction yields an empty $tso. The test then fails inside atf_check test -n "$tso" with the unhelpful message Approved by: maxim Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D57287 --- sbin/ping/tests/ping_test.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sbin/ping/tests/ping_test.sh b/sbin/ping/tests/ping_test.sh index af700615dc8d..ab45ad809a52 100644 --- a/sbin/ping/tests/ping_test.sh +++ b/sbin/ping/tests/ping_test.sh @@ -253,14 +253,22 @@ inject_reply_cleanup() ifconfig `cat tun.txt` destroy } -atf_test_case timestamp_origin +atf_test_case timestamp_origin cleanup timestamp_origin_head() { atf_set "descr" "ICMP Originate Timestamp" + atf_set "require.user" "root" + atf_set "require.config" "allow_sysctl_side_effects" } timestamp_origin_body() { require_ipv4 + # The kernel only replies to ICMP timestamp requests when + # net.inet.icmp.tstamprepl is enabled. Save the current value + # so the cleanup hook can restore it, then enable replies. + sysctl -n net.inet.icmp.tstamprepl > tstamprepl.txt + sysctl net.inet.icmp.tstamprepl=1 + # Run ping timestamp out=$(ping -Mt -c1 127.0.0.1) @@ -286,6 +294,12 @@ timestamp_origin_body() atf_fail "tso ($tso) differs from tsr ($tsr) by $diff seconds" fi } +timestamp_origin_cleanup() +{ + if [ -f tstamprepl.txt ]; then + sysctl net.inet.icmp.tstamprepl=`cat tstamprepl.txt` + fi +} atf_init_test_cases() {home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a181cad.3ae9b.32d308de>
