From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH nf-next] netfilter: nft_payload: extend offset to 65535 bytes
Date: Thu, 28 Aug 2025 15:32:00 +0200 [thread overview]
Message-ID: <aLBaUP8ECOI9gczI@calendula> (raw)
In-Reply-To: <5c24f67e-744f-4114-8fcd-85b3e88809a4@suse.de>
On Thu, Aug 28, 2025 at 03:06:10PM +0200, Fernando Fernandez Mancera wrote:
> On 8/28/25 2:58 PM, Pablo Neira Ayuso wrote:
> > On Thu, Aug 28, 2025 at 02:48:31PM +0200, Fernando Fernandez Mancera wrote:
[...]
> > > diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
> > > index 7dfc5343dae4..728a4c78775c 100644
> > > --- a/net/netfilter/nft_payload.c
> > > +++ b/net/netfilter/nft_payload.c
> > > @@ -40,7 +40,7 @@ static bool nft_payload_rebuild_vlan_hdr(const struct sk_buff *skb, int mac_off,
> > > /* add vlan header into the user buffer for if tag was removed by offloads */
> > > static bool
> > > -nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
> > > +nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u16 offset, u8 len)
> > > {
> > > int mac_off = skb_mac_header(skb) - skb->data;
> > > u8 *vlanh, *dst_u8 = (u8 *) d;
> > > @@ -212,7 +212,7 @@ static const struct nla_policy nft_payload_policy[NFTA_PAYLOAD_MAX + 1] = {
> > > [NFTA_PAYLOAD_SREG] = { .type = NLA_U32 },
> > > [NFTA_PAYLOAD_DREG] = { .type = NLA_U32 },
> > > [NFTA_PAYLOAD_BASE] = { .type = NLA_U32 },
> > > - [NFTA_PAYLOAD_OFFSET] = NLA_POLICY_MAX(NLA_BE32, 255),
> > > + [NFTA_PAYLOAD_OFFSET] = { .type = NLA_BE32 },
> >
> > Should this be
> >
> > NLA_POLICY_MAX(NLA_BE32, 65535),
> >
> > ?
> >
>
> Hi Pablo,
>
> I don't think so. NLA_POLICY_MAX sets the nla_policy field "max" which is a
> 16 bit signed int (s16). Therefore, when doing NLA_POLICY_MAX(NLA_BE32,
> 65535) it triggers a warning as the max value set is actually "-1" in a s16.
>
> This is why I decided to drop it. Let me know if I am missing something
> here..
Ah indeed, I forgot this NLA_POLICY_MAX limitation.
Thanks for explaining.
prev parent reply other threads:[~2025-08-28 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 12:48 [PATCH nf-next] netfilter: nft_payload: extend offset to 65535 bytes Fernando Fernandez Mancera
2025-08-28 12:58 ` Pablo Neira Ayuso
2025-08-28 13:06 ` Fernando Fernandez Mancera
2025-08-28 13:32 ` 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=aLBaUP8ECOI9gczI@calendula \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=fmancera@suse.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.