From patchwork Thu Nov 26 15:11:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5799 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:91c9:10b0:11b:d6c:f273 with SMTP id tl9-n1csp7331984lad; Thu, 26 Nov 2026 07:12:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEbJ8u/Hb76EEBauZwyINd5bdzCCdrPn/seVtoeu++cWFi93NUFcyZKu3l3DAGy2vxviMz5MOWtvjU=@openvpn.net X-Received: by 2002:a05:701a:ccda:10b0:1b5:7477:ff7d with SMTP id a92af1059eb24-1b574780064mr12546961c88.15.1795705936712; Thu, 26 Nov 2026 07:12:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795705936; cv=none; d=google.com; s=arc-20260327; b=iA4y2rduQqHgerOK0I35txSu/YaQfFYGUDfiNXX4VasmW6Jilh+ZsdklICKrz6eLaH u0pBYfRJO41II6IrPV0CPxObKOdd2Vid1a6CISGg4ezKnMwekub6x3wEPyo9dbLQCjce j4d9I2OfyH8aH/3eB3xEpksYetQBTLCcnnT2O5wBhSe9yV0K6dIxM9FDrBCYEWRlDpNs w4puUHagH4dnyCsFQsm7lGUHiS+j70gugrOv5UE6UUh9vPNwtvbvRlGGKbnv4Dh583uh k+AUA3zx89GB+L6YfSI8NTWvuvGYMD8hlqO7bS1+HJJ+ShQosOe1DLMppcmoQ9w0cuIH UFJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=IF7u+ACRe13nQsHuyuLJLMuzXrOBAc4Xr3k9OIvpa8E=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=VypqG7xIsvwrWUCfLmBJaIUUK673MTEhbCHl1WdUxU1jTmf2sGmXfW9aHiAtQF+Mgp tov6bGzNQdPCfVBhfaJyGxjDzSEKb8QGa7qbXjgGVBFNCH46PJ1DYJzvCTGOI+hwjLMq xHu/EeWuWDjL7buzJiv/P7+yD1zrWSyTkR4P8PIqRk0GW+daaXTG5rgf66ZTu5UysXZm RRALzo87aSy7MOTR9SLmGB1zy0Ec3PqnRUBKfr00Wob0RZW8B+TogPoo8ZS1BFrswos5 mnSpydFem7yx+OQ2bWokkEgp3Eu6nCW5/p/8dI45HsYviGGgnY5nSDqN2xQaljQzbcn5 VkDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="FjYN/QEV"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OXK2gKey; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VTwL+fok; 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 a92af1059eb24-1b5567d5814si50284906c88.28.2026.11.26.07.12.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Nov 2026 07:12:16 -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="FjYN/QEV"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=OXK2gKey; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=VTwL+fok; 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-Unsubscribe-Post: List-Owner; bh=IF7u+ACRe13nQsHuyuLJLMuzXrOBAc4Xr3k9OIvpa8E=; b=FjYN/QEVzPw7Fo G9/b2ty38cqImlUxE5tlHnQtbQGg/UItvodcOMWzItiAvIg/B96C6gOME1He/EC6PkdA6sVqZD0BV PDZiDpYENHnAANUspx9M2VQwGVezs+R8zCKnkytcPVRTw8HywUdAR9ej7aHjvxafVlPdAfLtpH3ij CkA=; 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.100.1) (envelope-from ) id 1xWb8v-000000007CE-1ydl; Thu, 26 Nov 2026 15:12:13 +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.100.1) (envelope-from ) id 1xWb8r-000000007C5-0qDe for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 15:12:09 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8rXBYPEORMTyMVO3mwg4i48EIdqpT36hBNUIjBzKu/s=; b=OXK2gKeyTvpfLcMU/hTBu2ZOkv kguh6PVJ561RbM5jO1Mc8wBgQ7FkYrDg0bfUI/XkPM/UD/meLC/az/okKfdFC8mRuK59IWYowkpio P7H8BOOx4MtcGHLhdMeehr8u93IJoJE6WI8hFPEldUCC3StxNFZRZhy/9NWeLiFylpUo=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8rXBYPEORMTyMVO3mwg4i48EIdqpT36hBNUIjBzKu/s=; b=VTwL+fok+1gRsV20nhItmJQUMC TvI5xe43+LQg1wvs8+lxQsu4zb05WonLXTljXXcuCcfAx790utnHRfDuXkXPCWhaH7UKFfhT1JLzz H6z1rPZe0Qk0+4oYjT/XsUlpUZvWbdJE+Boc3iNR4G2nIewJNizIvVLy/B0lqz//U6cY=; Received: from [193.149.48.129] (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.100.1) id 1xWb8p-000000006SG-1KtM for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 15:12:09 +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 6AQFC0kC027673 for ; Thu, 26 Nov 2026 16:12:00 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AQFC06Z027672 for openvpn-devel@lists.sourceforge.net; Thu, 26 Nov 2026 16:12:00 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 26 Nov 2026 16:11:54 +0100 Message-ID: <20261126151159.27658-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 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: Razvan Cojocaru Four standalone event loops checked signal_received, called man_check_for_signals() if it was unset, then checked it again. Make man_check_for_signals() return true right away when a signal is already [...] 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: 1xWb8p-000000006SG-1KtM Subject: [Openvpn-devel] [PATCH v2] manage: return early from man_check_for_signals() if a signal is set 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: 1882934148132293273 X-GMAIL-MSGID: 1882934148132293273 From: Razvan Cojocaru Four standalone event loops checked signal_received, called man_check_for_signals() if it was unset, then checked it again. Make man_check_for_signals() return true right away when a signal is already set, so each loop needs a single call. Change-Id: Ibc58b9c3029ffea4f87093178cf52bbb46f6d837 Signed-off-by: Razvan Cojocaru Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2352 --- 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/+/2352 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index bbf454a..96428c0 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -3444,6 +3444,10 @@ { if (signal_received) { + if (*signal_received) + { + return true; + } get_signal(signal_received); if (*signal_received) { @@ -3620,11 +3624,7 @@ do { man_standalone_event_loop(man, &signal_received, expire); - if (!signal_received) - { - man_check_for_signals(&signal_received); - } - if (signal_received) + if (man_check_for_signals(&signal_received)) { return; } @@ -3762,11 +3762,7 @@ do { man_standalone_event_loop(man, &signal_received, 0); - if (!signal_received) - { - man_check_for_signals(&signal_received); - } - if (signal_received) + if (man_check_for_signals(&signal_received)) { ret = false; break; @@ -3847,11 +3843,7 @@ do { man_standalone_event_loop(man, &signal_received, 0); - if (!signal_received) - { - man_check_for_signals(&signal_received); - } - if (signal_received) + if (man_check_for_signals(&signal_received)) { goto done; } @@ -3990,11 +3982,7 @@ do { man_standalone_event_loop(man, &signal_received, 0); - if (!signal_received) - { - man_check_for_signals(&signal_received); - } - if (signal_received) + if (man_check_for_signals(&signal_received)) { break; }