From patchwork Wed Jan 28 12:44:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ralf Lici X-Patchwork-Id: 4740 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:8468:b0:80a:3855:ce6a with SMTP id u8csp2707852max; Wed, 28 Jan 2026 04:51:55 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWmcirqOYW0JZp2llVwLIViOZ9EnnvwYVMsQuUfJY7cI7G2bAPh2ReilumjaYcGDCXfvibK9GRHyC4=@openvpn.net X-Received: by 2002:a05:6830:234e:b0:7d1:8ad3:ce7 with SMTP id 46e09a7af769-7d18ad329b2mr1566061a34.1.1769604715115; Wed, 28 Jan 2026 04:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769604715; cv=none; d=google.com; s=arc-20240605; b=cmdpgF5A6Ooh4N24x5eja9svTViGtCuSeeZHjsG5yPAObC8uljkU+PMv0sa3MIKdHW Ru2lIMpYxRzhOWohAbFxG2Ugno00mk7Xu6Aw+7DTy4WmlAwfk9y5ANtxZNl5DNHvFrLL le2cImZGT0scZaAyXZeGewVUIsZ+qOHoJdTYOJtP7nxW5iOUVfj+0FuedrLzws9KkWd8 +yyJ6AFIgZXgj4qNAalXif6ME6XBbyX+V4VO2maWRYZeu8Wl7qeuQK7lIr5iUDQRnAfm v0xKcMUfGb2vo9qjCislz+BTmlvkeJ5g7PtfysHMTJzyCWaq+ILMaAE7GqbHuecvm7wH ojRA== 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=3N9FY+9xBeUVPPnwuleV6bybUkDiArFT05RDGJ2Owug=; fh=bDmbXayvKcQuWZaaz4JM7kgnS3MJBk3QUq2ehqNuBVc=; b=RCJnCw6HuKxeRKhrqjY5y8njY0PP0aFX0ggvS3l1kpib1EnEoWgcFRahVeWjJkUkax R48xtanHeMt712/5iu9AHydvGa9xFe6QdT/eM2wS2qLTK+JdjrqYFj7C376pR1tpNsBH cQEa20gQbIDc0xYVRITJO6bGyxkF4yZ0kdOc/zMdMCVYzx61nChZKyPahoYU4dfPlEEJ 7ECKQfjiZb9xrt1T3Qf17OVhN1+K9j4FXyPvO1uwtjmH3mxc4tH7We8u5oObc9e9kCMn epjC9mV8BIW0+mbCgnT+cPV1JOxaRSSL4O5T5FMw4qXqcaPddTEWyNJR/WbFIzb7huq+ pm4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=bUdAPwwJ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=gbAXxyY5; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ZXA3nt3I; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=google header.b=JKpaVpLu; 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 46e09a7af769-7d18c79bce4si1414247a34.110.2026.01.28.04.51.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jan 2026 04:51:55 -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=bUdAPwwJ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=gbAXxyY5; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ZXA3nt3I; dkim=neutral (body hash did not verify) header.i=@mandelbit.com header.s=google header.b=JKpaVpLu; 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=3N9FY+9xBeUVPPnwuleV6bybUkDiArFT05RDGJ2Owug=; b=bUdAPwwJrxkU+Y7FCyl56mutSG j53N/Z8B1B8F8dLJRejJjY2xFERbcgcSryDA8u1nfg32x87kYPkeEZdOIclZs/yykcmp13J4tyzZX yL8OScOU17a142W/NQn8XgX99APhngK5VB6aKxhHSQcEcX0NBpJE3IqpatRV8qd6RN1A=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vl51Q-0000cF-19; Wed, 28 Jan 2026 12:51:48 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vl51P-0000c5-C5 for openvpn-devel@lists.sourceforge.net; Wed, 28 Jan 2026 12:51:48 +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=SgGvC+Cf9FfQL6DyxmxSFItCT9MQvi4X2Lea+utde6c=; b=gbAXxyY547cnW5m27p7F+58g2d h3NLYBG1krHIt7i5/6r8vcfP2o73ueGLxYyOgptFh4UZQleg/Hz1AvUK9MmAAda7kSpyTFiIFUvHv FWAEKTnkJsRWx9rzXGbnvIP2yHrcZ+l6nsIR8t9qeDyP6Gz//nvDhoO1YzFYrpePLB0E=; 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=SgGvC+Cf9FfQL6DyxmxSFItCT9MQvi4X2Lea+utde6c=; b=ZXA3nt3IIGJTdG8FOhNZ49eTMk KKs7PqJdG3W+CbrmL60aOmphZoUorl8iBU2XBgk4JZlfZgXquZsauFzZH9rBhtQPvxiJNHEjMOneT wWX+yNW6pRMmtxnKXpEXQUNh4ObX+Fle4Ab9QVNxPgKYrVS/m2DFdtKuf4tJT53xklqI=; Received: from mail-lj1-f175.google.com ([209.85.208.175]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1vl51P-0005fo-Nz for openvpn-devel@lists.sourceforge.net; Wed, 28 Jan 2026 12:51:48 +0000 Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-385b5174f54so61482631fa.3 for ; Wed, 28 Jan 2026 04:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=google; t=1769604701; x=1770209501; 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=SgGvC+Cf9FfQL6DyxmxSFItCT9MQvi4X2Lea+utde6c=; b=JKpaVpLuQpOqJvNf1PMNzJZTDwhNYypSFuxqh3HMGuSu0USMOz5iMZ3xg6IH5MFhr8 PpyyARe0LnbUSgQZZp47Znkoaw5Q/f5eEqJEH54XLSvjlhN2u0mHZMDRomW8+Hu8P75S Vxak/Pp/0flUFhi0we+F53cpb216xKGETRTqsiX+hOZMg2gJ1oOl6tCZtkp7QIavNORD oBFRuPSHf9M7wJTuzOHBkoz3DnSdnWtXUwa6guk7pj+3xp5x3rJ+dZV7Tj4kPNrLmcp0 NqTG7K51Z+sYPDiOTgRA1aczFVFDbt3X1ehiGx/dsP3NBRgvk66B+ISn8bcWXNntUZtm dgVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769604701; x=1770209501; 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=SgGvC+Cf9FfQL6DyxmxSFItCT9MQvi4X2Lea+utde6c=; b=PM87abE19C5Eq1Xcjltmqb8mZ3CmNGzbVrs8yzeeIXu3DPvmv/abKsj8rlbdesU8j0 ONi+mvdD80QK2NdpQmFrpw4ch20IEKS8NUMcc/a/kEaZZ3UiB945Oh5+PPGa72VIufgR 5qoFu8fMVZwdzIvXeFw8n6PckWTFaovxMjD8/wrBEDdrZk6imESkQB/pBcO/r15xoL3p Iokh7QT6WnLP4tau1sC6wTwpUmqwOLs52X5NfZNAUQR10rTj5h96r1d+yUoMgRx2UUg4 365UJC+reA1mMq3w21fQZnpCmK/3tlQehq3tAz3CA94qUpkcrtm9ED14gHQXwRvHMlIf 6TSQ== X-Gm-Message-State: AOJu0YyVEevOJ10bqG9ilcPuP9G1qUk6tGW6x1No788TdWhfBiALz8Jw qtSzcinPNUcQlakmOkFI8saB8nC2gfZ/w4hcQm3KR1oyLW+wSjcXgem/Es0tounvaGL7jUnF5Mb F37KQ X-Gm-Gg: AZuq6aLUvdOO2ls7gxzqam3nQWp8mYRbafxvX3/2/UqX9+59z4uf7YZNT8sdri4MioL cD2RUbieMwlNSLysCsu2lpN0vBP9c1FDIvzABgmO1Rn5x3hpvYIoePy+VpXMrlAaAaSLYtRvyC1 m0H63mqmoEf2NldMGbXoa+/asWyWEJWjwCe/uk4OHyeRNXcdnZdX9Hh9nnvxo/FG5JyaJZA4NWH ynzPMLx5IfbvnAU9mXcgPHEjZpdA5WonyIQOq+Ymk4AwTx+FivJSgRJao+o6WfhF0aBBmQ2fFlO oKJERyVMjsRv50M4lTV6m9OFO70P2GgI/xLEB/PGPX7DPfz/IJQh+/wB66CcqaCGP9Ul0ugXAQt v+1CWWmalNxV1OQI11XjWLQCGE8wesPng6JI7mP1eYGdnE5q5W0puxizvDNsy0ITGyAz3WrCjzh N2Zmu4Xw== X-Received: by 2002:a05:6000:1ac7:b0:435:9bf5:b336 with SMTP id ffacd0b85a97d-435dd0719ecmr7671061f8f.19.1769604288700; Wed, 28 Jan 2026 04:44:48 -0800 (PST) Received: from fedora ([2a01:e11:600c:d1a0:3dc8:57d2:efb7:51a8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e1323034sm6656742f8f.35.2026.01.28.04.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 04:44:48 -0800 (PST) From: Ralf Lici To: openvpn-devel@lists.sourceforge.net Date: Wed, 28 Jan 2026 13:44:10 +0100 Message-ID: <20260128124410.429529-3-ralf@mandelbit.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260128124410.429529-1-ralf@mandelbit.com> References: <20260128124410.429529-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 skb variable points only to the first segment of the resulting list. The current code uses skb->len to increment VPN TX statistics, [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.208.175 listed in wl.mailspike.net] X-Headers-End: 1vl51P-0005fo-Nz Subject: [Openvpn-devel] [PATCH ovpn net v2 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?1855565033653621101?= X-GMAIL-MSGID: =?utf-8?q?1855565033653621101?= In ovpn_net_xmit, after GSO segmentation and segment processing, the skb variable points only to the first segment of the resulting list. The current code uses skb->len 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 --- 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 95c3518e067c..4f3c9c5d00aa 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; @@ -394,6 +395,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); } @@ -429,7 +432,7 @@ netdev_tx_t ovpn_net_xmit(struct sk_buff *skb, struct net_device *dev) /* dst was needed for peer selection - it can now be dropped */ skb_dst_drop(skb); - ovpn_peer_stats_increment_tx(&peer->vpn_stats, skb->len); + ovpn_peer_stats_increment_tx(&peer->vpn_stats, tx_bytes); ovpn_send(ovpn, skb_list.next, peer); return NETDEV_TX_OK;