From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org,
"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH nft] parser: tcpopt: fix tcp option parsing with NUM + length field
Date: Tue, 5 Dec 2023 12:44:34 +0100 [thread overview]
Message-ID: <ZW8NIi20utwRiF9B@calendula> (raw)
In-Reply-To: <20231205010027.9339-1-fw@strlen.de>
On Tue, Dec 05, 2023 at 02:00:01AM +0100, Florian Westphal wrote:
[...]
> @@ -182,13 +189,21 @@ struct expr *tcpopt_expr_alloc(const struct location *loc,
> desc = tcpopt_protocols[kind];
>
> if (!desc) {
> - if (field != TCPOPT_COMMON_KIND || kind > 255)
> + if (kind > 255)
> + return NULL;
> +
> + switch (field) {
> + case TCPOPT_COMMON_KIND:
> + case TCPOPT_COMMON_LENGTH:
> + break;
> + default:
> return NULL;
> + }
>
> expr = expr_alloc(loc, EXPR_EXTHDR, &integer_type,
> BYTEORDER_BIG_ENDIAN, 8);
>
> - desc = tcpopt_protocols[TCPOPT_NOP];
> + desc = &tcpopt_fallback;
> tmpl = &desc->templates[field];
> expr->exthdr.desc = desc;
> expr->exthdr.tmpl = tmpl;
I believe this is missing in this patch:
expr->exthdr.offset = tmpl->offset;
so it matches at offset 1, not 0:
[ exthdr load tcpopt 1b @ 255 + 1 => reg 1 ]
[ cmp eq reg 1 0x00000004 ]
prev parent reply other threads:[~2023-12-05 11:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 12:24 does nft 'tcp option ... exists' work? Maciej Żenczykowski
2023-12-03 12:50 ` Maciej Żenczykowski
2023-12-03 13:13 ` Florian Westphal
2023-12-04 9:43 ` Florian Westphal
2023-12-04 10:48 ` Pablo Neira Ayuso
2023-12-04 12:38 ` Maciej Żenczykowski
2023-12-04 13:01 ` Florian Westphal
2023-12-04 13:20 ` Maciej Żenczykowski
2023-12-04 13:33 ` Florian Westphal
2023-12-04 23:01 ` Maciej Żenczykowski
2023-12-05 1:00 ` [PATCH nft] parser: tcpopt: fix tcp option parsing with NUM + length field Florian Westphal
2023-12-05 11:44 ` Pablo Neira Ayuso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZW8NIi20utwRiF9B@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=zenczykowski@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.