From patchwork Tue Sep 23 16:04:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4442 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:c08a:b0:72f:f16c:e055 with SMTP id jr10csp967932mab; Tue, 23 Sep 2025 09:05:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV148utqeiW2IJhdidc+CyiRnjwITJkgeffBTMcNXa/sp9SLH9glkp89Af3tTmm9NrkXEgzZPRjmP4=@openvpn.net X-Google-Smtp-Source: AGHT+IFTIuVkGQvfkZlMGeY8xmFY+XqR2O8k5VRXnlZmjIJM7fyT00ln5b3j1daVTHSZrJul64qP X-Received: by 2002:a05:6870:36c9:b0:30b:beb3:5420 with SMTP id 586e51a60fabf-34c7d2fb727mr1868580fac.17.1758643517593; Tue, 23 Sep 2025 09:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1758643517; cv=none; d=google.com; s=arc-20240605; b=Eir3tPJEq1r+UHsSUk5UIpCfKRhDZlfNh2WRcW5mm8OciFKxdNkeLm8LlpXEXUrqMs HaSEkbtPED22MR4TPU7MhRH1ePc+WAtbM8SjehYTDAzKDlx88LXjqn8DNEUhr2NNYF1K 51E1lLg/5btgvf1CPs/vyq68wiADoqyE8umxQcZjYlAxWhsaoCqzQn+h/K3F60ZDEnl4 f3WEPtx7hSK6Cd+g454EfgL9UBesU8ryum6Ju3zcFDXg3vBF3kPG435XS05DMs2XaqXI jhVsBSriHS8kxsM8ayw9QOuzAZwqBPSWXhylYubRYINFAbAiMuy2Fno/zytxjj5sSp2x VEgQ== 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=8HC4MIWu1pFVJtPcPvbrS98yoC7iJ0KqtYjMyuMoQ1c=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=R86fEWQNAgJ7s7JqHnM/TPD3vz/HxLFMRxog92ZTH5bb8bpn2IgFxEvbvIMGslhnJM HH9ISCdUkuClGD2rXLnStYxP0XrHWN/TDORS9yhEK4ZcT+87ie8PVH668cux9y+IEZfR FTAatcZUHIbih4imN3EDDOd7/hXVyCvdCFPKPxzPl1UoSuE6UfEF96vcvZZG6gGGP3VW QcjPnyDdD+EMxNgMeD9rh8xhU/bFPp/WJWPsIcYiHBTpuJqmeoch9bYcK4x0iMDQx3rP ZnMaVygGX4cRlK30U3LZ5Exi5WEKO4Nb0FDOGr/+Kkgym0mbLpgfRhWMzKhx/dQiItHb G0qQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=BcVx5YQF; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=eT86g+dH; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="dUHpW/1R"; 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 586e51a60fabf-3499059eeb2si1081173fac.76.2025.09.23.09.05.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2025 09:05:17 -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=BcVx5YQF; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=eT86g+dH; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="dUHpW/1R"; 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=8HC4MIWu1pFVJtPcPvbrS98yoC7iJ0KqtYjMyuMoQ1c=; b=BcVx5YQFJK2Mvb96TbzALhb63Q JfVyqrMwhnADdFuaTu8iPrhhaO6kpMgj4MEMO1lAiSXqADllGXQEdS3O43akHHsO/K8YQeamrQpyv oChitIQ3gMRfopCXNnxCpzf5jF4LvvBXah4MswGFkXkSys0BX+TiEbkfVc6oeT/9MR+Q=; 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 1v15Vx-00034P-TV; Tue, 23 Sep 2025 16:05: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.95) (envelope-from ) id 1v15Vw-00034H-Jv for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 16:05:12 +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=dcWZnKp7Qape03n5Edsl1HdrEL7m21yA9QZXsQJyuH0=; b=eT86g+dHYDQyVMoS1Y6OK+4ZgX 7FPb8TNQAea80jXr3MJIw6MfsrCWAgImWYZHbecv1UKUGJVXf4QrZot9jJotG037tWzEwcIQw5fbQ OAZcz42PlPhRoH/WKAXkOVQW/IAdM3WcWP3losW+YdzM0GfIqAJ+H9Ctbj8SR8wzzCvM=; 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=dcWZnKp7Qape03n5Edsl1HdrEL7m21yA9QZXsQJyuH0=; b=dUHpW/1R3diaKWX59lyMEJfWw5 v5cX78omEPSzPUAFJ4zdWPMkziVKj9rTezujNaDbaf9AuPp8Nrpab4PTG1p4MFzRpIb9tFwdyNNOm +qpxnhapRYR1KlVUBbe7qPpuwvm/0Xh7jQvAC8JOK3o+Elsu2Z4BZrdHiUUZ3F8SFLuY=; Received: from [193.149.48.134] (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 1v15Vv-0001qh-BE for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 16:05:12 +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 58NG4xeZ032314 for ; Tue, 23 Sep 2025 18:04:59 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 58NG4xAJ032313 for openvpn-devel@lists.sourceforge.net; Tue, 23 Sep 2025 18:04:59 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 23 Sep 2025 18:04:53 +0200 Message-ID: <20250923160459.32273-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: Frank Lichtenheld We take two values and try to massage them in various ways. But this function only has one caller and that puts exactly the same value into both of them. So simplify the code. 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: 1v15Vv-0001qh-BE Subject: [Openvpn-devel] [PATCH v1] multi_io_init: simplify 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?1844071385347918663?= X-GMAIL-MSGID: =?utf-8?q?1844071385347918663?= From: Frank Lichtenheld We take two values and try to massage them in various ways. But this function only has one caller and that puts exactly the same value into both of them. So simplify the code. Change-Id: I9cb8aa6ef01445cb99758583aba8ae8f9ded0862 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1209 --- 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/+/1209 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 9256127..1d2ee53 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -411,7 +411,7 @@ /* * Initialize multi-socket I/O wait object */ - m->multi_io = multi_io_init(t->options.max_clients, &m->max_clients); + m->multi_io = multi_io_init(m->max_clients); m->tcp_queue_limit = t->options.tcp_queue_limit; /* diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index ece789c..0bfbb63 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -113,21 +113,18 @@ } struct multi_io * -multi_io_init(int maxevents, int *maxclients) +multi_io_init(const int maxclients) { struct multi_io *multi_io; - const int extra_events = BASE_N_EVENTS; - ASSERT(maxevents >= 1); - ASSERT(maxclients); + ASSERT(maxclients >= 1); ALLOC_OBJ_CLEAR(multi_io, struct multi_io); - multi_io->maxevents = maxevents + extra_events; + multi_io->maxevents = maxclients + BASE_N_EVENTS; multi_io->es = event_set_init(&multi_io->maxevents, 0); wait_signal(multi_io->es, MULTI_IO_SIG); ALLOC_ARRAY(multi_io->esr, struct event_set_return, multi_io->maxevents); - *maxclients = max_int(min_int(multi_io->maxevents - extra_events, *maxclients), 1); - msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=%d maxevents=%d", *maxclients, + msg(D_MULTI_LOW, "MULTI IO: MULTI_IO INIT maxclients=%d maxevents=%d", maxclients, multi_io->maxevents); return multi_io; } diff --git a/src/openvpn/multi_io.h b/src/openvpn/multi_io.h index 07eb3d4..4a3c60d 100644 --- a/src/openvpn/multi_io.h +++ b/src/openvpn/multi_io.h @@ -61,7 +61,7 @@ #endif }; -struct multi_io *multi_io_init(int maxevents, int *maxclients); +struct multi_io *multi_io_init(int maxclients); void multi_io_free(struct multi_io *multi_io);