From patchwork Fri Jan 30 17:32:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 4745 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6911:b0:80a:3855:ce6a with SMTP id o17csp349949map; Fri, 30 Jan 2026 09:33:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXaNwm+fWDOOQsENocZziCow9SyPNy4sTm6p9XD44MyT1wOuYfFrTJLmZFAG4RMEHD3LmZ5ARGuo7Y=@openvpn.net X-Received: by 2002:a05:6871:e2de:b0:409:9571:350f with SMTP id 586e51a60fabf-409a6b02c36mr1733791fac.2.1769794425790; Fri, 30 Jan 2026 09:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769794425; cv=none; d=google.com; s=arc-20240605; b=CNoqmBvsR5VNT+QTgijE2sLUuwJHsooBJqYRKTQ//xuQU99L7ALtamfBo2Rwgp9N+e JJmoGp1HvvY2GehfpwxQDDRLcMyMJDgxCTn8PonpMOL25nTlQAI9NcthGn9xtAXZ8u+S XA6U45hi8mGHXowo8OGezj45nKKsnJr8W1Ra+fXMVhKW9aN276lBmfJB6v/zc8nwCIGj G9ShkdU3I4ZgHY2gpXrvou6rwKtsK0liyx23TUWFvZNIisk1IW+bHfdX3HxoFm2+f3th ScEpE0Y4dd34DWMxSc3aFQTMkXVzpSvFT4yFlLh3MwlRVMCv68qOGr1PcFK3Tspp6/z0 66/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:cc:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=nAcDsZChz2uzR1I87LQR64xwWfA9Giy4yadRm46T1jc=; fh=bDmbXayvKcQuWZaaz4JM7kgnS3MJBk3QUq2ehqNuBVc=; b=dc6VbrIDQgMJx9iIEbKO7xhi5+POI4fdP0Vnz4umTBYXlSkTtmCDRWsPh6fjmk/PCE VxAg4VZix3e5CaIOMU7qAp3KKrz9HElEnxK3ZzuawiHPr5t9swyNCKwSQkILuWO41tdt ExF8PIaqCS52e350caxUT5J1AjsqMnCZe+g2ZaLhOcOi6oP1PAkVbm+ZIOm4Z/ScUXwF SprBgd5I1ZOE1XzQEmm52+UMakoGMBhdC9O0nXBYIcsORkNHIZfYsylD0Pqui8ShRlnm 10VTf4FQ7f/e87GOBx26GL4xwYKUiHSkuKXHlfkzDHpvXQ1oWdw5492qo+ghIQP/PSfA 74fA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=lNu2DXza; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jsz24ISO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="ZStmQX/e"; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=google header.b=Zy20L+rq; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dara=neutral header.i=@openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-40957794f6asi6964575fac.332.2026.01.30.09.33.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jan 2026 09:33:45 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=lNu2DXza; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jsz24ISO; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="ZStmQX/e"; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=google header.b=Zy20L+rq; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dara=neutral header.i=@openvpn.net DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nAcDsZChz2uzR1I87LQR64xwWfA9Giy4yadRm46T1jc=; b=lNu2DXzaAOyy7uKD9vBXc68YCr MIehNe5UbANg9/X7kuxXA1IuvenfJ5cWRRVk0VuZsCCcjlu85XzRNlTNPpNxjYHzVc7os63E7qfJA EoFRRObgVeccH60OgVvyxGm0c95eju/YgniP4yK3dCdJy984IANVaMd4vv+Azte25338=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vlsNG-0003JO-RG; Fri, 30 Jan 2026 17:33:38 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vlsNE-0003JF-PY for openvpn-devel@lists.sourceforge.net; Fri, 30 Jan 2026 17:33:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Klc9TXYxdHGvtCBmOS0R4wvPqGfVxuPxMRR/ruwFyuM=; b=jsz24ISOfqugspkMxvGZL6EEsd sXiTbHzTSx8xrQo07gOwqUkTlli+dnwndkgLSbKo64Dq6p4ld52e6JJ1JN90TdnOoVylF2wCizQf/ BULo3Ba8LSy9/WwN3Srm0sfu4sqiqTEwaFtLJLFobVuIUkPmpgwp3vkzvk3TX9ORGn9M=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Klc9TXYxdHGvtCBmOS0R4wvPqGfVxuPxMRR/ruwFyuM=; b=ZStmQX/e2o2NuzIuYnUd1IOeVR 19+hmgIodJlO18L7oTUULeqicFjZs0/m2sxwZtY5vA5dU62R8odkLx6W9I8/0QHfbZdpT0xQuAEnk lqz0csC5HnB//KwvNoYUjy+Nj3nXh8b8JoojL847oZ0ekz5utc/UpzwwTRcS2q/YkkWI=; Received: from mail-wm1-f46.google.com ([209.85.128.46]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1vlsNE-0006Hf-Co for openvpn-devel@lists.sourceforge.net; Fri, 30 Jan 2026 17:33:36 +0000 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-47edd9024b1so19683095e9.3 for ; Fri, 30 Jan 2026 09:33:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=google; t=1769794409; x=1770399209; darn=lists.sourceforge.net; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Klc9TXYxdHGvtCBmOS0R4wvPqGfVxuPxMRR/ruwFyuM=; b=Zy20L+rqLxR25t9pRo+63HXy2aYDWLP4QgS/sjX+sQ8b0jkmruBbwSl9kbbnpG/Cny bdoy+/YHKMfhUxkIxMdr7IXEFftELjhETWGwW4hoWFobBG6Qbkcn3aVLYlIdXTVrPoEU vwtMbBEW8m9lC/7/vbvrQPd4r86e68qOTyv2I/C4zBeM1sSVe+mRCrg75Xr6ULyvnKgx 1+KoWk4JqMpYrSkM7ZRuXRjtWv6Ps671YFjhV6+1rO9OfAko/BJpQf/yABpFDHWzTiZD p6l2C6tJ3Eo5hLSsX9Vi0K5Smdnj0DDsj6oE4tc1rT19Ec4WDq5ayUPwEhc2ObR1De0P m1kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769794409; x=1770399209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Klc9TXYxdHGvtCBmOS0R4wvPqGfVxuPxMRR/ruwFyuM=; b=REtG/CSpZMfaZJSmp0QALUzuw0kO6RH2tV5kftjCEduKSMenaR+fGO+yJrSV8W72Bw o0vnYPh4liPz6b5r6PQ/0cdMYYsHrMvX9DY2mbZMLWAkIULyIuYc8gRIzkuBNyJu7Bhc dbnNBVS7JFJ5tAv7RzhNFbi9C2D1weuaQwZddaA4S/k/vMFZSMg4H7DHj6SUeO98QaSC CyyNOpO5RUweSfsd3moykPIY5J2iVQt/XBRLtTFyjDSCeE2031jlCKJfHUYPJ8BTYYPI sXYWwPywtHPry5e2dTcbe0HY98LGurWUyb1fmRqBEM5uGdVjueLUCUoCrqZdNLHbxsV5 c0PA== X-Gm-Message-State: AOJu0Ywjxhy7QIQ4Dd6FEY0gVogk9DRf5QNJwLpwC5owRWmELKhxt4xa VbSydiyxz7SpJrgc6J4H78xoMnSUyF5o82yTXaN8GhI6v1lKudff/R8K9KnRquGWgHDjX0t8p7W xL1N+ X-Gm-Gg: AZuq6aL52n/lVBv9jifrk5MQN+BF96eJDeXm3dvhwu1ZNcfD5X8/qurx3GaGpSzjCFW 5+y7REmGITQK/FSCtK7QsD+dWOOB2fOL7ncBXD2SXKrOpivH/xtodMgFL8Dg6ckIGKr0ZjXBzbQ l6xOQUof1rRcu88rHbYx+FNB0C5rIHNZO/nKZzWRXFDf15UqDZN/tmXBzcCZvGoq+59P77qS8Ju RE1eihQAkrF2jBNrN6eCI4RMA3MoEWM+CvMrqPyd6jqnu6Tp3uKHJU4/DtM1URHBkyL/lwI4v7W +5dqlOYnoLopGfp2Q5nuV64MUejLNgsQr564rc5bnI6RQyT9sr8TXFjFW72r4PCFhBkJ9FamwHz 9WViJURfXobAdEDiI87bpsbyo6X6ndDbcpSV/WJoFPCcmV1fYckh6XkGVZ6lvdgeqp5JUuBdS8X 2dGYGxNw== X-Received: by 2002:a05:600c:4f09:b0:477:97c7:9be7 with SMTP id 5b1f17b1804b1-482db45257amr46767285e9.1.1769794409621; Fri, 30 Jan 2026 09:33:29 -0800 (PST) Received: from fedora ([2a01:e11:600c:d1a0:3dc8:57d2:efb7:51a8]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-482e047d863sm22090605e9.1.2026.01.30.09.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 09:33:29 -0800 (PST) From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Fri, 30 Jan 2026 18:32:50 +0100 Message-ID: <20260130173250.664943-3-ralf@mandelbit.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260130173250.664943-1-ralf@mandelbit.com> References: <20260130173250.664943-1-ralf@mandelbit.com> MIME-Version: 1.0 X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: In ovpn_net_xmit, after GSO segmentation and segment processing, the first segment on the list is used to increment VPN TX statistics, which fails to account for any subsequent segments in the chain. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.46 listed in wl.mailspike.net] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1vlsNE-0006Hf-Co Subject: [Openvpn-devel] [PATCH ovpn net v3 3/3] ovpn: fix VPN TX bytes counting X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sabrina Dubroca Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1855763959532058403?= X-GMAIL-MSGID: =?utf-8?q?1855763959532058403?= In ovpn_net_xmit, after GSO segmentation and segment processing, the first segment on the list is used to increment VPN TX statistics, which fails to account for any subsequent segments in the chain. Fix this by accumulating the length of every segment that successfully passes skb_share_check into a tx_bytes variable. This ensures the peer statistics accurately reflect the total data volume sent, regardless of whether the original packet was segmented. Fixes: 04ca14955f9a ("ovpn: store tunnel and transport statistics") Signed-off-by: Ralf Lici Reviewed-by: Sabrina Dubroca --- Changes since v2: none (except for trivial rebase) Changes since v1: - added Fixes tag drivers/net/ovpn/io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ovpn/io.c b/drivers/net/ovpn/io.c index f70c58b10599..955c9a37e1f8 100644 --- a/drivers/net/ovpn/io.c +++ b/drivers/net/ovpn/io.c @@ -355,6 +355,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) struct ovpn_priv *ovpn = netdev_priv(dev); struct sk_buff *segments, *curr, *next; struct sk_buff_head skb_list; + unsigned int tx_bytes = 0; struct ovpn_peer *peer; __be16 proto; int ret; @@ -414,6 +415,8 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) continue; } + /* only count what we actually send */ + tx_bytes += curr->len; __skb_queue_tail(&skb_list, curr); } @@ -426,7 +429,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) } skb_list.prev->next = NULL; - ovpn_peer_stats_increment_tx(&peer->vpn_stats, skb_list.next->len); + ovpn_peer_stats_increment_tx(&peer->vpn_stats, tx_bytes); ovpn_send(ovpn, skb_list.next, peer); return NETDEV_TX_OK;