From nobody Fri Apr 17 22:58: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 4fy9Kp4GpWz6ZGJH for ; Fri, 17 Apr 2026 22:58:54 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fy9Kp1Rp6z3Sm5 for ; Fri, 17 Apr 2026 22:58:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776466734; 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=DpyAp1vkYFnygGpw5auGA3CQAn35F3UXO5a2To3WCXc=; b=khyU+tt/OWSWrDlJ/H88xkq3e/EGfvOCuS/rxVxVBH3+JNGIhhkwCMDJud3VfJaM/+rqlX 4LQ4LBmK5PO9thKrP4OI2XM+9WGx0RMMvflQHpsq+Mpg2B4IrLtB7E5G6jHGJSa51Lb8QR 4eWx253139X++S8zU6YVpanzAXqZlmUQXMKXEz7YVyDQVjAcaGGtVJ+kLQSpP+eE9hqkJe ZvCSFuanbZsMwUowoorg4yR2/lEc2ZJSuFrgAs0yMRa5KtBBz7ZwCBM1/Rg7CyO7arWMVW sCqzDrrF9H01z7DQzdWX+NwEsP9dVPhv1lUFserCJfxj2EgzjtzgYFSZ4NDN1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776466734; a=rsa-sha256; cv=none; b=vO8MaHxVLRGLkXKgFQoU/EpKXQ9wpR77kXlxHnFKxL2kuertcTZ7kD9n9p/GbJdA1drVq6 gWZs6tCdobaiEK51td2+Jc2vPV49soexFhcqrRT8pmGckWj/+KnJNBHgNnbnHdYPUxsktT nBfk7fNKL7BpQ4XIJKMlLWYZ0KcEgEBiIDloPk0Br3CoG7+lbsOBarCcfBDiDautUOqPuR t02uC5gNX56Az9y+LUPSlCQuufa1lTX3NQxOUKU5W6/KpSx2WqAPzMWwCCFKJiXNtS5L6E RASYOQXwAA+7wL4ScuO/vxyW3bXUs9eLcNQInbdrcX4CRb0+1Hyhx1dnK+weXw== 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=1776466734; 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=DpyAp1vkYFnygGpw5auGA3CQAn35F3UXO5a2To3WCXc=; b=Oc9nrem5Y1sYyYNvOl+jXEPRixYdO+5Er4/XQcYTyW9mXzheafi0kdk16H10hgbxPqIfA1 3EVPm4CUwY2J1JclMA3QWs1KGi3A7CrCBk12sDvvhhCaUEfREq5Vb9GTF2J5aHYUAvrjDm cBolWpT09bFXuwyUPkOV9CCgVieaB/6t3oPBaFFNsfu0FaIleK3e10FANhZ2ztnIFUm49p CKgY/Oz92InTYEsMcPnnMBYWUIkBymQfJQ9WQSkg8yYdyoWgFtRiP37G1HMvtC6EU2Dt47 xcV7wLpXR6aeTQmxbiUiqqoht+4bg0QQpX9PPpZJGQEwIlcpqk8J02Zt8RBesg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fy9Kp0spgz1CVG for ; Fri, 17 Apr 2026 22:58:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3981c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 17 Apr 2026 22:58: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: f6bcc0925f0e - main - tests/netinet6: Add test for route information option 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: pouria X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f6bcc0925f0ea838da5183dc503f847e56d15cc8 Auto-Submitted: auto-generated Date: Fri, 17 Apr 2026 22:58:54 +0000 Message-Id: <69e2bb2e.3981c.1b277ded@gitrepo.freebsd.org> The branch main has been updated by pouria: URL: https://cgit.FreeBSD.org/src/commit/?id=f6bcc0925f0ea838da5183dc503f847e56d15cc8 commit f6bcc0925f0ea838da5183dc503f847e56d15cc8 Author: Pouria Mousavizadeh Tehrani AuthorDate: 2026-04-17 20:27:50 +0000 Commit: Pouria Mousavizadeh Tehrani CommitDate: 2026-04-17 22:52:26 +0000 tests/netinet6: Add test for route information option Test handling of receiving multiple route information options in RA. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D56216 --- tests/sys/netinet6/ndp.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++ tests/sys/netinet6/ra.py | 32 ++++++++++++++++++---- 2 files changed, 94 insertions(+), 5 deletions(-) diff --git a/tests/sys/netinet6/ndp.sh b/tests/sys/netinet6/ndp.sh index 035f8fc9989f..16704742dd88 100755 --- a/tests/sys/netinet6/ndp.sh +++ b/tests/sys/netinet6/ndp.sh @@ -783,6 +783,72 @@ ndp_slaac_switch_onlink_prefix_cleanup() { vnet_cleanup } +atf_test_case "ndp_routeinfo_option" "cleanup" +ndp_routeinfo_option_head() { + atf_set descr 'Test RFC 4191: Add route based on received RTI in RA' + atf_set require.user root + atf_set require.progs jq python3 scapy +} + +ndp_routeinfo_option_body() { + local epair0 jname prefix lladdr route1 route2 + + vnet_init + + jname="v6t-ndp_routeinfo_option" + prefix="2001:db8:ffff:1000::" + route1="3fff:1000::" + route2="3fff:2000::" + + epair0=$(vnet_mkepair) + + vnet_mkjail ${jname} ${epair0}a + + ndp_if_up ${epair0}a ${jname} + ndp_if_up ${epair0}b + atf_check jexec ${jname} ifconfig ${epair0}a inet6 accept_rtadv + + # Make sure that NAs from us are flagged as coming from a router. + atf_check -o ignore sysctl net.inet6.ip6.forwarding=1 + + lladdr="$(ndp_if_lladdr ${epair0}b)" + # Send an RA with high preference with 3 routes. + # The last rti should overwrite the default route rtiltime to 100 seconds + # and its preference to medium. + atf_check -e ignore python3 $(atf_get_srcdir)/ra.py \ + --sendif ${epair0}b \ + --dst $(ndp_if_lladdr ${epair0}a ${jname}) \ + --src ${lladdr} \ + --rtrpref 1 --rtrltime 1800 --prefix ${prefix} \ + --route ${route1} --routelen 32 \ + --rtipref 1 --rtiltime 1800 \ + --route ${route2} --routelen 48 \ + --rtipref 4 --rtiltime 600 \ + --route :: --routelen 0 \ + --rtipref 4 --rtiltime 100 + + # Wait for a default router to appear. + while [ -z "$(jexec ${jname} ndp -r)" ]; do + sleep 0.1 + done + + # Make sure routes from rti option are being installed + atf_check -s exit:0 \ + -o match:"^${route1}/32[[:space:]]+${lladdr}.*1800" \ + -o match:"^${route2}/48[[:space:]]+${lladdr}.*600" \ + -o match:"^default[[:space:]]+${lladdr}" \ + jexec ${jname} netstat -rn6 + + # Verify the default route lifetime and its preference is overwrited + atf_check -s exit:0 \ + -o match:"^${lladdr}%${epair0}a if=${epair0}a, flags=, pref=medium, expire=1m.*" \ + jexec ${jname} ndp -r +} + +ndp_routeinfo_option_cleanup() { + vnet_cleanup +} + atf_init_test_cases() { @@ -798,4 +864,5 @@ atf_init_test_cases() atf_add_test_case "ndp_input_validation_hlim" atf_add_test_case "ndp_input_validation_src_linklocal" atf_add_test_case "ndp_multirouter_pref" + atf_add_test_case "ndp_routeinfo_option" } diff --git a/tests/sys/netinet6/ra.py b/tests/sys/netinet6/ra.py index f71ab4b7499e..e732e952be71 100644 --- a/tests/sys/netinet6/ra.py +++ b/tests/sys/netinet6/ra.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-2-Clause # # Copyright (c) 2024 Klara, Inc. +# Copyright (c) 2026 Pouria Mousavizadeh Tehrani # import argparse @@ -41,18 +42,39 @@ def main(): parser.add_argument('--preferredlifetime', nargs=1, required=False, type=int, default=4294967295, help='The preferred lifetime of the prefix') + parser.add_argument('--route', nargs='*', required=False, + action='extend', type=str, default=[], + help='The route to be advertised') + parser.add_argument('--routelen', nargs='*', required=False, + action='extend', type=int, default=[], + help='The route length to be advertised') + parser.add_argument('--rtipref', nargs='*', required=False, + action='extend', type=int, default=[], + help='The route info preference advertised') + parser.add_argument('--rtiltime', nargs='*', required=False, + action='extend', type=int, default=[], + help='The route info preference advertised') args = parser.parse_args() pkt = sp.Ether() / \ sp.IPv6(src=args.src, dst=args.dst, hlim=args.hoplimit) / \ - sp.ICMPv6ND_RA(chlim=64, prf=args.rtrpref, routerlifetime=args.rtrltime) + sp.ICMPv6ND_RA(chlim=64, + prf=args.rtrpref, + routerlifetime=args.rtrltime) if (args.prefix): pkt = pkt / \ - sp.ICMPv6NDOptPrefixInfo(prefix=args.prefix, - prefixlen=args.prefixlen, - validlifetime=args.validlifetime, - preferredlifetime=args.preferredlifetime) + sp.ICMPv6NDOptPrefixInfo(prefix=args.prefix, + prefixlen=args.prefixlen, + validlifetime=args.validlifetime, + preferredlifetime=args.preferredlifetime) + + for i in range(0, len(args.route)): + pkt = pkt / \ + sp.ICMPv6NDOptRouteInfo(prefix=args.route[i], + plen=args.routelen[i], + prf=args.rtipref[i], + rtlifetime=args.rtiltime[i]) sp.sendp(pkt, iface=args.sendif[0], verbose=False) sys.exit(0)