From nobody Wed Feb 19 13:34:55 2025 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 4Yycnq1yrTz5pNGL; Wed, 19 Feb 2025 13:34: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yycnq1Y6dz3R94; Wed, 19 Feb 2025 13:34:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739972095; 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=1CyKQ9BhLgsgm78PK27D+XHwVxCj9K9oWXq/gL1EESo=; b=hXEs/LnqF8uqdEWWwEc0xCg1d0XF4xJ8t7llRVaDkpM74Gss/s1VzCjFbgKYj8SR17zaoc 0pa6gpHb2hoKj+mVldsoLNxOPMqm+iAkx3OgtTQxEFG39o3huBSxvwhX+xZzWlSbtLc1cg 9cnxSBbA5SeTmhSWY6xsVkhkS/cQp4DMt0+4XWqfciexSsSGozhV447t2B47eJj1K82K3G fm/rRGM9u1ODvngPTwnEc4lwYft7bJ7x3LdY0lrdFZyBLsggCqBPskF9AS1xhNDbgnK727 eZWitZF+LMM3eLF6LHy56+nUt5bu8JH14I73MdDKPGhg/LKFH63cRowjpM7iRA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739972095; a=rsa-sha256; cv=none; b=NGwZQmaHYWO0MIvT346ZczFBY3OlifzGO57oQ0ZtTFDhQeay15MZnmTqrcKVFUeBKrG+nh tYBBJl004ZgskTs2dk9YQlRCMPG/yKMbIGFl2KrXPJaE8eul/Qm38F5TCT2a1wJ7gmc+eI 7vZgJF3vt9rzUSfuSXkvmCUDS4Npd7mNOnR5PfLsRSr3AlwMRsKIMn+XjgY0TkQTqEkdGo jixFxZnUKY4WdElAkApDusqqtInXxI1GeQW0Z5nY8M3IhYGxysmjgGFpohTuth9LFaxnIi CzjMoV8N2u3YnJBedI1UXWh5YZbiUBmv9UiogESIAG9b3vFpVWhktCnDecYbpQ== 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=1739972095; 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=1CyKQ9BhLgsgm78PK27D+XHwVxCj9K9oWXq/gL1EESo=; b=IdgvN/fupk6kT1ovgfUAOCd93mf6F5xBtq/1alDcRtBVZ5+RiT9++5CKY2GbPeUSsVvyt0 ggxqliagouag+0wxJPbHDIGghrk+I+2UxzfGzJh0tobhpDcoHC3W6grI9hmbm+Tbp2daGI XRQtHgsSSJtX3bxeY/NaJSGQ8D910ZslRuARE2AXGFXJV2fFCLz29CxiPavOJoEeGmCXuC GtvU1lWAKzQ3tRiyFSZpo3n2ZZivKQfSDOH7/wXvrSOWT/v17zgQ7jcfrJ1s3VdaFySAgG sdgezWOuIPDK+gLf7UbUG9EtJMD0KQqNOdwlSSaIp5AxkoVHSP6ALYyoTf58aQ== 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 4Yycnq12dSz16bN; Wed, 19 Feb 2025 13:34:55 +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 51JDYtof062697; Wed, 19 Feb 2025 13:34:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51JDYtVa062694; Wed, 19 Feb 2025 13:34:55 GMT (envelope-from git) Date: Wed, 19 Feb 2025 13:34:55 GMT Message-Id: <202502191334.51JDYtVa062694@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: 86f2641b99f0 - main - pf: fix icmp-in-icmp handling with if-bound states 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: 86f2641b99f01eb8e8191c4435f22c17433b0c2f Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=86f2641b99f01eb8e8191c4435f22c17433b0c2f commit 86f2641b99f01eb8e8191c4435f22c17433b0c2f Author: Kristof Provost AuthorDate: 2025-02-19 12:28:33 +0000 Commit: Kristof Provost CommitDate: 2025-02-19 13:34:45 +0000 pf: fix icmp-in-icmp handling with if-bound states When we receive an ICMP packet containing another ICMP packet we look up the original ICMP state. This is done through a second struct pf_pdesc ('pd2'), containing relevant information (i.e. addresses, type, id, ..). pd2 did not contain the network interface ('kif'), leading to state lookup failures. This only affected if-bound mode, because floating states match all interfaces. Set kif in pd2. Extend the icmp.py:test_fragmentation_needed test case to use if-bound mode. It already checked that we handled icmp-in-icmp correctly. PR: 284866 MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 1 + tests/sys/netpfil/pf/icmp.py | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 9b1a2f6a1bac..e8b7a071a3c9 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7792,6 +7792,7 @@ pf_test_state_icmp(struct pf_kstate **state, struct pf_pdesc *pd, pd2.sidx = (pd->dir == PF_IN) ? 1 : 0; pd2.didx = (pd->dir == PF_IN) ? 0 : 1; pd2.m = pd->m; + pd2.kif = pd->kif; switch (pd->af) { #ifdef INET case AF_INET: diff --git a/tests/sys/netpfil/pf/icmp.py b/tests/sys/netpfil/pf/icmp.py index 6ab649f62be7..232c56a23dbf 100644 --- a/tests/sys/netpfil/pf/icmp.py +++ b/tests/sys/netpfil/pf/icmp.py @@ -53,6 +53,7 @@ class TestICMP(VnetTestTemplate): ToolsHelper.print_output("/sbin/pfctl -e") ToolsHelper.pf_rules([ "set reassemble yes", + "set state-policy if-bound", "block", "pass inet proto icmp icmp-type echoreq", ])