Date: Wed, 10 Aug 2016 16:23:50 +0200 From: =?utf-8?B?UmFkZWsgS3JlasSNYQ==?= <radek.krejca@starnet.cz> To: 'Kristof Provost' <kp@FreeBSD.org> Cc: "'freebsd-pf@freebsd.org'" <freebsd-pf@freebsd.org> Subject: RE: How to set tos to 0 Message-ID: <AAA772390F662049B3046CA8C662C08506A4BE13@EXCHANGE.mail.starnet.cz> In-Reply-To: <19EA8000-0945-40D0-8A9E-D33E5397D8CC@FreeBSD.org> References: <AAA772390F662049B3046CA8C662C08506A4BC5E@EXCHANGE.mail.starnet.cz> <19EA8000-0945-40D0-8A9E-D33E5397D8CC@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AAA772390F662049B3046CA8C662C08506A4BE13>
