From nobody Wed Jul 16 12:47:27 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bhwnD25R7z62TYK; Wed, 16 Jul 2025 12:47:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bhwnC4YR9z481W; Wed, 16 Jul 2025 12:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752670047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7dweWn1Q+pprZ0AySDbZya5as9g1V0C6V5ZC31eO4Go=; b=ZAOuOwdwdWpn1nRuCqouSspbgW39h8L5EpeHbh/7Gj3A1l69zjxmq51sYlM46ViOG36ygO uGwciBmrlADR+QNbyf+w0sdXBofpXZDOhQvg6MjTUPXsZO+1mHPSZeoZm6UMsDgfstk7Qd +48K3JoNXrchndEV2wTVQyam2jgNJ/qKQmchhxODqPoYufWZNwx56e5q026T+EBoCdXlSR HMfNikcQ2sJeupZlHFl/lSOjah3Ccs7iwGDXSecm+LnN+3XeMgrzsXE5Vmn3KJNrywBPog 9AgjzNCOkQt+kxXSdKMxtSK4CqKAmHsokT8RzcX4JX0Wp3i5mYmCJYKbJE+/+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752670047; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7dweWn1Q+pprZ0AySDbZya5as9g1V0C6V5ZC31eO4Go=; b=MrXAxkHz7xaQR5R9y5HUB1M0af7FH0tB6mNhbYay3WLxXzknPyx9KazDoUVPmx3YEeOv+l jXhGQnay/v9xXGiq5Nr0O0HmZ5vHggJkIarmQINCh1V3LyMKGgb280Uk6wjiLZy0bItYVS ROloGLm5X0HVAwCdIW/NuZJQ/b0hS3WpLC8UXsAOOhu1ktVEdTSgg+RFQYVkVfd+DQyFkf eOtZ0pbTSy3nCnlk/lPAXeDpBiBW/miwn8HPk4bHbSW/AedxQteeevovQ+hnZTlA8OyRoN TEM9N1cFT8lh/vaOiAKJyrz/xsPO5OrogEhA+p7eFcon3/FKmy4rXJpfG2R8/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752670047; a=rsa-sha256; cv=none; b=c0yPLN83zh5vZH+LMomfMrn6TVg6zGB7LxsO1+AlvpT8+j8AKBFoTm/Sw7EF/UG3vgGmxa 86SFDfZp14wNhUNPkyzhpV7vX4mIQvd06cmTqUiAGXKppqflMbRN1uNn7ItnWW8wXeewDp KsQEAUq/IzqifTHMKgVKmHqnvmoIz78YfsHUElRYKt8bxe9D2Rhgmr3ZPEo+606TIyJHJ1 dIn+JIYyaC6YrwHwjUnCtrVE1prX2/W0bi0rxQmvADClqhzP1sCHTB0w9ZzL7YQHaOItjt AKGGJTqiAwMWqJex5C+KTxnUkLLPtaAeTQmrx4vjQMfjIVF1VuvWKjAfC9Rs3A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bhwnC48scz1NZk; Wed, 16 Jul 2025 12:47:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56GClRtC042129; Wed, 16 Jul 2025 12:47:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56GClRaF042126; Wed, 16 Jul 2025 12:47:27 GMT (envelope-from git) Date: Wed, 16 Jul 2025 12:47:27 GMT Message-Id: <202507161247.56GClRaF042126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b2d979b1ea6c - stable/14 - pf tests: sync a state with an rtableid that doesn't exist List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: b2d979b1ea6c43861e195852d7a7f1ace51cf10d Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b2d979b1ea6c43861e195852d7a7f1ace51cf10d commit b2d979b1ea6c43861e195852d7a7f1ace51cf10d Author: Kristof Provost AuthorDate: 2025-07-08 15:14:16 +0000 Commit: Kristof Provost CommitDate: 2025-07-16 08:08:02 +0000 pf tests: sync a state with an rtableid that doesn't exist Create a state with an rtableid (i.e. fib) that doesn't exist on the receiving side. This used to not be handled, and could provoke panics. Create such a situation to ensure we still don't panic. PR: 287981 MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit f651e87be28dd6c3f466dc865b1a036089b892ff) --- tests/sys/netpfil/pf/pfsync.sh | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index 441221f39d27..01d76e23889c 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -826,6 +826,90 @@ basic_ipv6_cleanup() pfsynct_cleanup } +atf_test_case "rtable" "cleanup" +rtable_head() +{ + atf_set descr 'Test handling of invalid rtableid' + atf_set require.user root +} + +rtable_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1 \ + up + jexec two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + maxupd 1 \ + up + + # Make life easy, give ${epair_two}a the same mac addrss as ${epair_one}a + mac=$(jexec one ifconfig ${epair_one}a | awk '/ether/ { print($2); }') + jexec two ifconfig ${epair_two}a ether ${mac} + + # Enable pf! + jexec one /sbin/sysctl net.fibs=8 + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass rtable 3 keep state" + # No extra fibs in two + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + ifconfig ${epair_two}b 198.51.100.253/24 up + + # Create a new state + env PYTHONPATH=${common_dir} \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_one}b \ + --fromaddr 198.51.100.254 \ + --to 198.51.100.1 \ + --recvif ${epair_one}b + + # Now + jexec one pfctl -ss -vv + sleep 2 + + # Now try to use that state on jail two + env PYTHONPATH=${common_dir} \ + ${common_dir}/pft_ping.py \ + --sendif ${epair_two}b \ + --fromaddr 198.51.100.254 \ + --to 198.51.100.1 \ + --recvif ${epair_two}b + + echo one + jexec one pfctl -ss -vv + jexec one pfctl -sr -vv + echo two + jexec two pfctl -ss -vv + jexec two pfctl -sr -vv +} + +rtable_cleanup() +{ + pfsynct_cleanup +} + atf_test_case "route_to" "cleanup" route_to_head() { @@ -933,5 +1017,6 @@ atf_init_test_cases() atf_add_test_case "timeout" atf_add_test_case "basic_ipv6_unicast" atf_add_test_case "basic_ipv6" + atf_add_test_case "rtable" atf_add_test_case "route_to" }