Date: Sun, 31 Jul 2016 22:46:45 +0200 From: "Kristof Provost" <kp@FreeBSD.org> To: "Radek =?utf-8?q?Krej=C4=8Da?=" <radek.krejca@starnet.cz> Cc: "freebsd-pf@freebsd.org" <freebsd-pf@freebsd.org> Subject: Re: How to set tos to 0 Message-ID: <19EA8000-0945-40D0-8A9E-D33E5397D8CC@FreeBSD.org> In-Reply-To: <AAA772390F662049B3046CA8C662C08506A4BC5E@EXCHANGE.mail.starnet.cz> References: <AAA772390F662049B3046CA8C662C08506A4BC5E@EXCHANGE.mail.starnet.cz>
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;
}
Regards,
Kristof
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19EA8000-0945-40D0-8A9E-D33E5397D8CC>
