From nobody Mon Sep 16 13:05:25 2024 X-Original-To: dev-commits-src-main@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 4X6lWp1ZWwz5Vy1q; Mon, 16 Sep 2024 13:05:26 +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 4X6lWp05xNz54B3; Mon, 16 Sep 2024 13:05:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726491926; 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=CeHqDoPrHLp/pneRuGGZJtgkHE697XhN2GsVYxQzFv0=; b=fh4FYcor0FFj2jNMDGVnMhWTYOcnjDsVZyx8MFMQJGt94QfDhVF3nTtU102Ee8Bm8oTdGc +sZf/oGBAtbjK4/GYd51IKqMP4wsiXDEUuA1SI5tUh5TkU1zK94wq41iBLfr+k/OD2XURE q0Tgcw2Shln6VnI67bdgleMgSdS6jIzI9qyAPklvFMJjjpHmFo6z1Z8RuFnO5Utb4hsDJ0 /SZn1bwLNzIE//pPQB+6W2Zi+0VFIWBJlK44GyuZ1niKErxapiwKBXLkcNAU3LztuxVy+G GU9H/zZ/W6UtoEC7bBsGzn+Fha0NXQXgJb+eo4qmOtOEx44pHICUATFQakIweg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726491926; a=rsa-sha256; cv=none; b=QpnNLYF90pRfW93f/7XLl5CBYQPa3t21m2UcfMid97BhOK0noxYebmuqItie1rEOyTG7T3 lpROZ+lRJTh0tJWgR/V+PcUboXvwtv+Kn8xuxynBUY6H6occ6Ncs1SOvr/w2bYBGeFok7U jMtvMz4PnOqG1o8hXjO+VLSB6IZgvBVay1MK7tZ/EcnSrB7SAJnnK+6CRnyTFslezRcbPu D/YKQfTfiK1v+83idw6B3v3MG4hkzpjg8xq8XuRsXTik0Zd8orPqkEyK8Pk6Y/dlGW44XK HsshMps5Vl7jnCuC2cMB1dyNGZXJHUys/ChBYjCjUfuGmY9gjAqekw6iKuJ7YA== 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=1726491926; 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=CeHqDoPrHLp/pneRuGGZJtgkHE697XhN2GsVYxQzFv0=; b=UMLBVxshLuDLp5OGlDD+92pwmeHtgwvJi+4pzF5Dpx/Nxd53pqEp6wBSuSpBF3/kRFmkxL 2AbsQIQ6nKAa1BoYkQ0ojaA0ln8UnkLPNfjSFefCav9hehEEu8ounJRQT7OvDj/AVb/qKN F+kVLenBOfB8RFVesfsMziLdBvMl0ExA3oq5+vqO3oMNwHJ8ygUhVu6C/IOqgUFQ59g10+ 0Zn5a5G26oTmU6SAoLg2TPRGj77Pt0dKkkj/rncLHiL2+dZKnQAxdpIjd3lilOcT/HmqYf uSZ9OfNUy6s8hWIL/XN0ntpjbmUa9zCXvMVuy/9Tf/sg0mzcpO8sR5+5TMbwfQ== 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 4X6lWn6FZWzwVk; Mon, 16 Sep 2024 13:05:25 +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 48GD5PWa020827; Mon, 16 Sep 2024 13:05:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48GD5Pho020824; Mon, 16 Sep 2024 13:05:25 GMT (envelope-from git) Date: Mon, 16 Sep 2024 13:05:25 GMT Message-Id: <202409161305.48GD5Pho020824@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: 637d81c52d21 - main - pfctl: fix incorrect optimization List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 637d81c52d2153fabbc72e2644199176e1042ab5 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=637d81c52d2153fabbc72e2644199176e1042ab5 commit 637d81c52d2153fabbc72e2644199176e1042ab5 Author: Kristof Provost AuthorDate: 2024-08-29 10:02:51 +0000 Commit: Kristof Provost CommitDate: 2024-09-16 11:48:49 +0000 pfctl: fix incorrect optimization In the non-optimized case, an address list containing "any" (ie. { any 10.0.0.1 }) should be folded in the parser to any, not to 10.0.0.1. How long this bug has been with us is unclear. ok guenther mcbride Obtained from: OpenBSD, deraadt , e3b4bc25a0 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46580 --- sbin/pfctl/parse.y | 14 +++++++++++--- sbin/pfctl/pfctl_parser.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 0c551d2ef49f..55b5310b61e3 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -3572,11 +3572,13 @@ toipspec : TO ipspec { $$ = $2; } host_list : ipspec optnl { $$ = $1; } | host_list comma ipspec optnl { - if ($3 == NULL) + if ($1 == NULL) { + freehostlist($3); $$ = $1; - else if ($1 == NULL) + } else if ($3 == NULL) { + freehostlist($1); $$ = $3; - else { + } else { $1->tail->next = $3; $1->tail = $3->tail; $$ = $1; @@ -6270,6 +6272,12 @@ expand_skip_interface(struct node_if *interfaces) return (0); } +void +freehostlist(struct node_host *h) +{ + FREE_LIST(struct node_host, h); +} + #undef FREE_LIST #undef LOOP_THROUGH diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 6de998b34e52..550005508f40 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -137,6 +137,8 @@ struct node_host { struct node_host *tail; }; +void freehostlist(struct node_host *); + struct node_mac { u_int8_t mac[ETHER_ADDR_LEN]; u_int8_t mask[ETHER_ADDR_LEN];