diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2003-02-09 15:04:05 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2003-02-09 15:04:05 +0000 |
commit | 51477fac0e196083cf14a2f50e05b784e104aaf3 (patch) | |
tree | 93bbf9a8a70ae7fd731312684eeb71fddc6538a1 /sbin | |
parent | 05fcf8462bfad5ed71609b7dfe76343681470729 (diff) |
more live code from FOSDEM:
make
pass in proto tcp to port 80
work.
-allow to omit the "any" if you're specifying a port
-allow to omit the from or to part if you want "any" for the other
ok dhartmei@ pb@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/parse.y | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9d24d8df054..c7395aa41bf 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.311 2003/02/09 13:50:44 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.312 2003/02/09 15:04:04 henning Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -378,7 +378,7 @@ typedef struct { %type <v.icmp> icmp_list icmp_item %type <v.icmp> icmp6_list icmp6_item %type <v.fromto> fromto -%type <v.peer> ipportspec +%type <v.peer> ipportspec from to %type <v.host> ipspec xhost host address host_list %type <v.host> redir_host_list redirspec %type <v.host> route_host route_host_list routespec @@ -1477,21 +1477,33 @@ proto_item : STRING { } ; -fromto : /* empty */ { +fromto : ALL { $$.src.host = NULL; $$.src.port = NULL; $$.dst.host = NULL; $$.dst.port = NULL; } - | ALL { - $$.src.host = NULL; - $$.src.port = NULL; - $$.dst.host = NULL; - $$.dst.port = NULL; + | from to { + $$.src = $1; + $$.dst = $2; } - | FROM ipportspec TO ipportspec { - $$.src = $2; - $$.dst = $4; + ; + +from : /* empty */ { + $$.host = NULL; + $$.port = NULL; + } + | FROM ipportspec { + $$ = $2; + } + ; + +to : /* empty */ { + $$.host = NULL; + $$.port = NULL; + } + | TO ipportspec { + $$ = $2; } ; @@ -1500,6 +1512,10 @@ ipportspec : ipspec { $$.host = $1; $$.port = NULL; } $$.host = $1; $$.port = $3; } + | PORT portspec { + $$.host = NULL; + $$.port = $2; + } ; ipspec : ANY { $$ = NULL; } |