Re: [PATCH net v2 1/1] ip6_tunnel: snapshot encap in xmit

Ido Schimmel <[email protected]>
Newsgroups gmane.linux.network
Message-ID <20260809123335.GA2443083@shredder>
On Sat, Aug 08, 2026 at 07:38:52PM +0000, Kuniyuki Iwashima wrote:
> From: Ren Wei <[email protected]>
> Date: Sat,  8 Aug 2026 16:40:49 +0800
> > From: Zixuan Chai <[email protected]>
> > 
> > ip6_tnl_changelink() can update encapsulation parameters while the
> > netdevice is transmitting packets. ip6_tnl_xmit() can calculate packet
> > headroom with t->encap_hlen and later build an encapsulation header from
> > the live t->encap. A concurrent update can change the encapsulation
> > header between these accesses and make skb_push() underflow the skb head.
> > 
> > Take a local snapshot of t->encap before calculating the encapsulation
> > header length.
> 
> This intorduce per-skb cost in the fast path for unlikely changelink.

Assuming the common case where the tunnel doesn't use fou / gue
encapsulation, the added cost is one compare and a copy of 8 bytes.

> 
> Right approach is to convert it to RCU pointer (and remove
> synchronize_net() there).
> 
> 0ba269933f73 geneve: convert config to RCU-protected pointer
> 777434f53e77 geneve: pass geneve_config pointer to helper functions

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.

What are you proposing for net?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.