From nobody Sat Jun 18 13:08:07 2022 X-Original-To: dev-commits-src-branches@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 23A0985CF57; Sat, 18 Jun 2022 13:08:08 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LQGRr0QSnz3M51; Sat, 18 Jun 2022 13:08:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655557688; 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=6Dasr+FmqOer/1Z+PNLugYwcxsShm8v5k86g7E9B6qA=; b=FkuEJPwpvmq2Ekb7JS57BSZJ4PaCm3LvfI9/bDiArJUpuHL/afEBFMtc5dUNP1fL6WfYTO TeVuJS6sT3u3i/u12AnP+7rB2wxV7BbiNLODGCe09YvRCo6H8ZI4MGrGBCKqT3TLBxR6od KTDLrMyDJ6Hq+bJA/0tKNQXlh5S+FeSxvMiV33FBJ89dj8gDyHXB+Z2lsA8Az39VQJbxSL TtdJfkpD8KRd74NvOoq3WhTZ4nI3Oi7kkulex0TaNsyK5rVF+9INK4cXlUBBmkbTrhKegc GqHBOE5POJZoIEo+/ED9DcMGjexUhltE58usU8uRStA8SbmsXK8WZlpGWkxlKQ== 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 E3AEF14C5F; Sat, 18 Jun 2022 13:08:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25ID87ER039503; Sat, 18 Jun 2022 13:08:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25ID873U039502; Sat, 18 Jun 2022 13:08:07 GMT (envelope-from git) Date: Sat, 18 Jun 2022 13:08:07 GMT Message-Id: <202206181308.25ID873U039502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 592b4f93632a - stable/12 - pf: Improve route-to handling of pfsync'd states List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/12 X-Git-Reftype: branch X-Git-Commit: 592b4f93632aa1e0bfd9f28ccfd4ab46ecc99bf4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655557688; 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=6Dasr+FmqOer/1Z+PNLugYwcxsShm8v5k86g7E9B6qA=; b=ER4I3AfwBPnQvIgeQ80tUF5fXGzjEmABZ3HwT+W6VQTSxHf1jEyylwXjpweDVKIgrbCfi+ 2NRjdzmIEFd3iQiEf7kkC/YQMZD8Lj/sgbyaJgIlkK9u0FHR6eJDUMj+xAdID1T6OvUvxt bwLtHmcyMLkZDYXckSF7C6eEWdTKveIhvFQrGJRntSwhHpuQcVLbcitAKnULlP3iqasY7c g79KMPssoE8hyGLYXHt/B5zjUWWo5QXCbYAIWO2A72sFEORnW2WCnjVP9l5NtNbfSwh1DZ M5Uj8EErYLhdsKSofl/2SSAS/syAO9c9C4NVWuFclPeSE7vOTkot99igI5ldJg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655557688; a=rsa-sha256; cv=none; b=i1dHMrC51RCNy/gvmldDJEo3BvFhO1bI5qlsYsH7u2o0/ykgD6kJkV36FnSbduUQzG6Kl5 w5H0TfqzYRNXxiM5tFse5Xb7WBybYr7Y8yfa+S5gGYSZPzR5FI6uYfHAmhflVr2AkxRm2q 6blJ6arx8bUt5T7Zv3q6bhyV8ievmlURFVcTrlMnVo0GP/BakIUc3FcOqsde6k6eKPNZug 9sr1+tH27Vo1vqKuyRa4Gk722a/fMNtnIf5QJjrNhfMtOR6JFqowObKQfijjB76YbHZH03 /fcapIyn9eT72sXHqUuncLyWP95fbry7bW29lDd8QTym66XQVXQP4FsREyK37g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=592b4f93632aa1e0bfd9f28ccfd4ab46ecc99bf4 commit 592b4f93632aa1e0bfd9f28ccfd4ab46ecc99bf4 Author: Kristof Provost AuthorDate: 2022-06-04 10:38:40 +0000 Commit: Kristof Provost CommitDate: 2022-06-18 07:29:56 +0000 pf: Improve route-to handling of pfsync'd states When a state if pfsync’d to a different host it doesn’t get all of the expected pointers, including the pointer to the struct pfi_kif / struct ifnet rt_kif pointer. (I.e. the interface to route out on). That in turn means that pf_route() ends up dropping the packet. Use the rule's struct pfi_kif pointer so we can still route out of the expected interface. MFC after: 2 weeks Sponsored by: Orange Business Services (cherry picked from commit 81ef217ad428c29be669aac2166d194db31817a7) --- sys/netpfil/pf/pf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 906a32fbac2d..452abcb5723a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6052,6 +6052,9 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; PF_STATE_UNLOCK(s); } + /* If pfsync'd */ + if (ifp == NULL) + ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; if (ifp == NULL) goto bad; @@ -6221,6 +6224,9 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, if (s) PF_STATE_UNLOCK(s); + /* If pfsync'd */ + if (ifp == NULL) + ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; if (ifp == NULL) goto bad;