diff options
author | kp <kp@FreeBSD.org> | 2016-08-17 09:21:55 +0000 |
---|---|---|
committer | kp <kp@FreeBSD.org> | 2016-08-17 09:21:55 +0000 |
commit | a4a505a3644b1e237d64ebdb723521122359ee90 (patch) | |
tree | 0cf99a00ea0511324c81679778a281be9baef031 /sbin/pfctl | |
parent | fbc0cd19ec698697b97b26be85fdf1b2a33969a7 (diff) | |
download | FreeBSD-src-a4a505a3644b1e237d64ebdb723521122359ee90.zip FreeBSD-src-a4a505a3644b1e237d64ebdb723521122359ee90.tar.gz |
MFC r303663:
pfctl: Allow TOS bits to be cleared
TOS value 0 is valid, so use 256 as an invalid value rather than zero.
This allows users to enforce TOS == 0 with pf.
Reported by: Radek KrejĨa <radek.krejca@starnet.cz>
Diffstat (limited to 'sbin/pfctl')
-rw-r--r-- | sbin/pfctl/parse.y | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 56ccd11..e468a38 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -3517,8 +3517,8 @@ tos : STRING { else if ($1[0] == '0' && $1[1] == 'x') $$ = strtoul($1, NULL, 16); else - $$ = 0; /* flag bad argument */ - if (!$$ || $$ > 255) { + $$ = 256; /* flag bad argument */ + if ($$ < 0 || $$ > 255) { yyerror("illegal tos value %s", $1); free($1); YYERROR; @@ -3527,7 +3527,7 @@ tos : STRING { } | NUMBER { $$ = $1; - if (!$$ || $$ > 255) { + if ($$ < 0 || $$ > 255) { yyerror("illegal tos value %s", $1); YYERROR; } |