From patchwork Tue Oct 27 10:23:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5510 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:ea99:b0:8dc:5c83:a4ec with SMTP id ov25csp3865486mab; Tue, 27 Oct 2026 03:23:41 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBw0aq+ICGBhEX13vzLADZHHvQtEu4W6mUQZgQ0hB4j2PSwiXPQBupSbY1/IV5eypvyIZqWQMobPl/U=@openvpn.net X-Received: by 2002:a05:6820:83cc:10b0:6e0:fb60:d5b4 with SMTP id 006d021491bc7-70ba0b60936mr3744657eaf.7.1793096621271; Tue, 27 Oct 2026 03:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793096621; cv=none; d=google.com; s=arc-20260327; b=bnyCRpsvaqy9OfWEUKXEe6srWvah+Q6BlNy8PSpCBbpHpPPq2T0J8fIxSPIgZFdhe+ olqQNt4jZ0C6S0ggSccNFUcIIQ1JWdfxmzs8fWiQZFTE085XCqTi34Ozbf+vdOs4KN1g Y0KCCfJTVhcU3uVF06Z3LqPSQi4yzd44gOkbjx3c9GtMWE8cvS0rD9tx3yrviaP1p511 UZY6uRaJb3gpQdze5bHwuUn2I2FzbQD9l1hKnNQkiZVsuRPbOjoxMT1GSYVBx/6lpFuR kg1zguGK9CIO25CpD6HZt0D8+9ViHdh5nUMyIZIsCb2xKxezr2cT+0BHJhrKhrQuxCFe Dbog== 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=aBqhicanApuvAQJIquQnlmSzb2hGZ7JRcyh1OClIjps=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=suHWxMi6bkjYVgi0TgE5vYAevQRnZA5ZGOLYoFcCk3N9VRPNb38ACpX1rFBia3PYvg cnJVRq4ySEULUZ0afmimzLPlIUFSnwcryX9gITqj8cJMTvlNUPsloCK6PC1Yx/6YFfxP cITsbg1e8doLN1lG5zYl3paI1tbRzKTyVZ99I0NOgmwAJrJ3vswUWJMh08FsZccf9N9n jfcIAHVQJ0o0D3vcb5PXRi6R54ixEdrTFKw2UgT+zXkSW+qDzUhvwhOEZC3qly7Y/r8g BugXMdLgkG4M3ft2yTNKD9JRPPVV8CLpT+xZmzQ03ERhWXVphC5ulfbpxHJMIVgHKI4y lD1g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=gFDkr+xH; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=a2nnaoGC; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mZeE8Sgs; 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-4a842ef349fsi12451987fac.21.2026.10.27.03.23.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2026 03:23:41 -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=gFDkr+xH; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=a2nnaoGC; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mZeE8Sgs; 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=aBqhicanApuvAQJIquQnlmSzb2hGZ7JRcyh1OClIjps=; b=gFDkr+xHFdO5qh 4KwngpolGAtNhQPBzWOWTRHRcwh4A4WycwKxTxNEpn8iUNcTIxch8bNAi1QToRSjNP3jme2autjgD /v5p3sFVRe7OiPJdSUJ1KFa4hvhrS0P7mVjDZBVpumoe5+sau9JJf5IlvIMbB2J6IG4WYi9nTC4G7 qCE=; 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 1xLeLD-000000004RH-1mec; Tue, 27 Oct 2026 10:23:39 +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 1xLeLB-000000004RA-33gI for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 10:23:37 +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=WQvyUFX1aX1DCmz9ltV6ASovzI/RHI6eWiHR/v1fxuA=; b=a2nnaoGCIHooFtSq7m8GIDLr3+ 26P3YnWIVqqPHvGXrq2I+dtypMfDrafPMFGTXLIDiugh8IlzzjF/+dKFyon8RnEJ2VXNGYISdzedW B5U90cbs/DX1SLW1G5IascHp/xswmxwtqoYMZD0NEJUmUAS+Y2wdegyP7guqRu8IvpuQ=; 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=WQvyUFX1aX1DCmz9ltV6ASovzI/RHI6eWiHR/v1fxuA=; b=mZeE8SgsaJKIU1vJp3A3n/NBs0 27Bm6vNx6NFqr5B5afEqT4Bm97Sf1+W4Y9cbmfJnU9cWpdV39vrFL/Gz9QIa9LTiGsf1I6jhFulh9 ek0ujhhggNGWSbKaqs1vfY1OYQh9I+abCJ/7wDzvdq2vFV9BJEpPo5mGrEcc2dMaHUW0=; 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 1xLeL7-000000002F5-1eTg for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 10:23:37 +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 69RANQsH019461 for ; Tue, 27 Oct 2026 11:23:26 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 69RANQih019460 for openvpn-devel@lists.sourceforge.net; Tue, 27 Oct 2026 11:23:26 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 27 Oct 2026 11:23:20 +0100 Message-ID: <20261027102325.19448-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_process_outgoing_tun() lived as a static inline in multi.h and multi_process_drop_outgoing_tun() in multi.c, while their only caller is multi_io_dispatch(). Move both next to it, as static funct [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URI: openvpn.net] 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xLeL7-000000002F5-1eTg Subject: [Openvpn-devel] [PATCH v1] multi_io: move the tun write functions to multi_io.c 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: 1880198082850345807 X-GMAIL-MSGID: 1880198082850345807 From: Gianmarco De Gregori multi_process_outgoing_tun() lived as a static inline in multi.h and multi_process_drop_outgoing_tun() in multi.c, while their only caller is multi_io_dispatch(). Move both next to it, as static functions named multi_io_write_tun() and multi_io_drop_tun(), so that writing to the tun device is found where the state machine decides to do it. No functional change. Change-Id: I89303975dd559d7cc06484a99f15c7062d3a3437 Signed-off-by: Gianmarco De Gregori Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2042 --- 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/+/2042 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index e302a81..2e804ff 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -3766,27 +3766,6 @@ } /* - * Drop a TUN/TAP outgoing packet.. - */ -void -multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags) -{ - struct multi_instance *mi = m->pending; - - ASSERT(mi); - - set_prefix(mi); - - msg(D_MULTI_ERRORS, "MULTI: Outgoing TUN queue full, dropped packet len=%d", - mi->context.c2.to_tun.len); - - buf_reset(&mi->context.c2.to_tun); - - multi_process_post(m, mi, mpp_flags); - clear_prefix(); -} - -/* * Per-client route quota management */ diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 5db7147..2d4983c 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -295,7 +295,7 @@ * function controls the necessary postprocessing. It is called by many * other functions that handle VPN tunnel related activity, such as \c * multi_process_incoming_link(), \c multi_process_outgoing_link(), \c - * multi_process_incoming_tun(), \c multi_process_outgoing_tun(), and \c + * multi_process_incoming_tun(), \c multi_io_write_tun(), and \c * multi_process_timeout(), among others. * * @param m - The single \c multi_context structure. @@ -364,8 +364,6 @@ bool multi_process_incoming_tun(struct multi_context *m, const unsigned int mpp_flags); -void multi_process_drop_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags); - struct multi_instance *multi_get_queue(struct mbuf_set *ms); void multi_ifconfig_pool_persist(struct multi_context *m, bool force); @@ -627,41 +625,6 @@ } -/** - * Send a packet over the virtual tun/tap network interface to its locally - * reachable destination. - * @ingroup internal_multiplexer - * - * This function calls \c process_outgoing_tun() to perform the actual - * sending of the packet. Afterwards, it calls \c multi_process_post() to - * perform server-mode postprocessing. - * - * @param m - The single \c multi_context structure. - * @param mpp_flags - Fast I/O optimization flags. - * - * @return - * - True, if the \c multi_instance associated with the packet sent was - * not closed due to a signal during processing. - * - Falls, if the \c multi_instance was closed. - */ -static inline bool -multi_process_outgoing_tun(struct multi_context *m, const unsigned int mpp_flags) -{ - struct multi_instance *mi = m->pending; - bool ret = true; - - ASSERT(mi); -#ifdef MULTI_DEBUG_EVENT_LOOP - printf("%s -> TUN len=%d\n", id(mi), mi->context.c2.to_tun.len); -#endif - set_prefix(mi); - vlan_process_outgoing_tun(m, mi); - process_outgoing_tun(&mi->context, mi->context.c2.link_sockets[0]); - ret = multi_process_post(m, mi, mpp_flags); - clear_prefix(); - return ret; -} - #define CLIENT_CONNECT_OPT_MASK \ (OPT_P_INSTANCE | OPT_P_INHERIT | OPT_P_PUSH | OPT_P_TIMER | OPT_P_CONFIG | OPT_P_ECHO \ | OPT_P_COMP | OPT_P_SOCKFLAGS) diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index ebee86c..164b214 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -290,6 +290,62 @@ } } +/** + * Send a packet over the virtual tun/tap network interface to its locally + * reachable destination. + * @ingroup internal_multiplexer + * + * This function calls \c process_outgoing_tun() to perform the actual + * sending of the packet. Afterwards, it calls \c multi_process_post() to + * perform server-mode postprocessing. + * + * @param m - The single \c multi_context structure. + * @param mpp_flags - Fast I/O optimization flags. + * + * @return + * - True, if the \c multi_instance associated with the packet sent was + * not closed due to a signal during processing. + * - Falls, if the \c multi_instance was closed. + */ +static bool +multi_io_write_tun(struct multi_context *m, const unsigned int mpp_flags) +{ + struct multi_instance *mi = m->pending; + bool ret = true; + + ASSERT(mi); +#ifdef MULTI_DEBUG_EVENT_LOOP + printf("%s -> TUN len=%d\n", id(mi), mi->context.c2.to_tun.len); +#endif + set_prefix(mi); + vlan_process_outgoing_tun(m, mi); + process_outgoing_tun(&mi->context, mi->context.c2.link_sockets[0]); + ret = multi_process_post(m, mi, mpp_flags); + clear_prefix(); + return ret; +} + +/* + * Drop a TUN/TAP outgoing packet.. + */ +static void +multi_io_drop_tun(struct multi_context *m, const unsigned int mpp_flags) +{ + struct multi_instance *mi = m->pending; + + ASSERT(mi); + + set_prefix(mi); + + msg(D_MULTI_ERRORS, "MULTI: Outgoing TUN queue full, dropped packet len=%d", + mi->context.c2.to_tun.len); + + buf_reset(&mi->context.c2.to_tun); + + multi_process_post(m, mi, mpp_flags); + clear_prefix(); +} + static struct multi_instance * multi_io_dispatch(struct multi_context *m, struct multi_instance *mi, const int action) { @@ -334,11 +390,11 @@ break; case TA_TUN_WRITE: - multi_process_outgoing_tun(m, mpp_flags); + multi_io_write_tun(m, mpp_flags); break; case TA_TUN_WRITE_TIMEOUT: - multi_process_drop_outgoing_tun(m, mpp_flags); + multi_io_drop_tun(m, mpp_flags); break; case TA_SOCKET_WRITE_READY: