Re: [PATCH net v2 1/1] ip6_tunnel: snapshot encap in xmit
From: Artem Lytkin <hidden>
Date: 2026-08-24 19:47:57
On Sun, Aug 09, 2026 at 03:33:35PM +0300, Ido Schimmel wrote:
It's on my TODO list since last week, but I don't have the time to work on it right now. It's a very large change (see the geneve change) that is needed across all the IP tunnels, not something that I consider suitable for net.
I'd like to pick this up for net-next, unless you have already started. The shape I have in mind follows the geneve conversion: a separately allocated config struct hanging off the tunnel under an __rcu pointer, holding encap together with encap_hlen, tun_hlen and hlen. xmit dereferences it once and passes the pointer down to ip6_tnl_encap() and the header length helpers. changelink builds a new one, validates it, and only then publishes it with rcu_assign_pointer(). That also stops a rejected changelink from leaving the encap half applied, which is what happens today when ip6_tnl_encap_setup() runs before the collect_md and duplicate checks. The synchronize_net() in ip6_tnl_update() and its siblings is a separate question. It is there for hash coherence: ip6_tnl_lookup() matches on parms.laddr, raddr and link while walking the bucket. It does nothing for the header geometry xmit reads, so it can only go once parms is in the config as well and the lookups dereference it. Two things I'd settle before writing code. Header geometry only in a first series, with parms following, or everything at once? And the order: ip6_tunnel first, since that is where the report landed and ip6_gre builds on it, then ip_tunnel.c for ipip and gre, and sit's own copy in net/ipv6/sit.c after that. vti has no encap and no hlen, so it needs nothing. If you have notes or a half-done branch I'd gladly build on them. Artem