All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org,
	"Maciej Żenczykowski" <zenczykowski@gmail.com>
Subject: Re: [PATCH nf] netfilter: nf_tables: fix 'exist' matching on bigendian arches
Date: Mon, 4 Dec 2023 14:57:31 +0100	[thread overview]
Message-ID: <ZW3ay5ezNLz4Xs3e@orbyte.nwl.cc> (raw)
In-Reply-To: <20231204112958.10706-1-fw@strlen.de>

On Mon, Dec 04, 2023 at 12:29:54PM +0100, Florian Westphal wrote:
> Maze reports "tcp option fastopen exists" fails to match on
> OpenWrt 22.03.5, r20134-5f15225c1e (5.10.176) router.
> 
> "tcp option fastopen exists" translates to:
> inet
>   [ exthdr load tcpopt 1b @ 34 + 0 present => reg 1 ]
>   [ cmp eq reg 1 0x00000001 ]
> 
> .. but existing nft userspace generates a 1-byte compare.
> 
> On LSB (x86), "*reg32 = 1" is identical to nft_reg_store8(reg32, 1), but
> not on MSB, which will place the 1 last. IOW, on bigendian aches the cmp8
> is awalys false.
> 
> Make sure we store this in a consistent fashion, so existing userspace
> will also work on MSB (bigendian).
> 
> Regardless of this patch we can also change nft userspace to generate
> 'reg32 == 0' and 'reg32 != 0' instead of u8 == 0 // u8 == 1 when
> adding 'option x missing/exists' expressions as well.
> 
> Fixes: 3c1fece8819e ("netfilter: nft_exthdr: Allow checking TCP option presence, too")
> Fixes: b9f9a485fb0e ("netfilter: nft_exthdr: add boolean DCCP option matching")
> Fixes: 055c4b34b94f ("netfilter: nft_fib: Support existence check")
> Reported-by: Maciej Żenczykowski <zenczykowski@gmail.com>
> Closes: https://lore.kernel.org/netfilter-devel/CAHo-OozyEqHUjL2-ntATzeZOiuftLWZ_HU6TOM_js4qLfDEAJg@mail.gmail.com/
> Signed-off-by: Florian Westphal <fw@strlen.de>

I reckon we want this irrespective of any user space changes as it fixes
for existing/old user space on Big Endian. Therefore:

Acked-by: Phil Sutter <phil@nwl.cc>

Thanks, Phil

  reply	other threads:[~2023-12-04 13:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 11:29 [PATCH nf] netfilter: nf_tables: fix 'exist' matching on bigendian arches Florian Westphal
2023-12-04 13:57 ` Phil Sutter [this message]
2023-12-04 14:06   ` 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=ZW3ay5ezNLz4Xs3e@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --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.