From nobody Fri Sep 29 22:10:51 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 4Ry4L417Vlz4tl1H; Fri, 29 Sep 2023 22:10:52 +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 4Ry4L40gKPz3ZTd; Fri, 29 Sep 2023 22:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696025452; 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=h7M0K3UMbWXx/ZvSwnuN4fYlT87CGUxKDjnsVdZ8PQ8=; b=KX0r+kaOPU+MJ38p0QJvIYZ2do1iA2rt1hxPec7hb7dcxIOgu/+/ibyBUs2bHki0rPXY1I 16kDg04Tp7RiQa0iz8AiJLG0EcOVeHelyf7lBKkSEinwrnT4H88HFJXSXUqqj9rBBVqj5t uvRECM8aoL1p9qBhKnBliM5i+eyCw1gy7AhyQjH30JnUy/3QF278LNtftGB89Z03gAubfm w/EOOA32JjZFgydu6Qp0ChelPkP5WNVrVeBAKxxflnuWehLIbxjNGW9opi9hTZw1wJBS+8 n8Gt+FmIPWno9jE+102RNGuRL76nLlFE0QVfMkbAEwvCNqlgjo9cPxTVWKdWTg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696025452; a=rsa-sha256; cv=none; b=cOSCjHkpEQeZ919xYj3Sq3CIu9OYAvCGk9+tZDxfGDE3fkuT+FLZduOE98myc13C6KK1os FmZFM+k5j8Z56XN7/K26axt6ksMVMsJhXgcNgCP5XVFQEZU3zzmTsXYCkx+ehTDTHPMQze zDN3PGr/sn7YA3ezLaY9TzFmeBSaMuiUOMpUgxtijRKff34QEEEY0/YEkSp8rZj9kdNpQP p2MN3zI/NaVsbjt25oUsIBM/3ERv8Czw/eZsu/971s8Yu12G4i7vlB3he56FSR8anVN8Y0 DFFJhygB29fXysSWPd5QQicAw2kPXFjtlDW0dXBKwrs94pwm+8/2n0wyu/K4wQ== 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=1696025452; 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=h7M0K3UMbWXx/ZvSwnuN4fYlT87CGUxKDjnsVdZ8PQ8=; b=L5mjJa5b8OCahWCbuswymbwNDjt5X0+VawNvTaDg+0eK2Wm/rdWuKgggu3SUItl7AoZDpr PAZ+1IkAo9shGOesu3u9QSVnqDH9fWtelohku8/9XwZOJBztrXrQVU1ORIvTFNXC6adkNo EDNmnxHCm+aViQVjC0RQHTuFt8pCKeYI0bFyYY12xQHU9vEfxmHw5x6dDx6WRjHg2LJOYx kYa99lR997PABaDsFZeT24NpBgHDEhmxcyBd7npaHaBVSjdMpntqa3bIAeA2ouWDJZ0ZQe lsQT2AkJpVokZVsC5ApaeKmAO6w1E7sh+cySUwoV6fzS7QRgvoYHNrRuMEGUrA== 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 4Ry4L36rfsz6bF; Fri, 29 Sep 2023 22:10:51 +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 38TMApsg044876; Fri, 29 Sep 2023 22:10:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38TMApnC044873; Fri, 29 Sep 2023 22:10:51 GMT (envelope-from git) Date: Fri, 29 Sep 2023 22:10:51 GMT Message-Id: <202309292210.38TMApnC044873@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: aefda9c92da6 - main - 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/main X-Git-Reftype: branch X-Git-Commit: aefda9c92da6571d405e1b27c5c68333ad8bbc57 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=aefda9c92da6571d405e1b27c5c68333ad8bbc57 commit aefda9c92da6571d405e1b27c5c68333ad8bbc57 Author: Kristof Provost AuthorDate: 2023-09-28 07:04:32 +0000 Commit: Kristof Provost CommitDate: 2023-09-29 22:10:32 +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 --- 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 df4bd47c35d5..baa34b16f487 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) {