From nobody Tue Dec 17 10:07:58 2024 X-Original-To: dev-commits-src-main@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 4YCCDb3BxNz5h0j4; Tue, 17 Dec 2024 10:07:59 +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 4YCCDb0GxGz49s4; Tue, 17 Dec 2024 10:07:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430079; 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=ZCBz02m7iEgxjR9dWT/Dot7vRLOZiYaNUJoEYweVQ4Q=; b=EDQOR1Jz1TglR72IWPdGpd4efLlusZHOjWbZHzrlH/hLTABS8oM2h6tJ0ta5jLDMkT+mGG Af/1v7EvJDNRcy7sk1hScmWcJB6yHBYPJmefHo3IvqcO0euMITCmloGe+e+vHTRaVgBC+q nVFg2tWAODgxKw6r1h+BmBsGwLuTanuT2/90bj/ltC7mbJs8pH9W18F+X5880xN43yPzlD oAOEtSXkAqMq6+x41YiOK+rDrBoDMCQXNgXaz5PgsHqHdnyCPR5iLwMLYEz17W05OWe34l 9HNkP+EvmAQgji4UN2Fh/SEJQaNz4AFG7mKzzldcc0xwa1Mb1FU14qGGy0U36A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734430079; 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=ZCBz02m7iEgxjR9dWT/Dot7vRLOZiYaNUJoEYweVQ4Q=; b=k+AgHKlyZMoyEHrsqTGXB7wkhatucogD6bYH9ViAm7EpBI080FnW4NMzwuP/uU/p1pgNMz hgC2bmrDWE6yHLFC+1dt9sPGw4TiqmnO4cjJzi7TjTfKdaW3W4vUf1PYbLLEnNomwN8WyF 8DU/0MmQ0jk46fPQ0DhFGFs1P1k+SebXXl5pVE6GPKHRb0+B7TUzXmpUdSyAY/an6pvT9M Ih59hB143sMp46oDdJaNAxzLBM4Q8nM8/xzBvOEc8z1a1eeMhGgc20XlG9dZgfBnHIupCW TIJRE07yKIxt0KyXZX0udBNygb2nayiXT2VVlOjLaliTIFJlQSxQCXyw25Caxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734430079; a=rsa-sha256; cv=none; b=WPR8glQQRyJu2V8Y3ZAQYP/Fn6LnBJBijq4xwMWr1lUhQAZHqNaK3GUFyKnpHaGnBxaBWd ZVjmFjECHvVNg0cD7QbNRueG/6CwMA7PM/aVmdEpBFxRtt2BH7J2TR/KYzwOyHsTjx84ss XUbzkt9yTy0K8okoVT09eBTbzM1FbQrRLQeoLHz8RUE3J/we6LOBc3O89ZHISwkzsAv6GY G+ZwrmpaW8NG8TIK5iXfNUg9tnqFA1fd8yMMVNOWw2LgqrZBcINnxKbAvXldo7EVc9Djgu 0DdmyiUS+1HwvalOZ/6XvGjS+HVmaMoeal4JqF8zue4EA6an5RfIlkdx7c3tWQ== 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 4YCCDZ6kGWzJ1w; Tue, 17 Dec 2024 10:07:58 +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 4BHA7wQs024168; Tue, 17 Dec 2024 10:07:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BHA7wIR024165; Tue, 17 Dec 2024 10:07:58 GMT (envelope-from git) Date: Tue, 17 Dec 2024 10:07:58 GMT Message-Id: <202412171007.4BHA7wIR024165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 373d6dbf34a8 - main - pf tests: verify that ICMP destination unreachable makes it through NAT64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 373d6dbf34a8c4c506ccaa6ac3f7cc42493d8b48 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=373d6dbf34a8c4c506ccaa6ac3f7cc42493d8b48 commit 373d6dbf34a8c4c506ccaa6ac3f7cc42493d8b48 Author: Kristof Provost AuthorDate: 2024-11-11 16:48:49 +0000 Commit: Kristof Provost CommitDate: 2024-12-17 10:07:15 +0000 pf tests: verify that ICMP destination unreachable makes it through NAT64 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D47798 --- tests/sys/netpfil/pf/nat64.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/sys/netpfil/pf/nat64.py b/tests/sys/netpfil/pf/nat64.py index a3bd6048028e..12793662c171 100644 --- a/tests/sys/netpfil/pf/nat64.py +++ b/tests/sys/netpfil/pf/nat64.py @@ -39,11 +39,13 @@ class TestNAT64(VnetTestTemplate): } def vnet3_handler(self, vnet): + ToolsHelper.print_output("/sbin/sysctl net.inet.ip.forwarding=1") ToolsHelper.print_output("echo foo | nc -l 1234 &") def vnet2_handler(self, vnet): ifname = vnet.iface_alias_map["if1"].name + ToolsHelper.print_output("/sbin/route add default 192.0.2.2") ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ "pass inet6 proto icmp6", @@ -102,3 +104,24 @@ class TestNAT64(VnetTestTemplate): udp = reply.getlayer(sp.UDPerror) assert udp assert udp.dport == 1222 + + @pytest.mark.require_user("root") + def test_address_unreachable(self): + ToolsHelper.print_output("/sbin/route -6 add default 2001:db8::1") + + import scapy.all as sp + + packet = sp.IPv6(dst="64:ff9b::198.51.100.3") \ + / sp.UDP(dport=1222) / sp.Raw("bar") + reply = sp.sr1(packet, timeout=3) + print(reply.show()) + + # We expect an ICMPv6 error, not a UDP reply + assert not reply.getlayer(sp.UDP) + icmp = reply.getlayer(sp.ICMPv6DestUnreach) + assert icmp + assert icmp.type == 1 + assert icmp.code == 0 + udp = reply.getlayer(sp.UDPerror) + assert udp + assert udp.dport == 1222