From nobody Wed Nov 18 21:45:28 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 4jVFWr4yPWz71KdB for ; Wed, 18 Nov 2026 21:45:28 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jVFWr4MYGz4Lqc for ; Wed, 18 Nov 2026 21:45:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795038328; 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=U6epXaK9thHn0irpHWy0xjVUK6zDMz99/WCOiUJu1Kw=; b=evyuyhhqi2Ct+XzxbjEilAgEo4YThK0USqD/yuzEf/Ui9Pn05QC+763FEvunbbEBubvk+9 qKuMS7eQM6Q6ApIq+uNMKiFKrA/QbQTmpz+voxw4Ke/T9kD/PjAw6xW3N+yl950Qoln1rO sxZLEu/ZsinA43Vggl4Pphvc9ji9MvJ9zT0mJsbwnUbNZ6CworcjJ7tsl9KcIhgppvAC9V QjJXnJRSDjc5rzG0Vq+EzWgCtTeYglO1fL1vnj7kSPVsC8YjC6xz3HtbSr/NFsicIMu7P9 /Fo8+LR/zGhuZbnuztltwKArXxTeNmJ3R8UR5tDWUacUOGiMSnDjK5d5AFChlg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795038328; b=DAKjiqFieAirwqQtxqubQP4jEYCBH0V4fT1+TkZJkkcHhxYiqoDtzCAVOge2koppHHIUu0 w4VQRnYUWrhiaBRiWTYVUiF7EkxrBSL+LRxp48tZVyF3gObTzUkalFpDsrlBY4fcDKI1V6 KGLWa10DM4Taw7ouLFEZmLuX0/xi/2jw2hur8cH8GM6VQHqe/ButybZ1+F87LEDrABp/b0 x9rdkvOFINx4H13IPr/PaLwaxsSTG9cIsbnkd12DBa4IwiRGIZqZTgd6o0dHkAMtym//SW ToGqXfkuUW0SOu1oe2cbaviiAfLA4LjnAK3v772TRdQjPd3+JwyeA6Nzp5dsDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795038328; 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=U6epXaK9thHn0irpHWy0xjVUK6zDMz99/WCOiUJu1Kw=; b=ifT9NouZmTDpwv5H1Lhyv8bM7hhMu3rXWJIEVY/mRPS8yvXN5PiwATrbdN7j+n2aLCwmU9 XeJpDRNkgqh5v3gQHbcB9eS6pXxOqeiP5nlK3ozSNEkYZEK+CB29Mym1tNRPgmQ2bW0ptU ob1ZLVJsaOCcRaX/DDCLbVjlBx3zoX/aXsoRjRHO4RZjwf8nULh/Yc+pOUDeWTOrhtIi59 3R6OqEMrkjcwYmGtMbnQeOitiFm7Tgv1mNkk13bbWH9iRiOhJdcKKZujvk9j1SWbsBdp+Z 6OenHcnFjlnw719MG1JmWScy8SxsIJNxmPjkeCRDG+9B61MxMNQTmeK2R/W66w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jVFWr42SszWF6 for ; Wed, 18 Nov 2026 21:45:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4919 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 18 Nov 2026 21:45:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: R. Christian McDonald Subject: git: 3ccfcdacd6ae - main - pf: Do not report a packet the outbound pass sent as dropped List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository 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: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ccfcdacd6ae7611dc0f2a1375713dc0111c3d5f Auto-Submitted: auto-generated Date: Wed, 18 Nov 2026 21:45:28 +0000 Message-Id: <6afe1c78.4919.1d188f97@gitrepo.freebsd.org> The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=3ccfcdacd6ae7611dc0f2a1375713dc0111c3d5f commit 3ccfcdacd6ae7611dc0f2a1375713dc0111c3d5f Author: R. Christian McDonald AuthorDate: 2026-11-18 21:44:44 +0000 Commit: R. Christian McDonald CommitDate: 2026-11-18 21:44:44 +0000 pf: Do not report a packet the outbound pass sent as dropped For route-to on the inbound pass, pf_route() and pf_route6() run the outbound pass on the new interface themselves and hand it the actions of the rule. When that pass creates a state, the state has the route-to as well, so the outbound pass sends the packet and returns PF_PASS without an mbuf. Since 349360b17eab the caller turns this into PF_DROP, and the pfil hook returns PFIL_DROPPED for a packet that was forwarded. ip6_tryforward() then counts an input discard on the receiving interface for every such packet. Leave the action at PF_PASS, so that the hook returns PFIL_CONSUMED, as it does when pf_route() or pf_route6() send the packet themselves. Extend forward:v6_route_to_discards to rules that keep state. Reviewed by: kp Fixes: 349360b17eab ("pf: return errors from pf_route() and ...") MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D61674 --- sys/netpfil/pf/pf.c | 12 ++++++++---- tests/sys/netpfil/pf/forward.sh | 30 ++++++++++++++++-------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 6601763d4b51..77a3eb643eeb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -9947,8 +9947,10 @@ pf_route(struct pf_krule *r, struct ifnet *oifp, SDT_PROBE1(pf, ip, route_to, drop, __LINE__); goto bad; } else if (m0 == NULL) { - action = PF_DROP; - SDT_PROBE1(pf, ip, route_to, drop, __LINE__); + /* + * The outbound pass sent the packet on itself + * or queued it, so it is consumed, not dropped. + */ goto done; } if (m0->m_len < sizeof(struct ip)) { @@ -10291,8 +10293,10 @@ pf_route6(struct pf_krule *r, struct ifnet *oifp, SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); goto bad; } else if (m0 == NULL) { - action = PF_DROP; - SDT_PROBE1(pf, ip6, route_to, drop, __LINE__); + /* + * The outbound pass sent the packet on itself + * or queued it, so it is consumed, not dropped. + */ goto done; } if (m0->m_len < sizeof(struct ip6_hdr)) { diff --git a/tests/sys/netpfil/pf/forward.sh b/tests/sys/netpfil/pf/forward.sh index 4524a32dc392..fcb47e1718f1 100644 --- a/tests/sys/netpfil/pf/forward.sh +++ b/tests/sys/netpfil/pf/forward.sh @@ -316,24 +316,26 @@ v6_route_to_discards_body() # the outbound hook, after the route lookup chose ${epair_recv}b, for # route-to on the outbound pass. Neither is a discard. # - # The rules do not keep state: when the outbound pass that pf runs from - # the inbound hook creates a state, pf reports the packet it sent as - # dropped. + # With state, the outbound pass that pf runs from the inbound hook + # creates a state of its own and sends the packet; without, the inbound + # pass does. # # The host's MLD reports are for a group alcatraz has not joined, and # ip6_input() would count them as discarded. Block them. for dir in in out; do - pft_set_rules alcatraz \ - "block in quick inet6 to ff02::16" \ - "pass no state" \ - "pass ${dir} quick route-to (${epair_route}b 2001:db8:44::3) inet6 to 2001:db8:666::1 no state" - in_discards=$(jexec alcatraz netstat -s -p ip6 -I ${epair_send}b | - awk '/input datagrams? discarded/ { print $1 }') - atf_check -s exit:2 -o ignore ping -6 -c 1 -W 1 2001:db8:666::1 - atf_check -o match:"[[:space:]]${in_discards} input datagrams? discarded" \ - jexec alcatraz netstat -s -p ip6 -I ${epair_send}b - atf_check -o match:"[[:space:]]0 total discarded output datagrams" \ - jexec alcatraz netstat -s -p ip6 -I ${epair_recv}b + for state in "keep state" "no state"; do + pft_set_rules alcatraz \ + "block in quick inet6 to ff02::16" \ + "pass ${state}" \ + "pass ${dir} quick route-to (${epair_route}b 2001:db8:44::3) inet6 to 2001:db8:666::1 ${state}" + in_discards=$(jexec alcatraz netstat -s -p ip6 -I ${epair_send}b | + awk '/input datagrams? discarded/ { print $1 }') + atf_check -s exit:2 -o ignore ping -6 -c 1 -W 1 2001:db8:666::1 + atf_check -o match:"[[:space:]]${in_discards} input datagrams? discarded" \ + jexec alcatraz netstat -s -p ip6 -I ${epair_send}b + atf_check -o match:"[[:space:]]0 total discarded output datagrams" \ + jexec alcatraz netstat -s -p ip6 -I ${epair_recv}b + done done }