diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2001-07-19 00:07:37 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2001-07-19 00:07:37 +0000 |
commit | e1c819f338002cec66ce0002674d4b7a4088dc34 (patch) | |
tree | 25cf5aecde51e3b30da5036aea80e751c73a4d5d /sbin | |
parent | 98b80c7797b582df6365b850c28316e3c19af865 (diff) |
Fix/complete the handling of the binary ops >< and <> to behave
like the ipf operators.
The 'n >< m' construct (Include Range = PF_OP_IRG) should match
ports greater than n and less than m, not greater than or equal to
n and less than or equal to m.
The 'n <> m' construct (Exclude Range = PF_OP_XRG) should match
all ports less than n OR greater than m, not be treated as an
alias for ><.
Thus PF_OP_GL, which was used for both <> and >< is replaced with
PF_OP_IRG and PF_OP_XRG with the 'correct' semantics.
OK dhartmei@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/parse.y | 6 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 6 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 5c4f9a167ce..221c0705ae7 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.14 2001/07/18 09:53:14 markus Exp $ */ +/* $OpenBSD: parse.y,v 1.15 2001/07/19 00:07:36 krw Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -658,7 +658,7 @@ yylex(void) case '<': next = getc(fin); if (next == '>') { - yylval.i = PF_OP_GL; + yylval.i = PF_OP_XRG; return (PORTBINARY); } else if (next == '=') { yylval.i = PF_OP_LE; @@ -671,7 +671,7 @@ yylex(void) case '>': next = getc(fin); if (next == '<') { - yylval.i = PF_OP_GL; + yylval.i = PF_OP_IRG; return (PORTBINARY); } else if (next == '=') { yylval.i = PF_OP_GE; diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 8fddc92b36e..f9f4266eb92 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.38 2001/07/17 23:25:42 provos Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.39 2001/07/19 00:07:36 krw Exp $ */ /* * Copyright (c) 2001, Daniel Hartmeier @@ -199,8 +199,10 @@ print_port(u_int8_t op, u_int16_t p1, u_int16_t p2, char *proto) p1 = ntohs(p1); p2 = ntohs(p2); printf("port "); - if (op == PF_OP_GL) + if (op == PF_OP_IRG) printf("%u >< %u ", p1, p2); + else if (op == PF_OP_XRG) + printf("%u <> %u ", p1, p2); else if (op == PF_OP_EQ) { if (s != NULL) printf("= %s ", s->s_name); |