From patchwork Mon Nov 24 17:58:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4628 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6c3:b0:7b1:439f:bdf with SMTP id j3csp2062107maw; Mon, 24 Nov 2025 09:59:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUvlw38tDjXNkq638p66rTK0ta5JxFdGSadrCadQTuUC6HqWs4S/LSs4A6qrlKjoNXf/5ebYT7BAyU=@openvpn.net X-Google-Smtp-Source: AGHT+IGF9Eo9ghOI0uzqrOT2blyjG6GqyqhCLsSBxzgasRMoQ8yR1f7JOL/9V8nH/H3+D1kQnF8b X-Received: by 2002:a05:6808:1446:b0:450:d4b5:3527 with SMTP id 5614622812f47-45101e71dd7mr6982348b6e.24.1764007163688; Mon, 24 Nov 2025 09:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1764007163; cv=none; d=google.com; s=arc-20240605; b=MgBivKd08Fqh9qk8RhPO2OP4S+tC3EB8Od/2gvlnjhwBBhHbG2IQkkR3nGLxculabl ba0Y+hNATZhxmn8j40aVpvLe5B3/OkZUtPCUR7djGT4dywbkctUeDKIU8gjRSBFm4HDF DvAMTRoqX88JSAnQ1cNDwCZ+f/yYcNAZoGCmJdwlwxRfq0JP5PX35ByY043G3w8bx52w E6Scvllc/kpOuO1032bHjD76UDpSaMOn4naEiF+4jCS115V8TD2UN9Dk6NR9Hmy5muf4 tHrMugyHAd7MbpoGXipjdNvJnwqjoUMoQi7kKiRmB9rmMBVo7jn6aUZQpl1vYcPJHQn3 RowQ== 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=4IknLDg/xLI4TeRqR1q07pGCZeuVPJ+DWPkkEpIo+Oo=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=IH0b6vEyvZ+yhxdEU3vfuQNxfo62ik1fXqh5SohlUKyyhJKfhF0ToYFzan5kn0aSZo CK5Sr8IZ5CRTibC/RcgTiPwyQKM+oY6gJYt+fTQJAtaVinvv7c/iOGDWoXXw73w5qETW bTYgffrtl97fWymvH/1J3FgxXk9lkCug1P9C3xjphvtxfw33ZJVuR9i3M/s7Ik1yh1kI 3yz9dqaw66G3mwgpmdSWJHm0rrmy83XhUNXNM+oOx2UsDafL9xVeFO2EByldGtMzCSzj ajlsZOXVhtgJjXejdbRcIW4LUwxMhykvo3gaj8kiQGl38dGqUdBWUsFi8jjvl2dqYcAk GHUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=GAjitOhM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BJQUlal1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=WOdP+Uih; 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 006d021491bc7-65782bb28cdsi1945468eaf.169.2025.11.24.09.59.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Nov 2025 09:59:23 -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=GAjitOhM; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=BJQUlal1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=WOdP+Uih; 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=4IknLDg/xLI4TeRqR1q07pGCZeuVPJ+DWPkkEpIo+Oo=; b=GAjitOhMg1BuvozujImNx10his 6vdNs1Aqj02Rcknd5qRRcPJRpzknJ0QyNnaBgzDgpLWxi91KYzUFHJj1nh098/TjfASQEEhUw5ZN9 fnhdhWfQz7iXP0xJRmXC9FYY/XsMFgTBJlCXkklcVm6vBO++1xXpXfux3wf++ENU9FNI=; 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 1vNaqP-0000iE-PF; Mon, 24 Nov 2025 17:59:21 +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 1vNapp-0000hW-RF for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 17:58:45 +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=v8blgJEBhQAI9Vlu8B0X+qtxPcLeLxEmCoG4ON3IKSU=; b=BJQUlal1Trtta7emjV63uzjBum GnTQ11fpw5qS+/IcHaaVvmepQpaLq1ALQyqbbv07QJeB25Vpw9Ds596COZKseQVVSp7ih+0YKxMeq ctiR0yN4yKwK8uxFmyHj7rKRdL+e434CKlYNc2K0Gs5YQ1PnDS+p3UAYgskQGVe1IV0Q=; 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=v8blgJEBhQAI9Vlu8B0X+qtxPcLeLxEmCoG4ON3IKSU=; b=WOdP+UihLiFqlENO45AUeUvEQz ou9qyWbvLOJeYPPoqjM1xU+3rk7LlTWzSu9mPUF2eWfueB0cUy6wD3ofzBX+CdUD05TQhskK48mMV s/aLJ2V7LFxcQZdl82vQInT9CNe5X/poj/d/uaG22oCIfNSgzQsWoFSRZw8XAVc96n+E=; 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 1vNapo-0005Uu-Td for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 17:58:45 +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 5AOHwXoh021371 for ; Mon, 24 Nov 2025 18:58:33 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 5AOHwX8H021370 for openvpn-devel@lists.sourceforge.net; Mon, 24 Nov 2025 18:58:33 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 24 Nov 2025 18:58:27 +0100 Message-ID: <20251124175832.21352-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 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 Tuntap flags are already handled within multi_io_process_io() so return them by multi_io_process_flags() would be redoundant, since we need them only for tun_set(). 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: 1vNapo-0005Uu-Td Subject: [Openvpn-devel] [PATCH v3] multi-socket: do not return tuntap flags on server-side 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?1849695575548464172?= X-GMAIL-MSGID: =?utf-8?q?1849695575548464172?= From: Gianmarco De Gregori Tuntap flags are already handled within multi_io_process_io() so return them by multi_io_process_flags() would be redoundant, since we need them only for tun_set(). While at it, removed part of the I/O process from multi_process_io_udp() since those are also handled within multi_io_process_io(), removed the FILE_CLOSED and FILE_SHIFT defines since we now handle that kind of event in multi_io_process_io() through the MULTI_IO_FILE_CLOSE_WRITE define. Change-Id: I6a5110a0583b8b33496b06d9c27c1084df38e842 Signed-off-by: Gianmarco De Gregori Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1364 --- 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/+/1364 This mail reflects revision 3 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/event.h b/src/openvpn/event.h index f6aa9c4..c2c63f6 100644 --- a/src/openvpn/event.h +++ b/src/openvpn/event.h @@ -68,8 +68,6 @@ #define MANAGEMENT_SHIFT 6 #define MANAGEMENT_READ (1 << (MANAGEMENT_SHIFT + READ_SHIFT)) #define MANAGEMENT_WRITE (1 << (MANAGEMENT_SHIFT + WRITE_SHIFT)) -#define FILE_SHIFT 8 -#define FILE_CLOSED (1 << (FILE_SHIFT + READ_SHIFT)) #define DCO_SHIFT 10 #define DCO_READ (1 << (DCO_SHIFT + READ_SHIFT)) #define DCO_WRITE (1 << (DCO_SHIFT + WRITE_SHIFT)) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index a6d3394..ccb8404 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2170,10 +2170,10 @@ void get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io, const unsigned int flags) { - unsigned int out_socket, out_tuntap; + unsigned int out_socket; - multi_io_process_flags(c, multi_io->es, flags, &out_socket, &out_tuntap); - multi_io->udp_flags = out_socket | out_tuntap; + multi_io_process_flags(c, multi_io->es, flags, &out_socket, NULL); + multi_io->udp_flags = (out_socket << SOCKET_SHIFT); } void diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 31134be..b03e165 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -333,7 +333,7 @@ } /* - * Process an I/O event. + * Process a UDP socket event. */ void multi_process_io_udp(struct multi_context *m, struct link_socket *sock) @@ -343,50 +343,11 @@ ? (MPP_CONDITIONAL_PRE_SELECT | MPP_CLOSE_ON_SIGNAL) : (MPP_PRE_SELECT | MPP_CLOSE_ON_SIGNAL); -#ifdef MULTI_DEBUG_EVENT_LOOP - char buf[16]; - buf[0] = 0; - if (status & SOCKET_READ) - { - strcat(buf, "SR/"); - } - else if (status & SOCKET_WRITE) - { - strcat(buf, "SW/"); - } - else if (status & TUN_READ) - { - strcat(buf, "TR/"); - } - else if (status & TUN_WRITE) - { - strcat(buf, "TW/"); - } - else if (status & FILE_CLOSED) - { - strcat(buf, "FC/"); - } - printf("IO %s\n", buf); -#endif /* ifdef MULTI_DEBUG_EVENT_LOOP */ - -#ifdef ENABLE_MANAGEMENT - if (status & (MANAGEMENT_READ | MANAGEMENT_WRITE)) - { - ASSERT(management); - management_io(management); - } -#endif - /* UDP port ready to accept write */ if (status & SOCKET_WRITE) { multi_process_outgoing_link(m, mpp_flags); } - /* TUN device ready to accept write */ - else if (status & TUN_WRITE) - { - multi_process_outgoing_tun(m, mpp_flags); - } /* Incoming data on UDP port */ else if (status & SOCKET_READ) { @@ -396,35 +357,6 @@ multi_process_incoming_link(m, NULL, mpp_flags, sock); } } - /* Incoming data on TUN device */ - else if (status & TUN_READ) - { - read_incoming_tun(&m->top); - if (!IS_SIG(&m->top)) - { - multi_process_incoming_tun(m, mpp_flags); - } - } -#ifdef ENABLE_ASYNC_PUSH - /* INOTIFY callback */ - else if (status & FILE_CLOSED) - { - multi_process_file_closed(m, mpp_flags); - } -#endif -#if defined(ENABLE_DCO) - else if (status & DCO_READ) - { - if (!IS_SIG(&m->top)) - { - bool ret = true; - while (ret) - { - ret = multi_process_incoming_dco(m); - } - } - } -#endif m->multi_io->udp_flags = ES_ERROR; }