Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Aug 2016 15:41:42 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r303663 - head/sbin/pfctl
Message-ID:  <201608021541.u72FfgtB000773@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Tue Aug  2 15:41:42 2016
New Revision: 303663
URL: https://svnweb.freebsd.org/changeset/base/303663

Log:
  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>

Modified:
  head/sbin/pfctl/parse.y

Modified: head/sbin/pfctl/parse.y
==============================================================================
--- head/sbin/pfctl/parse.y	Tue Aug  2 15:35:53 2016	(r303662)
+++ head/sbin/pfctl/parse.y	Tue Aug  2 15:41:42 2016	(r303663)
@@ -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;
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608021541.u72FfgtB000773>