Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2016 09:21:56 +0000 (UTC)
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r304281 - stable/10/sbin/pfctl
Message-ID:  <201608170921.u7H9Lu6N052550@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kp
Date: Wed Aug 17 09:21:55 2016
New Revision: 304281
URL: https://svnweb.freebsd.org/changeset/base/304281

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

Modified:
  stable/10/sbin/pfctl/parse.y
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/pfctl/parse.y
==============================================================================
--- stable/10/sbin/pfctl/parse.y	Wed Aug 17 09:20:35 2016	(r304280)
+++ stable/10/sbin/pfctl/parse.y	Wed Aug 17 09:21:55 2016	(r304281)
@@ -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;
 			}



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