From nobody Mon Oct 02 09:33:30 2023 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 4RzbNp5MMWz4vrNJ; Mon, 2 Oct 2023 09:33:30 +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 4RzbNp3gJNz4ScJ; Mon, 2 Oct 2023 09:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696239210; 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=S6wojtKVYg9yT4QP6OLLJPVaHnInUN9D1btF0J4fXG0=; b=r7mjATav3+vkqS5LH3WS98r6C8VAV7p5HbZBFhaFIGLkffw9NE+PmTjQwADbd0eNrhUPwa pksT0lpT/S4JQaCBBCbin23i9YL6UYks7EeOoP2FCjqLmvarPp/yjj7EkfmIku9ZCg+B6j xuRV8XkXqsNlsI8N5wATeAjX9hSI/JLMbWISj3TVb9nU00eaz0eYg643V4zSg8zBwSq/p3 72j6btqRcX08/g1gM4jDtoBmpj+SszF1yjT+9OFVH+YIAnpjHQAU5cXJ3W4WCMcMbqIZNr PIUshYiI6SntiG2Oy6LLVEYmwrCNmYat9GwWpF+E4jQMxGmgBiBNCtxRdXjNig== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696239210; a=rsa-sha256; cv=none; b=k6miQubbD2WrqRZ1l/exbBjLAj8BCxGwrXTAZi+tzgtLXVI9kejSjrXc6BlMdhW5N7U2pG ywqpc+Tdle+JMr/UmQR2LDMer8Ck9hVx4VBiq/wq6il+UqXP9rNiW/y7sMffiwiQ+uzP4B qmtSo6yFOsAxAgkgsrjZXGM5y1wxrBvS/caB2iC0GhoK9oSMCxOgKwcvfC2/WVrBPyX+ib DYXH0/8oq4hpRKSmzKwqD9zP4A1XluTTVHqBVxzLE5h9zebSyhwrbXgffC2EUijlaTK3k/ O0DQwti1l0yCtY8X8u3BmMMYFDXYYI5vAJHW/Or8R8afBALpwV6tlQ7dNVR2DQ== 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=1696239210; 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=S6wojtKVYg9yT4QP6OLLJPVaHnInUN9D1btF0J4fXG0=; b=s/Fo+Ai3Mt1rNv6dUPadqaFHFbzsAl0jAnw5HaiV/2vQ/s/loltspU5vXBk68pAUjudHfH M5wE2eVAo305NGTkEWGiyrk7zRa7VpE34ta+1cufjbmTRfELpYlVZaT1DbEom01bvZvpRi 8mhxsTgiwnujJUsjccHbEM1zb3FscEdy2PndOX7Von9GOLhZ2qjHaopgfAqg7VrLwytJqR 9c7mb80JfaXmtGRtCmMBJcxATnuQmK/s+SWeRuU3R9jTMipCFSZBvov+4c7RtbY8z1f5Hc IxPSl9/dOpBp0ysNv3jeh4mYD8z+rbux0mn84cmFkaq3AfPeomr27eh+BddG9A== 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 4RzbNp2mznz16YB; Mon, 2 Oct 2023 09:33:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3929XUD4003447; Mon, 2 Oct 2023 09:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3929XUuo003439; Mon, 2 Oct 2023 09:33:30 GMT (envelope-from git) Date: Mon, 2 Oct 2023 09:33:30 GMT Message-Id: <202310020933.3929XUuo003439@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: cf9e678c1a84 - stable/13 - pf: ensure 'off' is always set before use 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: cf9e678c1a8460531f42997de38c5639f6247194 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=cf9e678c1a8460531f42997de38c5639f6247194 commit cf9e678c1a8460531f42997de38c5639f6247194 Author: Kristof Provost AuthorDate: 2023-09-28 07:04:32 +0000 Commit: Kristof Provost CommitDate: 2023-10-02 08:51:44 +0000 pf: ensure 'off' is always set before use If we bail out early from pf_test(6)() we still need to clean up/finish SCTP multihome work, which requires the 'off' value to be set. Set it early enough. MFC after: 3 days Sponsored by: Orange Business Services (cherry picked from commit aefda9c92da6571d405e1b27c5c68333ad8bbc57) --- sys/netpfil/pf/pf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 55942fcf4338..5f94379d58fa 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6876,6 +6876,9 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb * PF_RULES_RLOCK(); + h = mtod(m, struct ip *); + off = h->ip_hl << 2; + if (__predict_false(ip_divert_ptr != NULL) && ((ipfwtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL)) != NULL)) { struct ipfw_rule_ref *rr = (struct ipfw_rule_ref *)(ipfwtag+1); @@ -7356,6 +7359,9 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb PF_RULES_RLOCK(); + h = mtod(m, struct ip6_hdr *); + off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr); + /* We do IP header normalization and packet reassembly here */ if (pf_normalize_ip6(m0, dir, kif, &reason, &pd) != PF_PASS) { action = PF_DROP; @@ -7363,6 +7369,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb } m = *m0; /* pf_normalize messes with m0 */ h = mtod(m, struct ip6_hdr *); + off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr); /* * we do not support jumbogram. if we keep going, zero ip6_plen @@ -7386,7 +7393,6 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb pd.tos = IPV6_DSCP(h); pd.tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr); - off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr); pd.proto = h->ip6_nxt; do { switch (pd.proto) {