RE: How to set tos to 0

2016-08-10 Thread Radek Krejča
> On 31 Jul 2016, at 19:46, Radek Krejča wrote:
> > I need to set TOS to 0 and remark it with rules.
> >
> > I am trying to use scrub to set tos to 0, but I have problem:
> >
> > scrub all fragment reassemble no-df set-tos 0
> >
> > give Illegal value
> >
> > but scrub all fragment reassemble no-df set-tos 1
> > is working.
> >
> > I am trying 0x00, 0x0 and still the same.
> >
> > How can I set TOS to 0?
> >
> I think you may have found a bug.
> 
> Can you give this patch a try?
> 
> diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
> index e0cfa3d..980976e 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;
>  }
> 

Hello Kristof,

this patch seems to be working.

I will post bugreport.

Thank you
Radek
___
freebsd-pf@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"

Re: How to set tos to 0

2016-07-31 Thread Kristof Provost

On 31 Jul 2016, at 19:46, Radek Krejča wrote:

I need to set TOS to 0 and remark it with rules.

I am trying to use scrub to set tos to 0, but I have problem:

scrub all fragment reassemble no-df set-tos 0

give Illegal value

but scrub all fragment reassemble no-df set-tos 1
is working.

I am trying 0x00, 0x0 and still the same.

How can I set TOS to 0?


I think you may have found a bug.

Can you give this patch a try?

diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y
index e0cfa3d..980976e 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;
}

Regards,
Kristof
___
freebsd-pf@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"

How to set tos to 0

2016-07-31 Thread Radek Krejča
Hello,

I need to set TOS to 0 and remark it with rules.

I am trying to use scrub to set tos to 0, but I have problem:

scrub all fragment reassemble no-df set-tos 0

give Illegal value

but scrub all fragment reassemble no-df set-tos 1
is working.

I am trying 0x00, 0x0 and still the same.

How can I set TOS to 0?

Thank you
Radek

___
freebsd-pf@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-pf
To unsubscribe, send any mail to "freebsd-pf-unsubscr...@freebsd.org"