From nobody Mon Oct 2 09:33:29 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 4RzbNn5Nd4z4vr17; Mon, 2 Oct 2023 09:33:29 +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 4RzbNn3knRz4Snf; Mon, 2 Oct 2023 09:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696239209; 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=PBmj+e9Vs71rCMw+1lcyLQ8SZDGYMrVAIdEDg0t3/68=; b=BbApTQI4WpwLpeIsEVuV55EkwkG+ZXNQ9D2M0rzVpwYmDPBbkZzLtfa6iBmKPWST9eIXpN RzigEUdfiu3+nN5UBwFq5wTkGX6eP+pDrZzacvtf6WQ+xvOgjWJytO6lvPy1EbgkR4E/Dx 4rtveTBdMwuzyizYhC1qdK5wzPUv3oKEAQKxhxxjdxLJNNWKBAKRgMijZcQ9+NppAbIvKd JpVlAhlgChm9QOh4ymK7X+cXr3sR1a9eZrtGEYqlWZiIShyd3tELy0/nC4myOLom7kZqvK 1R9fc8f4v/wIvkBFqkZAAl+ruhdmTPbx1bTpmQJ/a5RovY1heLUkC+nmsCZIqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696239209; a=rsa-sha256; cv=none; b=hUggAuTXMzoSD+0/huQNsC3B3Qbhi8/BRRKa6l56FJuk3MeY2O59L/ipDnSFtJ/mzx6Mcy dTLT65Z8KupqGPLTG2Hk3dSFyC+9QaONJArd4YUrXqOPniJVKM+J6SNWdM6db7y3xfVG+I 9ju3n9/+F3KPQa+BSJihBSxXwZLdDtzIJCMinjPU6UtGipa9brFkOh24NyPCk4xyM1BU39 R0oHyH5Tjbzyn32b/FxgLGdEZUc2zTDxTqrp7NehfLArYjM3F0IkXnGDzeKzD4DmACTjE7 8jZwGJT/hv3qYSUTiXjr0iOPAB5cD9EgDsKa366e9Pby/16IekmbJm8mjpGLEA== 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=1696239209; 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=PBmj+e9Vs71rCMw+1lcyLQ8SZDGYMrVAIdEDg0t3/68=; b=Vauksy6Mh7qobAspwhnQNIHibZr2LfN3K655zZqnpbbflG99a2SAzFqKirL+kTLLe4L1ZD fXZidR9Aq/ijXYjqdaTLRfsbM3vXcYdBwgm6r1xhiTsw9k4f6N5DsaYXGGFLT/S4vAuLKF v4CPfOPBLO3Z0zM1fL4pxmmL85hLifdtEhxGHvrncd4WRTaWeFRTqgIENUzM9WTdEuRcQc Yrfw393i+0DGLvxnOsQiaMQ4oNpEHjgDsy/nctoq7LVwlq0aUj0a+GvmGQJyXdYin694yY JvgqzIKFgeX8gXKsFHSIcWO2dlavTPNinnfeduRqvLUl7o87SCj7zrHGcEtWew== 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 4RzbNn1yX2z15xV; Mon, 2 Oct 2023 09:33:29 +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 3929XTk1003336; Mon, 2 Oct 2023 09:33:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3929XTHP003326; Mon, 2 Oct 2023 09:33:29 GMT (envelope-from git) Date: Mon, 2 Oct 2023 09:33:29 GMT Message-Id: <202310020933.3929XTHP003326@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: bcad901cbfda - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: bcad901cbfda785298740cf6e0271b874d348503 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bcad901cbfda785298740cf6e0271b874d348503 commit bcad901cbfda785298740cf6e0271b874d348503 Author: Kristof Provost AuthorDate: 2023-09-28 07:04:32 +0000 Commit: Kristof Provost CommitDate: 2023-10-02 09:32:14 +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 6a8ba7be56cf..9e6cd7fae492 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -7698,6 +7698,9 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, pd.af = AF_INET; pd.act.rtableid = -1; + 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); @@ -8249,6 +8252,9 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb pd.af = AF_INET6; pd.act.rtableid = -1; + 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, kif, &reason, &pd) != PF_PASS) { action = PF_DROP; @@ -8256,6 +8262,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 @@ -8272,7 +8279,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) {