From patchwork Tue Oct 27 12:44:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5513 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:78dc:b0:8dc:5c83:a4ec with SMTP id e28csp130824max; Tue, 27 Oct 2026 05:45:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBxZNHL72IiuQg1DRtmwspIiWqfRCZAtj0CmqhE1ZVL790H9/SXRq4Vu4EjvlNtyUVOgS7U9kHGqTUc=@openvpn.net X-Received: by 2002:a05:6830:7190:b0:828:ca8c:f880 with SMTP id 46e09a7af769-850fe6e7e8emr7664099a34.27.1793105114953; Tue, 27 Oct 2026 05:45:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793105114; cv=none; d=google.com; s=arc-20260327; b=NpzXfOKPyNItO0I8EUk7KYHXR27pTVMRJXNifnPZzQTUTRze09CgB9jM4aC/w3HOsq FeseSPg6gMMSun7hG19zZnR5NL+xNG/mLqYGYLJwUaxhWO/qI0LReiVf62Wj9yXbdU3A NVXG/7WeuGF++6uWoRji6cbfDstcH0gLC8AvzohahGu/l/nbfOBa88MSckmoOEUPCghS k/zcfd9a8a18Y6sGyRV5ZM4LTfu44EjEdaezScPITrYotlXzbhO1sWXqWnuISxWHOJAj DPRvFsaw/XsgGhNInTrs3egxdk/RRDugD4itFP7UUyIaI6kx1+DOi2hjmuYhr+lVH3wh tqqA== 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=CGe0p6NV/AHBVkpAJCZnEyRG55v9kZVXZ64KiGQP2UM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=SCKelgxQog1nmllBgP/VSUFShNdqaxwugfx5Cx3tnhxFBAIJAUUkfHFKg+2fQnOwlU nDidmAwdS2zYf1h7FSb5OQLagunLf+HBzTCD5+GAT5kNnTxd4b83VUGOnj1f/jmjYat5 pyqOpGK38pp96/L2UjnD3kXjWe92+mWGPmzPXZeMSCHrxyaqRFqzcBOoC2lRoAi+M2IQ uG/NCVmC5uKyaJiXaM4RFvOmsAn/ex3oLMpSXc7HwkGhU2tLHhWnSGprNBUiNUvWDJ2D luftiQx3s43pRVeItf7djnuYzIJd4Fl/oEIiXcyGzNqQTAJryXXaC+NqT4B/57VYOLkD ShIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Y8cRvi5n; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=AiHUh5Nz; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Nrx+yFnF; 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-850fb9312b4si15642310a34.37.2026.10.27.05.45.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2026 05:45:14 -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=Y8cRvi5n; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=AiHUh5Nz; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Nrx+yFnF; 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=CGe0p6NV/AHBVkpAJCZnEyRG55v9kZVXZ64KiGQP2UM=; b=Y8cRvi5nIMSeCd eX+XyEpmZQRvBAsZFKt9WrUlRvn+X3iJZCEF19JXMdpQICWQJ5o+GmWuTNncxrOCrvUF7Kw+UilzY dmRQqNAuHB05xYZHHFVCQKRLcV9L71wgTE9EksM3j31kzK7wPfk+/snL1knuyLiNoxk4hOgHjalav I1E=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xLgYC-000000008ES-1DyI; Tue, 27 Oct 2026 12:45:12 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xLgYB-000000008EL-0KGj for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 12:45:11 +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=+ri7qRQzgSusfu7eM3qNoH0HWq9fdLws/sfeK6tP6fA=; b=AiHUh5Nz6GqnSBKodF+zEcNd9l vU4Z7CAVFqReqJdXY4eRsDCfiZV+iqHqLoi5gZOYfoz6HRWoxUJ65gej6pU2aKstkRn1+x7WBJG+Q 0eH2IUs1rz8Ilr2bunB6Pp1Gca0t6rkwFr2OsVkd1M/fPVWeFiANca/ykAZ/mMe3CBg8=; 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=+ri7qRQzgSusfu7eM3qNoH0HWq9fdLws/sfeK6tP6fA=; b=Nrx+yFnF+O0YIh87usqZKLqPvM uBBCvrS6nqTTVRZd67n93y9apGflUKw108ru/xauG/PukAhwupdcdwHGJIAhnvWRVGIcbKKYEkIWF EBb0SiwAshurifMUfCT4fSqQCiTjvYNu5Xl8oQ4zTPxaUha+1NoKEW81A49Fqg7X/HAQ=; 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 1xLgY7-000000005hY-41U6 for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 12:45:11 +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 69RCj1mW000699 for ; Tue, 27 Oct 2026 13:45:01 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 69RCj14v000698 for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 13:45:01 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 27 Oct 2026 13:44:55 +0100 Message-ID: <20261027124501.682-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: Gianmarco De Gregori multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus regist [...] 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: 1xLgY7-000000005hY-41U6 Subject: [Openvpn-devel] [PATCH v1] multi_io: walk the link sockets once in multi_io_wait() 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: 1880206989007350377 X-GMAIL-MSGID: 1880206989007350377 From: Gianmarco De Gregori multi_io_wait() went over the link sockets twice: first to register every socket as a listening socket, then, if a UDP socket is configured, again to arm the UDP ones. The UDP sockets were thus registered twice, and on Windows the first pass created an FD_ACCEPT event for them. Walk the sockets once, arming the UDP sockets and registering only the TCP ones as listening sockets. Drop the mode check as well, since multi_io_wait() only runs in server mode. Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20 Signed-off-by: Gianmarco De Gregori Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045 --- 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/+/2045 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index 56216d4..fb4810b 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -168,27 +168,17 @@ int status; unsigned int *persistent = &m->multi_io->tun_rwflags; - if (!tuntap_is_dco_win(m->top.c1.tuntap)) + for (int i = 0; i < m->top.c1.link_sockets_num; i++) { - for (int i = 0; i < m->top.c1.link_sockets_num; i++) + struct link_socket *sock = m->top.c2.link_sockets[i]; + + if (proto_is_dgram(sock->info.proto)) { - socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); + multi_io_process_flags(&m->top, m->multi_io->es, sock, p2mp_iow_flags(m, sock)); } - } - - if (has_udp_in_local_list(&m->top.options)) - { - for (int i = 0; i < m->top.c1.link_sockets_num; i++) + else if (!tuntap_is_dco_win(m->top.c1.tuntap)) { - struct link_socket *sock = m->top.c2.link_sockets[i]; - - if ((m->top.options.mode == MODE_SERVER) && proto_is_dgram(sock->info.proto)) - { - unsigned int flags = p2mp_iow_flags(m, sock); - - multi_io_process_flags(&m->top, m->multi_io->es, sock, flags); - } + socket_set_listen_persistent(sock, m->multi_io->es, &sock->ev_arg); } }