From nobody Mon Sep 16 13:05:28 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 4X6lWr5mSWz5Vxxh; Mon, 16 Sep 2024 13:05:28 +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 4X6lWr3ZGYz54XH; Mon, 16 Sep 2024 13:05:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726491928; 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=7sJI8it8hDbXC67RwcluUtRGrw6qTzuapMYBJbiKChI=; b=Ez9BpH4NsQugI1OZtY+oAuQtHtF5x8dRS+6CTPT93Ohlc3Bscj1iVjjB2XkbmiIFoGAnOm 7I/4Yk9lWe7IBw+3ye92vfMjUdSlLw/ojZJaVTmrWgGYh+LXZOlbu0/0Go9FyuLGT47qNi JiNksrxyDwHLwL86VpCuQGVM65qUk1j7h1Jmc4g5+FxJsM2VPKX3s9tUx8pO73iFc2WGcR LNnu5SZuJ4QQ+iXopIzXN/LorUarCradsn5z2Ku810/U2Rgvr68Yq2QFffi3MiqcNxiWb5 7MfUiNBYMWUvt49TzO3LSmefMkC9dujZ6QpHBBgd8jYIu54i0z8P0u0moTQeVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726491928; a=rsa-sha256; cv=none; b=vfUsqhZvXt++vWJjIRCp8sq42jFkDpzrPnhj2XuZ1/W3vkVtNUyDjmUEU9OUIkbewhrLNE R+S0fNVQGCCkK9+uvss6oP23QFnLWABSnGNRNYV03lbs1jvBm3bGcCyl+tlH2xYOTK/A1k /Qkyr/BE0+5si44gZ6vxnhy/WhfhYSqNEwWc96ySd7JSAAUQjJP2NXNZ4/XEymdYjgRilw U32ylxzXmjnwyLCgXRFaUaKpALhWTfE6GDyIjuDq0dJooEeNhf06ShiQ4te6kKf7GtgxLl MNheNRmXCCLKZrR8R78+Jj4MkN3m3Qmny4Dk6MjkWd71KD+kk7KB6YMjx4EhbQ== 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=1726491928; 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=7sJI8it8hDbXC67RwcluUtRGrw6qTzuapMYBJbiKChI=; b=GWtersxNtDn9v9ffD7rT2IlNuGJpaMJLNBLjOVEs1voaQk7FBeRO+uD2o8H2EbKFmdLcXs a8mfYWJqYtRl2ayf5MmMJ7BrczN6Vknz70bbXwD+KLcwHkDw6K+1kpxH3eVO772plK/CvL NuOn3jNUdXpb0laARP9lAzw0QXZY0+dvIMq+d3b2KU5TxLu8xQ8euWVxS03wj/8iyRqW76 Ha4PBosxpU121TDh1PjmQrpEY/pxt2aZr62Rk+0IrXpMmP/Cvp7U2Ti1CvW0y+oNnctELP GwQqFcXpXLRyUBnIkMXhpRyWM8CwmFKH5lJ2ps6xxAbEoX2Q51o5KVIzW9W/rw== 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 4X6lWr0t1PzwFn; Mon, 16 Sep 2024 13:05:28 +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 48GD5S3d020941; Mon, 16 Sep 2024 13:05:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48GD5SMG020938; Mon, 16 Sep 2024 13:05:28 GMT (envelope-from git) Date: Mon, 16 Sep 2024 13:05:28 GMT Message-Id: <202409161305.48GD5SMG020938@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: 80eb861dc2a7 - main - pfctl: lex <=, >=, and != into a single token 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: 80eb861dc2a7960e1acc74796cf0c937472a5dba Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=80eb861dc2a7960e1acc74796cf0c937472a5dba commit 80eb861dc2a7960e1acc74796cf0c937472a5dba Author: Kristof Provost AuthorDate: 2024-08-29 10:08:32 +0000 Commit: Kristof Provost CommitDate: 2024-09-16 11:48:58 +0000 pfctl: lex <=, >=, and != into a single token lex <=, >=, and != into a single token for correctness and to reduce the lookahead in the parser ok henning otto Reviewed by: zlei Obtained from: OpenBSD, deraadt , e6e3ecf338 Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46582 --- sbin/pfctl/parse.y | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 55b5310b61e3..cfa6c85b5c0a 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -517,7 +517,7 @@ int parseport(char *, struct range *r, int); %token STICKYADDRESS ENDPI MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY PFLOW %token TAGGED TAG IFBOUND FLOATING STATEPOLICY STATEDEFAULTS ROUTE SETTOS -%token DIVERTTO DIVERTREPLY BRIDGE_TO RECEIVEDON +%token DIVERTTO DIVERTREPLY BRIDGE_TO RECEIVEDON NE LE GE %token STRING %token NUMBER %token PORTBINARY @@ -5249,10 +5249,10 @@ yesno : NO { $$ = 0; } ; unaryop : '=' { $$ = PF_OP_EQ; } - | '!' '=' { $$ = PF_OP_NE; } - | '<' '=' { $$ = PF_OP_LE; } + | NE { $$ = PF_OP_NE; } + | LE { $$ = PF_OP_LE; } | '<' { $$ = PF_OP_LT; } - | '>' '=' { $$ = PF_OP_GE; } + | GE { $$ = PF_OP_GE; } | '>' { $$ = PF_OP_GT; } ; @@ -6630,12 +6630,19 @@ top: if (yylval.v.string == NULL) err(1, "yylex: strdup"); return (STRING); + case '!': + next = lgetc(0); + if (next == '=') + return (NE); + lungetc(next); + break; case '<': next = lgetc(0); if (next == '>') { yylval.v.i = PF_OP_XRG; return (PORTBINARY); - } + } else if (next == '=') + return (LE); lungetc(next); break; case '>': @@ -6643,7 +6650,8 @@ top: if (next == '<') { yylval.v.i = PF_OP_IRG; return (PORTBINARY); - } + } else if (next == '=') + return (GE); lungetc(next); break; case '-':