From owner-dev-commits-src-all@freebsd.org Tue Aug 24 12:53:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D762665724A; Tue, 24 Aug 2021 12:53:40 +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 4Gv8Dh5TBRz4gyM; Tue, 24 Aug 2021 12:53:40 +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 A47C59DA; Tue, 24 Aug 2021 12:53:40 +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 17OCreFV078593; Tue, 24 Aug 2021 12:53:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17OCreNW078592; Tue, 24 Aug 2021 12:53:40 GMT (envelope-from git) Date: Tue, 24 Aug 2021 12:53:40 GMT Message-Id: <202108241253.17OCreNW078592@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: a6daf4d500b4 - stable/13 - Add arp/ndp tests in addition to rtsock ll tests. 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: a6daf4d500b47fbc4c1b4f859fa9338b78e3a266 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 12:53:40 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a6daf4d500b47fbc4c1b4f859fa9338b78e3a266 commit a6daf4d500b47fbc4c1b4f859fa9338b78e3a266 Author: Alexander V. Chernikov AuthorDate: 2021-02-20 18:20:24 +0000 Commit: Kristof Provost CommitDate: 2021-08-24 07:02:15 +0000 Add arp/ndp tests in addition to rtsock ll tests. (cherry picked from commit f17f94cd1b99c61faa08aa988b47805c53b78ac7) --- tests/sys/netinet/Makefile | 2 +- tests/sys/netinet/arp.sh | 97 +++++++++++++++++++++++++++++++++++++ tests/sys/netinet6/Makefile | 3 +- tests/sys/netinet6/ndp.sh | 115 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 215 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/Makefile b/tests/sys/netinet/Makefile index a053ec711fff..ec2e6e679c18 100644 --- a/tests/sys/netinet/Makefile +++ b/tests/sys/netinet/Makefile @@ -12,7 +12,7 @@ ATF_TESTS_C= ip_reass_test \ socket_afinet \ tcp_connect_port_test -ATF_TESTS_SH= carp fibs fibs_test redirect divert forward output lpm +ATF_TESTS_SH= carp fibs fibs_test redirect divert forward output lpm arp TEST_METADATA.output+= required_programs="python" PROGS= udp_dontroute tcp_user_cookie diff --git a/tests/sys/netinet/arp.sh b/tests/sys/netinet/arp.sh new file mode 100755 index 000000000000..8b5b30911314 --- /dev/null +++ b/tests/sys/netinet/arp.sh @@ -0,0 +1,97 @@ +#!/usr/bin/env atf-sh +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Alexander V. Chernikov +# +# 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. +# +# $FreeBSD$ +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "arp_add_success" "cleanup" +arp_add_success_head() { + atf_set descr 'Test static arp record addition' + atf_set require.user root +} + +arp_add_success_body() { + + vnet_init + + jname="v4t-arp_add_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ifconfig ${epair0}a inet 198.51.100.1/24 + + atf_check jexec ${jname} arp -s 198.51.100.2 90:10:00:01:02:03 + + atf_check -o match:"\? \(198.51.100.2\) at 90:10:00:01:02:03 on ${epair0}a permanent" jexec ${jname} arp -ni ${epair0}a 198.51.100.2 +} + +arp_add_success_cleanup() { + vnet_cleanup +} + + +atf_test_case "arp_del_success" "cleanup" +arp_del_success_head() { + atf_set descr 'Test arp record deletion' + atf_set require.user root +} + +arp_del_success_body() { + + vnet_init + + jname="v4t-arp_del_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ifconfig ${epair0}a inet 198.51.100.1/24 + + jexec ${jname} ping -c1 -t1 198.51.100.2 + + atf_check -o match:"198.51.100.2 \(198.51.100.2\) deleted" jexec ${jname} arp -nd 198.51.100.2 +} + +arp_del_success_cleanup() { + vnet_cleanup +} + + +atf_init_test_cases() +{ + + atf_add_test_case "arp_add_success" + atf_add_test_case "arp_del_success" +} + +# end + diff --git a/tests/sys/netinet6/Makefile b/tests/sys/netinet6/Makefile index 0ad95af97c83..dfae9f698ec4 100644 --- a/tests/sys/netinet6/Makefile +++ b/tests/sys/netinet6/Makefile @@ -14,7 +14,8 @@ ATF_TESTS_SH= \ forward6 \ output6 \ lpm6 \ - fibs6 + fibs6 \ + ndp TEST_METADATA.output6+= required_programs="python" ${PACKAGE}FILES+= exthdr.py diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh new file mode 100755 index 000000000000..2b26ffd4c448 --- /dev/null +++ b/tests/sys/netinet6/ndp.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env atf-sh +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2021 Alexander V. Chernikov +# +# 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. +# +# $FreeBSD$ +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "ndp_add_gu_success" "cleanup" +ndp_add_gu_success_head() { + atf_set descr 'Test static ndp record addition' + atf_set require.user root +} + +ndp_add_gu_success_body() { + + vnet_init + + jname="v6t-ndp_add_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + jexec ${jname} ndp -i ${epair0}a -- -disabled + jexec ${jname} ifconfig ${epair0}a up + + jexec ${jname} ifconfig ${epair0}a inet6 2001:db8::1/64 + + # wait for DAD to complete + while [ `jexec ${jname} ifconfig | grep inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + atf_check jexec ${jname} ndp -s 2001:db8::2 90:10:00:01:02:03 + + t=`jexec ${jname} ndp -an | grep 2001:db8::2 | awk '{print $1, $2, $3, $4}'` + if [ "${t}" != "2001:db8::2 90:10:00:01:02:03 ${epair0}a permanent" ]; then + atf_fail "Wrong output: ${t}" + fi + echo "T='${t}'" +} + +ndp_add_gu_success_cleanup() { + vnet_cleanup +} + +atf_test_case "ndp_del_gu_success" "cleanup" +ndp_del_gu_success_head() { + atf_set descr 'Test ndp record deletion' + atf_set require.user root +} + +ndp_del_gu_success_body() { + + vnet_init + + jname="v6t-ndp_del_gu_success" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + jexec ${jname} ndp -i ${epair0}a -- -disabled + jexec ${jname} ifconfig ${epair0}a up + + jexec ${jname} ifconfig ${epair0}a inet6 2001:db8::1/64 + + # wait for DAD to complete + while [ `jexec ${jname} ifconfig | grep inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + jexec ${jname} ping -c1 -t1 2001:db8::2 + + atf_check -o match:"2001:db8::2 \(2001:db8::2\) deleted" jexec ${jname} ndp -nd 2001:db8::2 +} + +ndp_del_success_cleanup() { + vnet_cleanup +} + + +atf_init_test_cases() +{ + + atf_add_test_case "ndp_add_gu_success" + atf_add_test_case "ndp_del_gu_success" +} + +# end +