From patchwork Fri Sep 12 13:12:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 4408 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:b149:b0:671:5a2c:6455 with SMTP id s9csp3796191maw; Fri, 12 Sep 2025 06:12:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWW9oyMcI8OI+GyenVKjoS2ewkIv6BAY/eMEjRmDkEcIkLQIIGvYKvIcZ2H/jW38/EFzz1VbxmoJl8=@openvpn.net X-Google-Smtp-Source: AGHT+IG0Sqj+0HYH6DYJv6hJWx0+sv539w6XAoThUzaxdXIUAiOtmUeIII4NWUPzCT10ViYRLLaZ X-Received: by 2002:a05:6830:6ab4:b0:745:a21c:6a63 with SMTP id 46e09a7af769-75353779bffmr1518101a34.9.1757682742852; Fri, 12 Sep 2025 06:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1757682742; cv=none; d=google.com; s=arc-20240605; b=WSEP99XWk8Z7E3bPEfgUKbM2TbbfqI5nYksrJrR8uouM9qikSEC2NPWK5G3aCt8E0+ e6AL84Slsvf7Lz8TmAXkQ9BvEPoH+Bb6NGg4muSHcnpHUJ/J3J3L9oBdjwGPa+VqFMJj 7sK71RJ/CIFGFqem5bVaKD3CDSoFGwhnw7daNLetE8jr93C4AyDYDeIvrGnJg93UDdV+ oPIPxhard5S3ufqEQePwjmp3BHMTx5COHQvH+vJQKAncMt+dM4p5LyXwrFAUprr3s0Gc VPqdVNJptnwIiS61fUS6izQHtM/EzkqYWzzEDShhK785v7lSFlNIJCuvUtUDY0k4jX9m JZ9w== 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:dkim-signature; bh=9R+hxkhaNFO7DT867f5xE6nan+nFUDT9FhmOnnihEFM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=YTrZ5QaP3lHb0ZRkvuFb0iLKVxGPUVfMkC1vnf9WPz0LEMqvwV0Hvhybb1TeM1yodz qr/jV1Ffe4xvi+DE1r72uJW/dM8BhVfB3eqn/mNbnkjVrC99sDpHqD/eJyimC4nDmKaK hK3OgFV+FEgiulnI04GqZeHwSB2sWvq+RwRXtkeTBgtrlKXHkM9WDz3rM611CqiOZw7L UuBOD9+27t7OqaC7xl4TsJGw1bRKTQ2NlCKyH18n0gm5wL0lAmNfCQC6BYbDeQgERKL4 87fgKfoqf8yrnGHR0fRYJrqf9x+MX03hmLiRZ8I5es5E0saXusUuOj+Cnk+x1MIrQwk3 /IeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=a82wjRo3; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Nd/bDHER"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=d0qq1ewb; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=gda++CXU; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 46e09a7af769-7531677b96dsi717001a34.246.2025.09.12.06.12.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Sep 2025 06:12:22 -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=a82wjRo3; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Nd/bDHER"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=d0qq1ewb; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=gda++CXU; 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 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=9R+hxkhaNFO7DT867f5xE6nan+nFUDT9FhmOnnihEFM=; b=a82wjRo3fVdJZx4jzShkSacz4o wQ2gOCFEPAHPyEmZiLfPd4eshUguVkRhnZMO/mRvCJjEPQIDS8FVjQq3ZpVlE3xfrv7jS1CWTkxLB Z2OjNyhB2UtNsaHBRcdSPZdKRv2m/juz+zlirGMDZvc1X58iW9sWfvtcxPANZky/1KLc=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1ux3Zc-0007SS-3d; Fri, 12 Sep 2025 13:12:20 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ux3Zb-0007SL-5y for openvpn-devel@lists.sourceforge.net; Fri, 12 Sep 2025 13:12:19 +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=sifYey8DTerH4nB1ohf58f09nVhoKa30h44ZdAcxjsM=; b=Nd/bDHERgVm3eogqXB2Rdje2Vx aIqocPg2KqWFGnfV2SdRcgDenW/FmXFrbTMtTBmV0epmpP9zmysz8aw6EyJlIwAwviSxM1UWXWscE x36iw5sqiVmsq/cwy633MHb7dEZqmlejWDU4TPGJs5UbJKsenHHTSVRgh0TnTmufMCDk=; 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=sifYey8DTerH4nB1ohf58f09nVhoKa30h44ZdAcxjsM=; b=d0qq1ewbUc0EdRypInmwpkKs1Q rlMEx2uCV5/EuB9aa9Maxbp9N+AWv+qQVYVpEw8/KoQ1N3N2VgkrhDEI/zDeqC0wVgBiAsvAWCQcj mVmbJGe4RcXCxhuSM6L+u40v/HEJJurzKWj7uQyrvACaY+owHI5LnbWsRjbZ7dHnqphU=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ux3Za-0000tG-5C for openvpn-devel@lists.sourceforge.net; Fri, 12 Sep 2025 13:12:19 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4cNZZx58FYz9tHp; Fri, 12 Sep 2025 15:12:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1757682729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sifYey8DTerH4nB1ohf58f09nVhoKa30h44ZdAcxjsM=; b=gda++CXUCysyFuZ7qhtUgelSPIkJL9HXWYh9pwwU1aA0swveSldBYblp/aoB5P2KaGsAPX kEpSez9DPqyHes8VPWhSyV7vo10+8IMakkMoD5XJdU2R2CugQERhAuQsxOhxjcS9n9U+x8 RwKXPSshL1Ij5IqlGf7llcn5MtfytLoelibXm4F+2JYIHQcIZk87ydUde95tXa/I3oGfTN IC9Qdm4uOruQU6+l8tb3Fy1L3g1PPbQ1y62iXtWZgvtv6dDsEwqU1K5v/aNL9E1UhLyTYW X/KOYZL1JkVl8+dDsmrwYIptzPOuRUkikImE7ZywnKIL9xps7d6BJMHCmIUUKQ== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of frank@lichtenheld.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=frank@lichtenheld.com From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Fri, 12 Sep 2025 15:12:07 +0200 Message-Id: <20250912131207.42597-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4cNZZx58FYz9tHp 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: From: Gianmarco De Gregori On Windows, multi-socket support failed with mixed protocols due to repeated socket_set() calls, which caused accept() to be triggered before having an event to process. This fix skips socket_set() ca [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-Headers-End: 1ux3Za-0000tG-5C Subject: [Openvpn-devel] [PATCH v3] Multi-socket win: avoid repeated socket_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: =?utf-8?q?1843063939785583114?= X-GMAIL-MSGID: =?utf-8?q?1843063939785583114?= From: Gianmarco De Gregori On Windows, multi-socket support failed with mixed protocols due to repeated socket_set() calls, which caused accept() to be triggered before having an event to process. This fix skips socket_set() calls for non-UDP sockets in MODE_SERVER inside multi_io_process_flags(). Change-Id: Ia389fcec50fb2bbc0aa5ad41a2c23c17c04e6e9b Signed-off-by: Gianmarco De Gregori Acked-by: Lev Stipakov --- 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/+/1174 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Lev Stipakov diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 03b6a0c..5d22fa3 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2121,10 +2121,15 @@ /* * Configure event wait based on socket, tuntap flags. + * (for TCP server sockets this happens in + * socket_set_listen_persistent()). */ for (int i = 0; i < c->c1.link_sockets_num; i++) { - socket_set(c->c2.link_sockets[i], es, socket, &c->c2.link_sockets[i]->ev_arg, NULL); + if ((c->options.mode != MODE_SERVER) || (proto_is_dgram(c->c2.link_sockets[i]->info.proto))) + { + socket_set(c->c2.link_sockets[i], es, socket, &c->c2.link_sockets[i]->ev_arg, NULL); + } } tun_set(c->c1.tuntap, es, tuntap, (void *)tun_shift, NULL);