[Openvpn-devel] [PATCH ovpn net] ovpn: fix UDP TX byte accounting
Ralf Lici <[email protected]> Wed, 29 Jul 2026 14:01:31 +0200
| Newsgroups | net.sourceforge.lists.openvpn-devel |
|---|---|
| Message-ID | <edeed888ce77bffa616da9ed98833b6c5584ecb3.1785326438.git.ralf@mandelbit.com> |
ovpn hands encrypted data packets to udp_tunnel_xmit_skb for UDP
transport transmission. At that point skb->data points at the encrypted
OpenVPN packet, but the skb may still carry inner-header metadata
inherited from the plaintext packet.
The UDP tunnel output path uses skb_inner_network_offset to compute the
packet length passed to iptunnel_xmit_stats. If the inner network header
still points at the pre-encryption payload, the ovpn netdev TX byte
counter does not account the OpenVPN data-channel header and
authentication tag.
Reset the inner network header before handing the skb to the UDP tunnel
helpers, so the encrypted OpenVPN packet is accounted as the UDP tunnel
payload.
Fixes: 08857b5ec5d9 ("ovpn: implement basic TX path (UDP)")
Signed-off-by: Ralf Lici <[email protected]>
---
drivers/net/ovpn/udp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ovpn/udp.c b/drivers/net/ovpn/udp.c
index 7f69e8890b5b..48172bd073a9 100644
--- a/drivers/net/ovpn/udp.c
+++ b/drivers/net/ovpn/udp.c
@@ -342,6 +342,9 @@ void ovpn_udp_send_skb(struct ovpn_peer *peer, struct sock *sk,
{
int ret;
+ /* the encrypted openvpn packet is the UDP tunnel payload */
+ skb_reset_inner_network_header(skb);
+
skb->dev = peer->ovpn->dev;
skb->mark = READ_ONCE(sk->sk_mark);
/* no checksum performed at this layer */
--
2.55.0
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel