All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Maxim Mikityanskiy <maxtram95@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	"David S. Miller" <davem@davemloft.net>,
	David Ahern <dsahern@kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Patrick McHardy <kaber@trash.net>,
	KOVACS Krisztian <hidden@balabit.hu>,
	Balazs Scheidler <bazsi@balabit.hu>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, Maxim Mikityanskiy <maxim@isovalent.com>
Subject: Re: [PATCH net] netfilter: socket: Lookup orig tuple for IPv6 SNAT
Date: Tue, 18 Mar 2025 21:13:23 +0100	[thread overview]
Message-ID: <20250318201323.GB840@breakpoint.cc> (raw)
In-Reply-To: <20250318161516.3791383-1-maxim@isovalent.com>

Maxim Mikityanskiy <maxtram95@gmail.com> wrote:
> nf_sk_lookup_slow_v4 does the conntrack lookup for IPv4 packets to
> restore the original 5-tuple in case of SNAT, to be able to find the
> right socket (if any). Then socket_match() can correctly check whether
> the socket was transparent.
> 
> However, the IPv6 counterpart (nf_sk_lookup_slow_v6) lacks this
> conntrack lookup, making xt_socket fail to match on the socket when the
> packet was SNATed. Add the same logic to nf_sk_lookup_slow_v6.
> 
> IPv6 SNAT is used in Kubernetes clusters for pod-to-world packets, as
> pods' addresses are in the fd00::/8 ULA subnet and need to be replaced
> with the node's external address. Cilium leverages Envoy to enforce L7
> policies, and Envoy uses transparent sockets. Cilium inserts an iptables
> prerouting rule that matches on `-m socket --transparent` and redirects
> the packets to localhost, but it fails to match SNATed IPv6 packets due
> to that missing conntrack lookup.
> 
> Closes: https://github.com/cilium/cilium/issues/37932
> Fixes: b64c9256a9b7 ("tproxy: added IPv6 support to the socket match")

Note that this commit predates IPv6 NAT support in netfilter.
No need to send a v2, just saying.

Reviewed-by: Florian Westphal <fw@strlen.de>

  reply	other threads:[~2025-03-18 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-18 16:15 [PATCH net] netfilter: socket: Lookup orig tuple for IPv6 SNAT Maxim Mikityanskiy
2025-03-18 20:13 ` Florian Westphal [this message]
2025-03-18 22:33   ` 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=20250318201323.GB840@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=bazsi@balabit.hu \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=hidden@balabit.hu \
    --cc=horms@kernel.org \
    --cc=kaber@trash.net \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=maxim@isovalent.com \
    --cc=maxtram95@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.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.