The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=80eb861dc2a7960e1acc74796cf0c937472a5dba

commit 80eb861dc2a7960e1acc74796cf0c937472a5dba
Author:     Kristof Provost <k...@freebsd.org>
AuthorDate: 2024-08-29 10:08:32 +0000
Commit:     Kristof Provost <k...@freebsd.org>
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 <dera...@openbsd.org>, 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 <v.string>              STRING
 %token <v.number>              NUMBER
 %token <v.i>                   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 '-':

Reply via email to