Author: kp
Date: Wed Aug 17 09:20:35 2016
New Revision: 304280
URL: https://svnweb.freebsd.org/changeset/base/304280

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.kre...@starnet.cz>

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

Modified: stable/11/sbin/pfctl/parse.y
==============================================================================
--- stable/11/sbin/pfctl/parse.y        Wed Aug 17 09:20:04 2016        
(r304279)
+++ stable/11/sbin/pfctl/parse.y        Wed Aug 17 09:20:35 2016        
(r304280)
@@ -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;
                        }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to