summaryrefslogtreecommitdiff
path: root/sbin/pfctl/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/pfctl/parse.y')
-rw-r--r--sbin/pfctl/parse.y35
1 files changed, 17 insertions, 18 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index 4418a04c8e8..0200ac224b8 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.529 2007/10/16 06:06:49 deraadt Exp $ */
+/* $OpenBSD: parse.y,v 1.530 2007/10/16 19:20:27 mpf Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
@@ -435,7 +435,7 @@ typedef struct {
%token <v.number> NUMBER
%token <v.i> PORTBINARY
%type <v.interface> interface if_list if_item_not if_item
-%type <v.number> number icmptype icmp6type uid gid
+%type <v.number> icmptype icmp6type uid gid
%type <v.number> tos not yesno
%type <v.i> no dir af fragcache optimizer
%type <v.i> sourcetrack flush unaryop statelock
@@ -576,7 +576,7 @@ option : SET OPTIMIZATION STRING {
}
free($3);
}
- | SET HOSTID number {
+ | SET HOSTID NUMBER {
if ($3 == 0 || $3 > UINT_MAX) {
yyerror("hostid must be non-zero");
YYERROR;
@@ -681,6 +681,19 @@ varset : STRING '=' string {
free($1);
free($3);
}
+ | STRING '=' NUMBER {
+ char *s;
+ if (asprintf(&s, "%lld", $3) == -1) {
+ yyerror("string: asprintf");
+ YYERROR;
+ }
+ if (pf->opts & PF_OPT_VERBOSE)
+ printf("%s = \"%s\"\n", $1, s);
+ if (symset($1, s, 0) == -1)
+ err(1, "cannot store variable %s", $1);
+ free($1);
+ free(s);
+ }
;
anchorname : STRING { $$ = $1; }
@@ -2697,20 +2710,6 @@ host : STRING {
}
;
-number : NUMBER
- | STRING {
- u_long ulval;
-
- if (atoul($1, &ulval) == -1) {
- yyerror("%s is not a number", $1);
- free($1);
- YYERROR;
- } else
- $$ = ulval;
- free($1);
- }
- ;
-
dynaddr : '(' STRING ')' {
int flags = 0;
char *p, *op;
@@ -5371,7 +5370,7 @@ top:
}
#define allowed_to_end_number(x) \
- (isspace(x) || x == ')' || x ==',' || x == '/' || x == '}')
+ (isspace(x) || x == ')' || x ==',' || x == '/' || x == '}' || x == '=')
if (c == '-' || isdigit(c)) {
do {