summaryrefslogtreecommitdiffstats
path: root/sbin/pfctl
diff options
context:
space:
mode:
authorkp <kp@FreeBSD.org>2016-08-17 09:21:55 +0000
committerkp <kp@FreeBSD.org>2016-08-17 09:21:55 +0000
commita4a505a3644b1e237d64ebdb723521122359ee90 (patch)
tree0cf99a00ea0511324c81679778a281be9baef031 /sbin/pfctl
parentfbc0cd19ec698697b97b26be85fdf1b2a33969a7 (diff)
downloadFreeBSD-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.y6
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;
}
OpenPOWER on IntegriCloud