From nobody Thu Sep 19 20:21:23 2024 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 4X8n3R492zz5XKsK; Thu, 19 Sep 2024 20:21:23 +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 4X8n3R2qFBz4Wtp; Thu, 19 Sep 2024 20:21:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726777283; 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=J5Y9QDfyL+VWoeXNdr3aBqWEhepwZ+CtNxlPwDb/+mk=; b=xfDLiZsVGCY0yEcQ2OG4cXzZmIfyvvVJDG2rG3X1WfFEaORiXrVWrkaNytRfYvvwWL2jrV i5QPYpIIfaahvb/8LirlKYK5KqbNJE3qjVVa2xywG21R6o0oD+TMEFwp1Tab0fXHkIwF2n voMzmiby81VG+ebHQkViDFr/+S7ArYpAVCm7W6cSUOc9bjxUaI/RvJBL941broPBTquQzA zdwhoKKWer21h+UxZK0mw4F9MW26q4ypzjszrAxJtrvao2WR73zSHWb+pDvHsyO+VWZf/S Tk4Vz4cD9F7n3Njws4vzsb0B2BP25O5y/LT38OLobMwDFl24u9sDVwAmtf/udA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726777283; a=rsa-sha256; cv=none; b=qXp2leEOo3FyKlRRbuGh3dKTsiq7QFq8vzLC/XE2zDGRUXN9dk9t7vruMOogG/Xn2kdUo/ Iq5MGI6aV0BqzsTpCSvySCbbj0W2aRrZ/Jbf6rjrPoL7A3WtseZRfxx0xrCzkmZiw/39tE SzIPWmLILEjPtwTf+SlM8xQkG5yuO/gXE9Y+qNNH4602oxaXlthp+LwT0eJH9O+yqdf2rv yTlOtd4QVWEjkbvjusy2Lfutxv7I07bnWxh/R9M3QPjICTkmtz+E1aDphYdcxxdt66HoMD sZtqawnqa7ctOBlAWySVt/9Rj3rHp9BLUkfDb56IRUoYgc77fQQzQyOMMCCGjA== 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=1726777283; 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=J5Y9QDfyL+VWoeXNdr3aBqWEhepwZ+CtNxlPwDb/+mk=; b=OrN7HSltiO6N9buEaEiwu4YXYo8uHXV0ZlE6U2o4uN5j8RijYxwP/s1+fxwAGwtkg8P2jo XBEWD8MLP5zMQUrfaqIA8A1HU755+utdO+9OI2zdccYLmzdKsBOypgw/hV4LXLrc6CIIlN ZscCICZtnWKeLUr8PEONRbhsPByVeui6H3BeBnN5NlvqOSnRCwEonpyGyEj291pL+ps35l Mfi1oPJDVttNT50JKE+57w/6QqBuQ7sktVRF84uKtCkKT4C4cakHF/xjmo3Ax0wbK1hQIa ef+0+QsBU2NuB2W5cwzEktydb6QZmpW1kSrj+CgJbJILL2ieq0sjFNzyIk7vkw== 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 4X8n3R2PtRzKjF; Thu, 19 Sep 2024 20:21:23 +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 48JKLN6s046591; Thu, 19 Sep 2024 20:21:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48JKLN9q046588; Thu, 19 Sep 2024 20:21:23 GMT (envelope-from git) Date: Thu, 19 Sep 2024 20:21:23 GMT Message-Id: <202409192021.48JKLN9q046588@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: 5130165be136 - main - pf: remove redundant checks 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: 5130165be13684e97125a96763f7c930cae53a2d Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5130165be13684e97125a96763f7c930cae53a2d commit 5130165be13684e97125a96763f7c930cae53a2d Author: Kristof Provost AuthorDate: 2024-09-04 14:43:08 +0000 Commit: Kristof Provost CommitDate: 2024-09-19 20:20:14 +0000 pf: remove redundant checks pf_test() and pf_test6() drop IPv4-ICMP6 and IPv6-ICMP packets. Do not do the same check in pf_test_rule() again. ok henning Reviewed by: zlei Obtained from: OpenBSD, bluhm , de5c2bfb74 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46591 --- sys/netpfil/pf/pf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 2544045c5bbb..b0e857e55deb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4920,8 +4920,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, struct pfi_kkif *kif, break; #ifdef INET case IPPROTO_ICMP: - if (pd->af != AF_INET) - break; + MPASS(af == AF_INET); icmptype = pd->hdr.icmp.icmp_type; icmpcode = pd->hdr.icmp.icmp_code; state_icmp = pf_icmp_mapping(pd, icmptype, @@ -4937,8 +4936,7 @@ pf_test_rule(struct pf_krule **rm, struct pf_kstate **sm, struct pfi_kkif *kif, #endif /* INET */ #ifdef INET6 case IPPROTO_ICMPV6: - if (af != AF_INET6) - break; + MPASS(af == AF_INET6); icmptype = pd->hdr.icmp6.icmp6_type; icmpcode = pd->hdr.icmp6.icmp6_code; state_icmp = pf_icmp_mapping(pd, icmptype,