]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ovpn: reset GSO metadata after decapsulation
authorRalf Lici <ralf@mandelbit.com>
Tue, 1 Jul 2025 12:47:44 +0000 (14:47 +0200)
committerAntonio Quartulli <antonio@openvpn.net>
Wed, 16 Jul 2025 09:53:19 +0000 (11:53 +0200)
The ovpn_netdev_write() function is responsible for injecting
decapsulated and decrypted packets back into the local network stack.

Prior to this patch, the skb could retain GSO metadata from the outer,
encrypted tunnel packet. This original GSO metadata, relevant to the
sender's transport context, becomes invalid and misleading for the
tunnel/data 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 state, 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.

Fixes: 11851cbd60ea ("ovpn: implement TCP transport")
Reported-by: Gert Doering <gert@greenie.muc.de>
Closes: https://github.com/OpenVPN/ovpn-net-next/issues/4
Tested-by: Gert Doering <gert@greenie.muc.de>
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
drivers/net/ovpn/io.c

index ebf1e849506b52f10cea07f7e05c3b25f438687b..3e9e7f8444b34465ec08cc1dcf6c70b657e5937d 100644 (file)
@@ -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
         */