From patchwork Tue Sep 2 16:35:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4392 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:2a1c:b0:671:5a2c:6455 with SMTP id k28csp1935771maz; Tue, 2 Sep 2025 09:35:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXsTK2uRBW6f5kfeGmtK8Roqyptwx/xlIFxeXS+5X22CvLxXdKTdeR4/7MZZWSptI0BikDdcQc9fLg=@openvpn.net X-Google-Smtp-Source: AGHT+IGhIiC+sTmlfDpI/2AR0bvhkS0V4Ft9YJi7lPLZim+ChWZg8RG+SJujGBkjU2Q7QxbAiQFC X-Received: by 2002:a05:6830:6b06:b0:745:2b83:2f0d with SMTP id 46e09a7af769-74569e8284fmr5765612a34.23.1756830933908; Tue, 02 Sep 2025 09:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1756830933; cv=none; d=google.com; s=arc-20240605; b=KRSA5uF2j98xrkOC4cgOagD22jvRR9pLi8gMkBBPX+akzF1LjAfRCtR78oF3OMvjHi ZteklZA9lmRNyro58HakNv+t0IWy582n4igS69NR4HKOr+0f0bxUkEmaHemRiI8uc4Hi SYGqpSaeCpfbSsTEH6nPik00IKPjmIq26R2/EBjQDCtfxchozRvYhVw1h2yZoZ0p8MyO dN8EATrJr8AcHqUWI9CEts1pd/NpFpAVXwB+FMmjQUeinabeomfRa2lqe4t/I35z42Gu et4jAcRGjPP1xltyhfZ8SBSj+/e9sWOc6PYzT6Q9mbBKDGQZreyXW2mwgQkwecJwbVsp GGKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding: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; bh=VqzWGFPuC4yKa9HG6OkEo1C7ZF6Eyg6XBSyrmEFeOCA=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=dBwLF74UlfGsa9p/PoZeS7KfoY4eLBpxiJfNmp8SShR0V2vpQ7e258NWuOTESMBHUr mF+zpeM1BG4TBdGH/A7Un4Jd9SquKVrGuzzuOyt3+v0Xz53ezQkXQIwPBBk5tYPIfV9f w/L6hRRvn59+OqIIxMW/5TmijdjZl7PfTL+ZiycGeEjoNr7ucLChK6vykSuwf58qdijO +fbBrogNdFB05Wyd2oTxTOsWyn/ybtMQhhDPvwlOLgsTbPEdX4GG9LV9MSY54eRZ0PoX IL1vFX9aWXPYnDw7V7Lzam0fkUbF1DqVQRv5Ir+Mqp5LK1IT2rb4r5mrN49ppr63EJch QOqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=GA1+ImqR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=IXMKcP0M; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ekt9E8a6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-74574432138si1572304a34.250.2025.09.02.09.35.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Sep 2025 09:35:33 -0700 (PDT) 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=GA1+ImqR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=IXMKcP0M; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ekt9E8a6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de 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: 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:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VqzWGFPuC4yKa9HG6OkEo1C7ZF6Eyg6XBSyrmEFeOCA=; b=GA1+ImqREMkpCDRNUtK34UAg3J WyPrM0wOVv2kRt4AluKRJbJtj95eFPoYrrgaZN4hpxU1ip6VgrP+lzdAQvi7DGl+CQkmI4zkbzqGk w/pLgo7aFzL0oozlVBNY97ZwwKNifyZVU/v9hDd8p2JR1Z+1DhdRQ+yErCAesU5eI/5E=; 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 1utTyk-0007op-SX; Tue, 02 Sep 2025 16:35:30 +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 1utTyi-0007oc-Qm for openvpn-devel@lists.sourceforge.net; Tue, 02 Sep 2025 16:35:28 +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:To:From:Sender:Reply-To:Cc: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=fTuyXst6KogU4GrRcNUhV+MMMCrkbJlV/O1gUeVK5aY=; b=IXMKcP0MHa8dKvYjxFix53yTEo qs1Y1tj96gOXLrnabLZgZ6Lfc9gZVdoc860KFh/kzWpD80GjibSEpk6qQsAybWNx3H1WpzeOtQ2tl HfXYBY3NQnB43F5GVeUiRzv5Ediu04aP2UiARKaL1UH+qiNbnRX20bxJa03rmV6ruLAk=; 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:To:From:Sender:Reply-To:Cc: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=fTuyXst6KogU4GrRcNUhV+MMMCrkbJlV/O1gUeVK5aY=; b=Ekt9E8a66djJErMZmuR2swa6Df F9nCCr2sMieEX5In4ksPZrXuq8Z9oT+0iDHkqiKHdyZM+dc4HgSjDiMB5DU89e7HrF9OFfSrOBbIs VqMEEUKFXAl778tr2xXJ9FkVKWXHCfJv3Ua6wmSlmbQ55M2YOp2aBVF1a7aoU+Xw5nx4=; Received: from [193.149.48.143] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1utTyh-0007zB-56 for openvpn-devel@lists.sourceforge.net; Tue, 02 Sep 2025 16:35:28 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 582GZFAc022357 for ; Tue, 2 Sep 2025 18:35:15 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 582GZF4U022356 for openvpn-devel@lists.sourceforge.net; Tue, 2 Sep 2025 18:35:15 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 2 Sep 2025 18:35:09 +0200 Message-ID: <20250902163514.22339-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.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: From: Ralf Lici When a management interface client requests periodic bytecount notifications, openvpn continues to emit them even after the client has disconnected. Additionally, upon reconnecting, the client starts [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1utTyh-0007zB-56 Subject: [Openvpn-devel] [PATCH v1] management: stop bytecount on client disconnection 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1842170753371044055?= X-GMAIL-MSGID: =?utf-8?q?1842170753371044055?= From: Ralf Lici When a management interface client requests periodic bytecount notifications, openvpn continues to emit them even after the client has disconnected. Additionally, upon reconnecting, the client starts receiving these notifications without having issued a new bytecount command. Stop the periodic bytecount operation when the management interface client disconnects, preventing unnecessary stats polling when using DCO and ensuring that clients only receive notifications they have explicitly requested. Change-Id: I1474d232278433d097baf85352dfc9a79853bad1 Signed-off-by: Ralf Lici Acked-by: Gert Doering --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1167 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 422aa0b..5b2a7de 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -501,6 +501,13 @@ } static void +man_bytecount_stop(struct management *man) +{ + man->connection.bytecount_update_seconds = 0; + event_timeout_clear(&man->connection.bytecount_update_interval); +} + +static void man_bytecount(struct management *man, const int update_seconds) { if (update_seconds > 0) @@ -511,8 +518,7 @@ } else { - man->connection.bytecount_update_seconds = 0; - event_timeout_clear(&man->connection.bytecount_update_interval); + man_bytecount_stop(man); } /* The newly received bytecount interval may be sooner than the existing @@ -1992,6 +1998,7 @@ { if (socket_defined(man->connection.sd_cli)) { + man_bytecount_stop(man); #ifdef _WIN32 man_stop_ne32(man); #endif