All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: ZhilingZouzhilinz@nebusec.ai
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de, phil@nwl.cc,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	horms@kernel.org, bazsi@balabit.hu, kaber@trash.net,
	hidden@balabit.hu, vega@nebusec.ai, zhilinz@nebusec.ai
Subject: Re: [PATCH nf 1/1] netfilter: xt_TPROXY: require IPv6 protocol match
Date: Mon, 17 Aug 2026 18:11:45 +0200	[thread overview]
Message-ID: <aoMywaT0eQWFS3I7@chamomile> (raw)
In-Reply-To: <aoMx5TSCLinBXwNz@chamomile>

On Mon, Aug 17, 2026 at 06:08:08PM +0200, Pablo Neira Ayuso wrote:
> On Mon, Aug 17, 2026 at 08:26:37PM +0800, ZhilingZouzhilinz@nebusec.ai wrote:
> > From: Zhiling Zou <zhilinz@nebusec.ai>
> > 
> > tproxy_tg6_check() verifies the protocol field value but does not
> > require IP6T_F_PROTO. A crafted ip6tables rule can set the field to
> > TCP or UDP while leaving the protocol matching flag clear.
> > 
> > ip6_packet_match() treats such a rule as protocol agnostic and can
> > invoke tproxy_tg6_v1() for ICMPv6. nf_tproxy_get_sock_v6() warns for
> > protocols other than TCP and UDP.
> > 
> > Reject rules without IP6T_F_PROTO so TPROXY is invoked only for the
> > protocols it supports.
> > 
> > Fixes: 6ad7889327a5e ("tproxy: added IPv6 support to the TPROXY target")
> > Cc: stable@vger.kernel.org
> > Reported-by: Vega <vega@nebusec.ai>
> > Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
> > ---
> >  net/netfilter/xt_TPROXY.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c
> > index 5f60e7298a1ea..13a94c9d06c0f 100644
> > --- a/net/netfilter/xt_TPROXY.c
> > +++ b/net/netfilter/xt_TPROXY.c
> > @@ -179,7 +179,8 @@ static int tproxy_tg6_check(const struct xt_tgchk_param *par)
> >  	if (err)
> >  		return err;
> >  
> > -	if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) &&
> > +	if ((i->flags & IP6T_F_PROTO) &&
> > +	    (i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) &&
> >  	    !(i->invflags & IP6T_INV_PROTO))
> 
> And why not tproxy_tg4_check?

I answer myself: there is no such flag in IPv4.

      reply	other threads:[~2026-08-17 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 12:26 [PATCH nf 0/1] netfilter: xt_TPROXY: require IPv6 protocol match Zhiling
2026-08-17 12:26 ` [PATCH nf 1/1] " Zhiling
2026-08-17 15:57   ` Florian Westphal
2026-08-17 16:08   ` Pablo Neira Ayuso
2026-08-17 16:11     ` 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=aoMywaT0eQWFS3I7@chamomile \
    --to=pablo@netfilter.org \
    --cc=ZhilingZouzhilinz@nebusec.ai \
    --cc=bazsi@balabit.hu \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=hidden@balabit.hu \
    --cc=horms@kernel.org \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phil@nwl.cc \
    --cc=vega@nebusec.ai \
    --cc=zhilinz@nebusec.ai \
    /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.