summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkp <kp@FreeBSD.org>2016-08-17 09:20:35 +0000
committerkp <kp@FreeBSD.org>2016-08-17 09:20:35 +0000
commit471a2ade16670fd53873bb44aa263c1d58a6f513 (patch)
tree21b2efd1dc8fa1b6cc84714ff14425c5971ec5b2
parentbcb305f89d605e610c5188a3ca611fa1f3c767d9 (diff)
downloadFreeBSD-src-471a2ade16670fd53873bb44aa263c1d58a6f513.zip
FreeBSD-src-471a2ade16670fd53873bb44aa263c1d58a6f513.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>
-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 5ef70de..934037c 100644
--- a/sbin/pfctl/parse.y
+++ b/sbin/pfctl/parse.y
@@ -3593,8 +3593,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;
@@ -3603,7 +3603,7 @@ tos : STRING {
}
| NUMBER {
$$ = $1;
- if (!$$ || $$ > 255) {
+ if ($$ < 0 || $$ > 255) {
yyerror("illegal tos value %s", $1);
YYERROR;
}
OpenPOWER on IntegriCloud