From nobody Thu Jul 30 18:11:54 2026 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 4h9y2g2TNLz6mnJh for ; Thu, 30 Jul 2026 18:11:55 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h9y2f416Pz4Cs2 for ; Thu, 30 Jul 2026 18:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785435114; 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=MNd7yuw623bgDg4B02dVkN6KPg/5mCiPlEwJv7oBdTk=; b=yUr4DIhFeajrBH4r2VM04kbKiiGg2ars4G4aJlmKVWuI7ZbkG+ya7Z+NUwjPXrApS8WpPX 9G4qjKjbyog4ZSTIk3zvrv7HlxePZSL+NbEsHErwy38wktRWclpLfYdYJVJoKXiDnLctAT zfwuLi9OJrMuAXVFtyFD54jS1qfP5jdUQi4NDuimet+B5QDXUzKkoT4F3FIQSSnNlHhbyz k0BQMxokR9joqj2ptnrXArTDMrFfL37ochbJwKwyYVmqWL0GkNHDU99SFa+shsvKbTxAR1 8/TbKFXAenMEGV7jDfoApAimT5t4zEd+tL/QbgSawpF9+9NaLUk3zTZQXZZsaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1785435114; a=rsa-sha256; cv=none; b=hlMPRGDtx3ea4KGLk2qFTA/EPmUtYMcyeTS7XOsim3CZrzq+mEmTQpYTVFV5LhNRxiMBZU Ut80019UFdywR2iqae5Xng2lB19ItbQhi9CrMNaCW2Xraiw5eYe2ZJ02pls0aJt836pchI AoOCQmTjzU1BlYaqXsHZdQGIikIXd0vFh4kYgD3AOC3KoqKGG4/mq15BidcXPupH3mMPAb Pws2KxiEuk/3o4u+VhNa8n8as/59EIdjV+4ZmdS75NsWBJE7IlQQV/+yR/G48n3OUceX7Z ZdSCwz/e7RFGDFEKvw7MrItkv2oUoG1c9ZPy7Ocd83loZ8R+bRi3TQ00FDy5oQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1785435114; 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=MNd7yuw623bgDg4B02dVkN6KPg/5mCiPlEwJv7oBdTk=; b=Czs3VdU8VwIE1HBcQqQfFybWhCuuoelleaBdCcXUUFABB5y2Mxe/ZjH8nInPFW8Tb+iXq4 JnO1aw+rUMyLuKC2Siq7YVHl/tjA6WIKHa+JU8q2cVDX8dYYkp2oaepQ1CUXpzCxAyszqs 2Eu2dLcM8lpn1/A6K/VQ8A+OcYrix4V5QLtovBCV73knV0+zrAgU+Y7a15M8Dkw7BGxzFJ jpSQjZDqkHoUyu1+NWgfFn9prmFlS185yOqWI0gsXJGdqDs7ViwA+5xRRbrsz8+h/xoa4u 8DZen8WzbayokxN5YV2OtanZ1rBe6XMhGkyT46fnJQ048rDpDUA+UMDz2Ng2sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4h9y2f2zlTz7t5 for ; Thu, 30 Jul 2026 18:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3edae by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 30 Jul 2026 18:11:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Pouria Mousavizadeh Tehrani Subject: git: fdf86df72a32 - main - if_gre: Add a regression 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fdf86df72a32e5d8ca729220a5c787265f8b6682 Auto-Submitted: auto-generated Date: Thu, 30 Jul 2026 18:11:54 +0000 Message-Id: <6a6b93ea.3edae.75c4be1c@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=fdf86df72a32e5d8ca729220a5c787265f8b6682 commit fdf86df72a32e5d8ca729220a5c787265f8b6682 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-07-30 17:54:54 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-07-30 17:56:25 +0000 if_gre: Add a regression test Add a regression test for gre(4) to make sure all of the gre capabilities and options are working as intended. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D55363 --- tests/sys/net/Makefile | 1 + tests/sys/net/if_gre.sh | 396 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 397 insertions(+) diff --git a/tests/sys/net/Makefile b/tests/sys/net/Makefile index 394fbea12dcd..36b1de11e0cd 100644 --- a/tests/sys/net/Makefile +++ b/tests/sys/net/Makefile @@ -8,6 +8,7 @@ ATF_TESTS_SH+= if_epair_test ATF_TESTS_SH+= if_bridge_test ATF_TESTS_SH+= if_clone_test ATF_TESTS_SH+= if_gif +ATF_TESTS_SH+= if_gre ATF_TESTS_SH+= if_lagg_test ATF_TESTS_SH+= if_stf ATF_TESTS_SH+= if_tun_test diff --git a/tests/sys/net/if_gre.sh b/tests/sys/net/if_gre.sh new file mode 100644 index 000000000000..ffa76a923bb5 --- /dev/null +++ b/tests/sys/net/if_gre.sh @@ -0,0 +1,396 @@ +# +# Copyright (c) 2026 Pouria Mousavizadeh Tehrani +# +# SPDX-License-Identifier: BSD-2-Clause +# + +. $(atf_get_srcdir)/../common/vnet.subr + +atf_test_case "gre4_basic" "cleanup" +gre4_basic_head() +{ + atf_set descr 'Create a gre(4) tunnel over ipv4 underlay' + atf_set require.user root + atf_set require.kmods if_gre +} +gre4_basic_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=192.168.2.1 + endpoint2=192.168.2.2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet ${endpoint1}/30 up + ifconfig -j gretest2 ${epair}b inet ${endpoint2}/30 up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet tunnel ${endpoint1} ${endpoint2} up + atf_check ifconfig -j gretest2 gre1 create \ + inet tunnel ${endpoint2} ${endpoint1} up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre4_basic_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre6_basic" "cleanup" +gre6_basic_head() +{ + atf_set descr 'Create a gre(4) tunnel over ipv6 underlay' + atf_set require.user root + atf_set require.kmods if_gre +} +gre6_basic_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=3fff::1 + endpoint2=3fff::2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet6 ${endpoint1} up + ifconfig -j gretest2 ${epair}b inet6 ${endpoint2} up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet6 tunnel ${endpoint1} ${endpoint2} up + atf_check ifconfig -j gretest2 gre1 create \ + inet6 tunnel ${endpoint2} ${endpoint1} up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre6_basic_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre6_csum" "cleanup" +gre6_csum_head() +{ + atf_set descr 'Create a gre(4) tunnel over ipv6 underlay with checksum option' + atf_set require.user root + atf_set require.kmods if_gre +} +gre6_csum_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=3fff::1 + endpoint2=3fff::2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet6 ${endpoint1} up + ifconfig -j gretest2 ${epair}b inet6 ${endpoint2} up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet6 tunnel ${endpoint1} ${endpoint2} enable_csum up + atf_check ifconfig -j gretest2 gre1 create \ + inet6 tunnel ${endpoint2} ${endpoint1} enable_csum up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # ifconfig test + atf_check -o match:"ENABLE_CSUM" ifconfig -j gretest1 gre1 + atf_check -o match:"ENABLE_CSUM" ifconfig -j gretest2 gre1 + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre6_csum_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre6_key" "cleanup" +gre6_key_head() +{ + atf_set descr 'Create a gre(4) tunnel over ipv6 underlay with gre key option' + atf_set require.user root + atf_set require.kmods if_gre +} +gre6_key_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=3fff::1 + endpoint2=3fff::2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet6 ${endpoint1} up + ifconfig -j gretest2 ${epair}b inet6 ${endpoint2} up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet6 tunnel ${endpoint1} ${endpoint2} grekey 10 up + atf_check ifconfig -j gretest2 gre1 create \ + inet6 tunnel ${endpoint2} ${endpoint1} grekey 10 up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # ifconfig test + atf_check -o match:"grekey: 0xa \(10\)" ifconfig -j gretest1 gre1 + atf_check -o match:"grekey: 0xa \(10\)" ifconfig -j gretest2 gre1 + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre6_key_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre6_seq" "cleanup" +gre6_seq_head() +{ + atf_set descr 'Create a sequenced gre(4) tunnel over ipv6 underlay' + atf_set require.user root + atf_set require.kmods if_gre +} +gre6_seq_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=3fff::1 + endpoint2=3fff::2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet6 ${endpoint1} up + ifconfig -j gretest2 ${epair}b inet6 ${endpoint2} up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet6 tunnel ${endpoint1} ${endpoint2} enable_seq up + atf_check ifconfig -j gretest2 gre1 create \ + inet6 tunnel ${endpoint2} ${endpoint1} enable_seq up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # ifconfig test + atf_check -o match:"ENABLE_SEQ" ifconfig -j gretest1 gre1 + atf_check -o match:"ENABLE_SEQ" ifconfig -j gretest2 gre1 + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre6_seq_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre6_udpencap" "cleanup" +gre6_udpencap_head() +{ + atf_set descr 'Create a gre(4) over UDP tunnel with ipv6 underlay' + atf_set require.user root + atf_set require.kmods if_gre +} +gre6_udpencap_body() +{ + local epair endpoint1 endpoint2 + local v4tunnel1 v4tunnel2 v6tunnel1 v6tunnel2 + + endpoint1=3fff::1 + endpoint2=3fff::2 + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + epair=$(vnet_mkepair) + vnet_mkjail gretest1 ${epair}a + vnet_mkjail gretest2 ${epair}b + + ifconfig -j gretest1 ${epair}a inet6 ${endpoint1} up + ifconfig -j gretest2 ${epair}b inet6 ${endpoint2} up + + # Sanity check + atf_check -o ignore \ + jexec gretest1 ping -c 1 -t 3 ${endpoint2} + atf_check -o ignore \ + jexec gretest2 ping -c 1 -t 3 ${endpoint1} + + atf_check ifconfig -j gretest1 gre1 create \ + inet6 tunnel ${endpoint1} ${endpoint2} udpencap up + atf_check ifconfig -j gretest2 gre1 create \ + inet6 tunnel ${endpoint2} ${endpoint1} udpencap udpport 55555 up + + atf_check ifconfig -j gretest1 gre1 inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest1 gre1 inet6 ${v6tunnel1} + atf_check ifconfig -j gretest2 gre1 inet ${v4tunnel2} ${v4tunnel1} + atf_check ifconfig -j gretest2 gre1 inet6 ${v6tunnel2} + + # ifconfig test + atf_check -o match:"UDPENCAP" ifconfig -j gretest1 gre1 + atf_check -o match:"udpport: 55555" ifconfig -j gretest2 gre1 + + # Tunnel test + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v4tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v4tunnel1 + atf_check -o ignore jexec gretest1 ping -nc 1 -t 1 $v6tunnel2 + atf_check -o ignore jexec gretest2 ping -nc 1 -t 1 $v6tunnel1 +} +gre6_udpencap_cleanup() +{ + vnet_cleanup +} + +atf_test_case "gre_blind_options" "cleanup" +gre_blind_options_head() +{ + atf_set descr 'Test gre(4) tunnel options without verifying its effect on dataplane.' + atf_set require.user root + atf_set require.kmods if_gre +} +gre_blind_options_body() +{ + local gre + + v4tunnel1=169.254.0.1 + v4tunnel2=169.254.0.2 + v6tunnel1=2001:db8::1 + v6tunnel2=2001:db8::2 + + vnet_init + vnet_mkjail gretest + + gre=$(ifconfig -j gretest gre create \ + enable_seq grekey 10 enable_csum udpencap udpport 55555 up) + + atf_check ifconfig -j gretest $gre inet ${v4tunnel1} ${v4tunnel2} + atf_check ifconfig -j gretest $gre inet6 ${v6tunnel1} + + # ifconfig test + atf_check -o match:"grekey: 0xa \(10\)" ifconfig -j gretest $gre + atf_check -o match:"ENABLE_CSUM" ifconfig -j gretest $gre + atf_check -o match:"ENABLE_SEQ" ifconfig -j gretest $gre + atf_check -o match:"UDPENCAP" ifconfig -j gretest $gre + atf_check -o match:"udpport: 55555" ifconfig -j gretest $gre +} +gre_blind_options_cleanup() +{ + vnet_cleanup +} + + +atf_init_test_cases() +{ + atf_add_test_case "gre4_basic" + atf_add_test_case "gre6_basic" + atf_add_test_case "gre6_csum" + atf_add_test_case "gre6_key" + atf_add_test_case "gre6_seq" + atf_add_test_case "gre6_udpencap" + atf_add_test_case "gre_blind_options" +}