diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-05-23 17:22:53 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-05-23 17:40:19 +0200 |
commit | 6aaaa63519c88c872f15dcc639643103b563b1c6 (patch) | |
tree | cbb3164de6d0b746727b54aec212168b8467f379 /filter | |
parent | 0705a1c5658c2682c915007f466f55d2a8f7ec14 (diff) |
Change parser to handle numbers as unsigned
Lexer always parsed numbers as unsigned, but parser handled them as
signed and grammar contained many unnecessary checks for negativity.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/config.Y | 4 | ||||
-rw-r--r-- | filter/filter.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/filter/config.Y b/filter/config.Y index 2864d290..a64bb932 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -728,8 +728,8 @@ fprefix: | net_ip_ '-' { $$.net = $1; $$.lo = 0; $$.hi = $1.pxlen; } | net_ip_ '{' NUM ',' NUM '}' { $$.net = $1; $$.lo = $3; $$.hi = $5; - if ((0 > $3) || ($3 > $5) || ($5 > net_max_prefix_length[$1.type])) - cf_error("Invalid prefix pattern range: {%d, %d}", $3, $5); + if (($3 > $5) || ($5 > net_max_prefix_length[$1.type])) + cf_error("Invalid prefix pattern range: {%u, %u}", $3, $5); } ; diff --git a/filter/filter.h b/filter/filter.h index 0beac679..6c81b9bc 100644 --- a/filter/filter.h +++ b/filter/filter.h @@ -19,11 +19,11 @@ struct f_inst { /* Instruction */ u16 code; /* Instruction code, see the interpret() function and P() macro */ u16 aux; /* Extension to instruction code, T_*, EA_*, EAF_* */ union { - int i; + uint i; void *p; } a1; /* The first argument */ union { - int i; + uint i; void *p; } a2; /* The second argument */ int lineno; |