From patchwork Thu Apr 10 21:50:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4217 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:8598:b0:63e:cbae:3930 with SMTP id az24csp1718756mab; Thu, 10 Apr 2025 14:51:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUy1sN0K5OSvkaVWPLon6Ta8ObCgI2jKjGYPz6LjJpIM/v8Sw7/KvzxFJT4L5YgLnf1qyTw4GK9cN0=@openvpn.net X-Google-Smtp-Source: AGHT+IFBeSr6EqrDjpkIhQK6mraomSTtrH1yIq+F1jbh5dVFqtkYuaq342Rz/9DMs0VuiRK/cyZA X-Received: by 2002:a05:6e02:3112:b0:3d5:893a:93ea with SMTP id e9e14a558f8ab-3d7ec21a9fbmr5228235ab.13.1744321876703; Thu, 10 Apr 2025 14:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1744321876; cv=none; d=google.com; s=arc-20240605; b=Z4E08XK3ir/ivTCCUaSSv6S5ZDiW5liv+9NZpzoaseF6t5lddG0Fpfa8a2BHVyZ9dT CQz34TEIPoATgXzEZ7NWs8EvW3xXNdN1eXZnPbjDINmMVoPqjK+0TK6hsqwtVvglBHxB +GKfDR6O5pyfyQWt3rTA2vSDCWLj+Nm0sREZUvuteL6V+Xt5+EkwoQASnRcALY/CTY3/ Rvy4ksSKLLP5Bn1xrZlgwGn2gRFGPJZy5oXwQC5qkAnvfahRcV0qf+eU3qwq/h8UoYcv Ix4TVysOjdhHRATn8/TLjenThRGCBMBk/dAcRDWoQ0uww3+vN4awQBKg4oeBDt5AXbUl YZ9g== 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; bh=AXYV/aP4+EPPrfIyELTbNuQEl90u/5HKSbVQwrsJN44=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=G0+drrGEhdnkP75HF2E9WIHKsh0/zhOsW19z7ttVAL0Pb76QWeTa03hg53kI8TChpz Wjq/+tbqkVLFAH65408xgxl1GXwPN14Rb910L1b/rF10lspyI9Q5hTBEdhczpFUgS2a5 ofWhUhW23vpXpeCLBuPBSdtHH8yQiGG7BreVWoRS2fTKQx/RxYZD8T6Tit2qaOK63tKu 1dqC4tLmeQF6NLaykixCo5qxGY35rDYfe4ncEnzGZcBjLjBHdtBpI4Nb5fo5cMutEDp3 5lE3CpPMS92S9q1pd5j76zdoY68pCnB2bEoewySkbzFPGwFz6UQCBIb3XcdNmCBZ+CPp SgcQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mIQI8Qux; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="f7fuDI/x"; 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 8926c6da1cb9f-4f505d4219bsi4268390173.69.2025.04.10.14.51.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Apr 2025 14:51:16 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=mIQI8Qux; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="f7fuDI/x"; 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 [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1u2zni-0001sL-Cd; Thu, 10 Apr 2025 21:51:10 +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.95) (envelope-from ) id 1u2znh-0001sF-5t for openvpn-devel@lists.sourceforge.net; Thu, 10 Apr 2025 21:51: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-Subscribe:List-Post:List-Owner:List-Archive; bh=glagpUJUxrib34Voa24wzVhLtU3rRZWh3epNV13evLM=; b=mIQI8QuxHIaBdrm5VnS3cnsULj JqsJMHMa8dr6WYGSKY5Kj22M9Q45S9djHHNIgYPeyA9OqjsOLVEggVKnoQcGflHvOy5pElmK71t9K na1TjRaCK1x09J7YGtmAh2owHJbvakIRjxFqaEcjvYMjv+WEging1B94y0kiS9QwnX2I=; 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=glagpUJUxrib34Voa24wzVhLtU3rRZWh3epNV13evLM=; b=f7fuDI/xtIAxSPLgFNIIwCrV8V jV+VvYmsjq35yV5u3C+/mOjiXldI+1tfvpKf95mgz988PRO6pEMlEodNGBlNf9yXh4664hPCJtI7D nijUWXZiy6djQRa0Goysyhx51m5kAnL+Jz7PRqNLi90IdrJ3+foEu8KxTXfmvF3UMJIs=; Received: from dhcp-174.greenie.muc.de ([193.149.48.174] 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 1u2znO-0007iQ-6U for openvpn-devel@lists.sourceforge.net; Thu, 10 Apr 2025 21:51:09 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.17.1.9/8.17.1.9) with ESMTP id 53ALobYm011913 for ; Thu, 10 Apr 2025 23:50:37 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.17.1.9/8.17.1.9/Submit) id 53ALobnC011912 for openvpn-devel@lists.sourceforge.net; Thu, 10 Apr 2025 23:50:37 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 10 Apr 2025 23:50:29 +0200 Message-ID: <20250410215037.11878-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", 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 The recent introduction of the multisocket support did not account for some Windows-specific DCO paths. This patch restores correct behavior on Windows. Content analysis details: (0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in bl.score.senderscore.com] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [193.149.48.174 listed in sa-trusted.bondedsender.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1u2znO-0007iQ-6U Subject: [Openvpn-devel] [PATCH v4] Fix dco_win and multisocket interaction 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?1829054056116595838?= X-GMAIL-MSGID: =?utf-8?q?1829054056116595838?= From: Gianmarco De Gregori The recent introduction of the multisocket support did not account for some Windows-specific DCO paths. This patch restores correct behavior on Windows. Key changes: - Add WIN32 guards around DCO-specifc code. - Disable wait_signal() when running in server mode, as it conflicts with the event engine since Windows handles signals as I/Os. - Ensure correct socket handling for TCP vs UDP. Github: #720 Change-Id: I719b1aa2d2f4d63dc9c18d8e313fba339e3e4b0c 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/+/935 This mail reflects revision 4 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 af1d008..0b8b262 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2072,7 +2072,7 @@ /* * Calculate the flags based on the provided 'flags' argument. */ - if (flags & IOW_WAIT_SIGNAL) + if ((c->options.mode != MODE_SERVER) && (flags & IOW_WAIT_SIGNAL)) { wait_signal(es, (void *)err_shift); } diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 1d62ea6..86c5160 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -181,7 +181,8 @@ if (mi) { - if (defer || mbuf_defined(mi->tcp_link_out_deferred)) + if ((defer && !proto_is_dgram(mi->context.c2.link_sockets[0]->info.proto)) + || mbuf_defined(mi->tcp_link_out_deferred)) { /* save to queue */ struct buffer *buf = &mi->context.c2.to_link; diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index f1751ff..f4ca4df 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -176,10 +176,13 @@ int status, i; unsigned int *persistent = &m->multi_io->tun_rwflags; - for (i = 0; i < m->top.c1.link_sockets_num; i++) + if (!tuntap_is_dco_win(m->top.c1.tuntap)) { - socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_io->es, - &m->top.c2.link_sockets[i]->ev_arg); + for (i = 0; i < m->top.c1.link_sockets_num; i++) + { + socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_io->es, + &m->top.c2.link_sockets[i]->ev_arg); + } } if (has_udp_in_local_list(&m->top.options)) @@ -202,7 +205,8 @@ } #endif tun_set(m->top.c1.tuntap, m->multi_io->es, EVENT_READ, MULTI_IO_TUN, persistent); -#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) +#if defined(ENABLE_DCO) \ + && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32)) dco_event_set(&m->top.c1.tuntap->dco, m->multi_io->es, MULTI_IO_DCO); #endif @@ -535,7 +539,8 @@ multi_io_action(m, mi, TA_INITIAL, false); } } -#if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) +#if defined(ENABLE_DCO) \ + && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32)) /* incoming data on DCO? */ else if (e->arg == MULTI_IO_DCO) {