From nobody Wed Dec 01 17:10:05 2021 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 56E6918CB494; Wed, 1 Dec 2021 17:10:07 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J45Dt2MKvz4dS6; Wed, 1 Dec 2021 17:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0E80F5B0C; Wed, 1 Dec 2021 17:10:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B1HA54Y016297; Wed, 1 Dec 2021 17:10:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B1HA5a0016295; Wed, 1 Dec 2021 17:10:05 GMT (envelope-from git) Date: Wed, 1 Dec 2021 17:10:05 GMT Message-Id: <202112011710.1B1HA5a0016295@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: a40b76511844 - stable/13 - net tests: basic if_stf test 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: 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/13 X-Git-Reftype: branch X-Git-Commit: a40b7651184478c18508cb676706465bacf1b773 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638378606; 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=2jkJIR5h7HGnDL/O477NN/1TQmwK8k1eZOOozSsU4Ak=; b=TwrAgfMm4TDk6xQPlpSLh+u/HM+H2VDrtqCfp84u5h7DzTS1B07q2fijwe/czqSCNLY31j 1k2MvDpp7muDof6mi1LhhZfW2Q4Dw+oKP4686UmEbc61LHm6e+00AGHrbZmOcwMPebkemh YqZCWH8LbN609DzBVUFCtgFLmkWPqypmLNXPvM7ctlkZZNLQlcF3gfxmzCDsU9yHBVIs0O 5yKrrkpqajG9J6hmwFuOGuHzx88YPfqGgnCJpRf1acS4zb4KBDaKWlaKb7hRFKf2lv1Xzn bgczZkoFaLUtyfu0UKc8364iZmaJuuaflpTuTYCDlnJsFxuGVCm2LbbbnYeLag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638378606; a=rsa-sha256; cv=none; b=ZpeaXGWWb3xebBI9QTLrYd+3XHP7RPLLZz1g0+7osrMvE7ofi9m/ykVB8YYqE9HS6wkSxc PHnNmRpvITPF7hhqZJTsbS6ssvGfLUXXuFLRJUR22hzGHNaDms0Rbt8vlx9ntfqkxU+kww R13v6SlBxj31pm6RIzUByy2GxF/rWlcj0vOnn9w/WoDySpRHYvjE4cMhYbPbAVHb2QHsm0 hlDiYIi8+W/iNf5tvFBjjaTZcTBsM6Pv3+pznHLGZRjuLOkCYcaDKp1y4gn+79IEvxm0vH lJC4l9pjhDF6KTBkqdXaSD46osGk8kHlLfCWBBYUlOjEOB2tXlmFkzk99oG3pg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a40b7651184478c18508cb676706465bacf1b773 commit a40b7651184478c18508cb676706465bacf1b773 Author: Kristof Provost AuthorDate: 2021-11-05 14:20:19 +0000 Commit: Kristof Provost CommitDate: 2021-12-01 15:53:19 +0000 net tests: basic if_stf test Test the 6to4 code. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D32850 (cherry picked from commit eb5e0755f7496d1328d572b4d181c70b39152f08) --- tests/sys/net/Makefile | 1 + tests/sys/net/if_stf.sh | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 9ff2b8c775b5..0eed6cf734fa 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -11,6 +11,7 @@ TEST_METADATA.if_bridge_test+= required_programs="python" ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_gif ATF_TESTS_SH+= if_lagg_test +ATF_TESTS_SH+= if_stf ATF_TESTS_SH+= if_tun_test ATF_TESTS_SH+= if_vlan diff --git a/tests/sys/net/if_stf.sh b/tests/sys/net/if_stf.sh new file mode 100644 index 000000000000..f3ed2d744c7c --- /dev/null +++ b/tests/sys/net/if_stf.sh @@ -0,0 +1,84 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "6to4" "cleanup" +6to4_head() +{ + atf_set descr 'Test 6to4' + atf_set require.user root +} + +6to4_body() +{ + vnet_init + if ! kldstat -q -m if_stf; then + atf_skip "This test requires if_stf" + fi + if ! kldstat -q -m if_gif; then + atf_skip "This test requires if_stf" + fi + + epair=$(vnet_mkepair) + + vnet_mkjail relay ${epair}a + jexec relay ifconfig lo0 inet6 2001:db8::1/64 up + jexec relay ifconfig ${epair}a 192.0.2.1/24 up + # Simple gif to terminate 6to4 + gif=$(jexec relay ifconfig gif create) + jexec relay ifconfig $gif inet6 2002:c000:0201::1/64 up + jexec relay ifconfig $gif tunnel 192.0.2.1 192.0.2.2 + jexec relay route -6 add default -interface $gif + + vnet_mkjail client ${epair}b + jexec client ifconfig ${epair}b 192.0.2.2/24 up + stf=$(jexec client ifconfig stf create) + jexec client ifconfig $stf inet6 2002:c000:0202::1/32 up + jexec client route -6 add default 2002:c000:0201::1 + + # Sanity check + atf_check -s exit:0 -o ignore \ + jexec client ping -c 1 192.0.2.1 + # 6to4 direct + atf_check -s exit:0 -o ignore \ + jexec client ping6 -c 1 2002:c000:0201::1 + + # "Wider internet" + atf_check -s exit:0 -o ignore \ + jexec client ping6 -c 1 2001:db8::1 +} + +6to4_cleanup() +{ + vnet_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "6to4" +}