ovpn: reset GSO metadata after decapsulation
Subsystems (2)
PATCH 1/1 ovpn: reset GSO metadata after decapsulation
The ovpn_netdev_write() function is responsible for injecting decapsulated and decrypted packets back into the local network stack. Prior to this change, the skb could retain GSO metadata from the outer, encrypted tunnel packet. This original GSO metadata, relevant to the sender's context for the tunnel, becomes invalid and misleading for the local receive path once the inner packet is exposed.
Leaving this stale metadata intact causes internal GSO validation checks further down the kernel's network stack (validate_xmit_skb()) to fail, leading to packet drops. The reasons for these failures vary by protocol, for example:
- for ICMP, no offload handler is registered;
- for TCP and UDP, the respective offload handlers return errors when comparing skb->len to the outdated skb_shinfo(skb)->gso_size.
By calling skb_gso_reset(skb) we ensure the inner packet is presented to gro_cells_receive() with a clean slate, correctly indicating it is an individual packet from the perspective of the local stack.
This change eliminates the "Driver has suspect GRO implementation, TCP performance may be compromised" warning and improves overall TCP performance by allowing GSO/GRO to function as intended on the decapsulated traffic. (Note: UDP GSO is not currently supported in ovpn)
--- drivers/net/ovpn/io.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ovpn/io.c +7 -0
@@ -62,6 +62,13 @@ static void ovpn_netdev_write(struct ovpn_peer *peer, struct sk_buff *skb)unsigned int pkt_len;int ret; +/* +* GSO state from the transport layer is not valid for the tunnel/data +* path. Reset all GSO fields to prevent any further GSO processing +* from entering an inconsistent state. +*/ +skb_gso_reset (skb); +/* we can't guarantee the packet wasn't corrupted before entering the * VPN, therefore we give other layers a chance to check that */
Signature · 1 line
2.50.0
Hi
Quoted 3 lines · Ralf Lici
By calling
skb_gso_reset(skb)we ensure the inner packet is presented togro_cells_receive()with a clean slate, correctly indicating it is an individual packet from the perspective of the local stack.
Amazing find.
I have tested this on my ubuntu 20.04 (backports) testbed that had the "large ping tcp instance -> udp instance fail", and now everything succeeds (this patch applied to "DCO version: ovpn-net-next/net-6.15.0-8f0bda6").
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...