From 6aaaa63519c88c872f15dcc639643103b563b1c6 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 23 May 2017 17:22:53 +0200 Subject: 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. --- nest/config.Y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nest') diff --git a/nest/config.Y b/nest/config.Y index e672d730..220fa8b0 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -349,8 +349,8 @@ iface_patt: ; tos: - CLASS expr { $$ = $2 & 0xfc; if (($2 < 0) || ($2 > 255)) cf_error("TX class must be in range 0-255"); } - | DSCP expr { $$ = ($2 & 0x3f) << 2; if (($2 < 0) || ($2 > 63)) cf_error("TX DSCP must be in range 0-63"); } + CLASS expr { $$ = $2 & 0xfc; if ($2 > 255) cf_error("TX class must be in range 0-255"); } + | DSCP expr { $$ = ($2 & 0x3f) << 2; if ($2 > 63) cf_error("TX DSCP must be in range 0-63"); } ; /* Direct device route protocol */ -- cgit v1.2.3