From: Ralf Lici 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)") Cc: stable@vger.kernel.org Signed-off-by: Ralf Lici Signed-off-by: Antonio Quartulli --- 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 7672094a6766..05e10a2ed179 100644 --- a/drivers/net/ovpn/udp.c +++ b/drivers/net/ovpn/udp.c @@ -495,6 +495,9 @@ int ovpn_udp_send_skb(struct ovpn_peer *peer, struct sock *sk, return -EADDRNOTAVAIL; } + /* the encrypted openvpn packet is the UDP tunnel payload */ + skb_reset_inner_network_header(skb); + skb->dev = peer->ovpn->dev; skb->mark = key.mark; /* no checksum performed at this layer */