From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 2/3] src: add and use payload_expr_trim_force
Date: Fri, 7 Feb 2025 10:54:24 +0100 [thread overview]
Message-ID: <Z6XYULCcpB0ZoFPO@calendula> (raw)
In-Reply-To: <20250130174718.6644-2-fw@strlen.de>
On Thu, Jan 30, 2025 at 06:47:13PM +0100, Florian Westphal wrote:
> Previous commit fixed erroneous handling of raw expressions when RHS sets
> a zero value.
>
> Input: @ih,58,6 set 0 @ih,86,6 set 0 @ih,170,22 set 0
> Output:@ih,48,16 set @ih,48,16 & 0xffc0 @ih,80,16 set \
> @ih,80,16 & 0xfc0f @ih,160,32 set @ih,160,32 & 0xffc00000
>
> After this patch, this will instead display:
>
> @ih,58,6 set 0x0 @ih,86,6 set 0x0 @ih,170,22 set 0x0
>
> payload_expr_trim_force() only works when the payload has no known
> protocol (template) attached, i.e. will be printed as raw payload syntax.
>
> It performs sanity checks on @mask and then adjusts the payload expression
> length and offset according to the mask.
>
> Also add this check in __binop_postprocess() so we can also discard masks
> when matching, e.g.
>
> '@ih,7,5 2' becomes '@ih,7,5 0x2', not '@ih,0,16 & 0xffc0 == 0x20'.
>
> binop_postprocess now returns if it performed an action or not; if this
> returns true then arguments might have been freed so callers must no longer
> refer to any of the expressions attached to the binop.
>
> Next patch adds test cases for this.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
next prev parent reply other threads:[~2025-02-07 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 17:47 [PATCH nft 1/3] netlink_delinarize: fix bogus munging of mask value Florian Westphal
2025-01-30 17:47 ` [PATCH nft 2/3] src: add and use payload_expr_trim_force Florian Westphal
2025-02-07 9:54 ` Pablo Neira Ayuso [this message]
2025-01-30 17:47 ` [PATCH nft 3/3] tests: py: extend raw payload match tests Florian Westphal
2025-02-07 9:54 ` Pablo Neira Ayuso
2025-02-07 9:54 ` [PATCH nft 1/3] netlink_delinarize: fix bogus munging of mask value 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=Z6XYULCcpB0ZoFPO@calendula \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/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.