From: Florian Westphal <fw@strlen.de>
To: "Maciej Żenczykowski" <zenczykowski@gmail.com>
Cc: Netfilter Development Mailinglist
<netfilter-devel@vger.kernel.org>,
Florian Westphal <fw@strlen.de>
Subject: Re: does nft 'tcp option ... exists' work?
Date: Sun, 3 Dec 2023 14:13:44 +0100 [thread overview]
Message-ID: <20231203131344.GB5972@breakpoint.cc> (raw)
In-Reply-To: <CAHo-Oow4CJGe-xfhweZWzWZ0kaJiwg7HOjKCU-r7HLV_TYGNLQ@mail.gmail.com>
Maciej Żenczykowski <zenczykowski@gmail.com> wrote:
> FYI, I upgraded the router to OpenWrt 23.05.2 with 5.15.137 and it
> doesn't appear to have changed anything, ie. 'tcp option fastopen
> exists' still does not appear to match.
>
> Also note that I'm putting this in table inet filter postrouting like
> below... but that shouldn't matter should it?
No, this is an endianess bug, on BE the compared byte is always 0.
I suspect this will fix it:
diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c
--- a/net/netfilter/nft_exthdr.c
+++ b/net/netfilter/nft_exthdr.c
@@ -214,7 +214,7 @@ static void nft_exthdr_tcp_eval(const struct nft_expr *expr,
offset = i + priv->offset;
if (priv->flags & NFT_EXTHDR_F_PRESENT) {
- *dest = 1;
+ nft_reg_store8(dest, 1);
} else {
if (priv->len % NFT_REG32_SIZE)
dest[priv->len / NFT_REG32_SIZE] = 0;
@@ -461,7 +461,7 @@ static void nft_exthdr_dccp_eval(const struct nft_expr *expr,
type = bufp[0];
if (type == priv->type) {
- *dest = 1;
+ nft_reg_store8(dest, 1);
return;
}
diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c
--- a/net/netfilter/nft_fib.c
+++ b/net/netfilter/nft_fib.c
@@ -145,11 +145,15 @@ void nft_fib_store_result(void *reg, const struct nft_fib *priv,
switch (priv->result) {
case NFT_FIB_RESULT_OIF:
index = dev ? dev->ifindex : 0;
- *dreg = (priv->flags & NFTA_FIB_F_PRESENT) ? !!index : index;
+ if (priv->flags & NFTA_FIB_F_PRESENT)
+ nft_reg_store8(dreg, !!index);
+ else
+ *dreg = index;
+
break;
case NFT_FIB_RESULT_OIFNAME:
if (priv->flags & NFTA_FIB_F_PRESENT)
- *dreg = !!dev;
+ nft_reg_store8(dreg, !!dev);
else
strscpy_pad(reg, dev ? dev->name : "", IFNAMSIZ);
break;
next prev parent reply other threads:[~2023-12-03 13:13 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 [this message]
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
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=20231203131344.GB5972@breakpoint.cc \
--to=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.