Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/npf/npfctl Simplify slightly: merge iface into addr...
details: https://anonhg.NetBSD.org/src/rev/201da430e95b
branches: trunk
changeset: 777633:201da430e95b
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Feb 26 21:14:50 2012 +0000
description:
Simplify slightly: merge iface into addr_or_iface, use it in filt_addr.
diffstat:
usr.sbin/npf/npfctl/npf_parse.y | 69 +++++++++++++++++++---------------------
1 files changed, 32 insertions(+), 37 deletions(-)
diffs (104 lines):
diff -r 1a0b821640b4 -r 201da430e95b usr.sbin/npf/npfctl/npf_parse.y
--- a/usr.sbin/npf/npfctl/npf_parse.y Sun Feb 26 21:06:59 2012 +0000
+++ b/usr.sbin/npf/npfctl/npf_parse.y Sun Feb 26 21:14:50 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf_parse.y,v 1.3 2012/01/15 00:49:48 rmind Exp $ */
+/* $NetBSD: npf_parse.y,v 1.4 2012/02/26 21:14:50 rmind Exp $ */
/*-
* Copyright (c) 2011-2012 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
%type <num> ifindex, port, opt_quick, on_iface
%type <num> block_or_pass, rule_dir, block_opts, family, opt_family
%type <num> opt_keep_state, icmp_type, table_type
-%type <var> addr_or_iface, port_range, iface, icmp_type_and_code
+%type <var> addr_or_iface, port_range, icmp_type_and_code
%type <var> filt_addr, addr_and_mask, tcp_flags, tcp_flags_and_mask
%type <var> modulearg_opts, procs, proc_op, modulearg, moduleargs
%type <filtopts> filt_opts, all_or_filt_opts
@@ -536,10 +536,9 @@
;
filt_addr
- : iface { $$ = $1; }
- | addr_and_mask { $$ = $1; }
- | TABLE_ID { $$ = npfctl_parse_table_id($1); }
- | ANY { $$ = NULL; }
+ : addr_or_iface { $$ = $1; }
+ | TABLE_ID { $$ = npfctl_parse_table_id($1); }
+ | ANY { $$ = NULL; }
;
addr_and_mask
@@ -563,7 +562,33 @@
addr_or_iface
: addr_and_mask { assert($1 != NULL); $$ = $1; }
- | iface { assert($1 != NULL); $$ = $1; }
+ | iface_name
+ {
+ $$ = npfctl_parse_iface($1);
+ }
+ | VAR_ID
+ {
+ npfvar_t *vp = npfvar_lookup($1);
+ const int type = npfvar_get_type(vp);
+
+ switch (type) {
+ case NPFVAR_VAR_ID:
+ case NPFVAR_STRING:
+ $$ = npfctl_parse_iface(npfvar_expand_string(vp));
+ break;
+ case NPFVAR_FAM:
+ $$ = vp;
+ break;
+ case -1:
+ yyerror("undefined variable '%s' for interface", $1);
+ break;
+ default:
+ yyerror("wrong variable '%s' type '%s' or interface",
+ $1, npfvar_type(type));
+ $$ = NULL;
+ break;
+ }
+ }
;
addr
@@ -650,36 +675,6 @@
}
;
-iface
- : iface_name
- {
- $$ = npfctl_parse_iface($1);
- }
- | VAR_ID
- {
- npfvar_t *vp = npfvar_lookup($1);
- const int type = npfvar_get_type(vp);
-
- switch (type) {
- case NPFVAR_VAR_ID:
- case NPFVAR_STRING:
- $$ = npfctl_parse_iface(npfvar_expand_string(vp));
- break;
- case NPFVAR_FAM:
- $$ = vp;
- break;
- case -1:
- yyerror("undefined variable '%s' for interface", $1);
- break;
- default:
- yyerror("wrong variable '%s' type '%s' or interface",
- $1, npfvar_type(type));
- $$ = NULL;
- break;
- }
- }
- ;
-
ifindex
: iface_name
{
Home |
Main Index |
Thread Index |
Old Index