From patchwork Thu Apr 1 02:13:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1696 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director15.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 6CIrM0PHZWAPNgAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:43 -0400 Received: from proxy5.mail.ord1d.rsapps.net ([172.30.191.6]) by director15.mail.ord1d.rsapps.net with LMTP id 6C3BMkPHZWAQBwAAIcMcQg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:43 -0400 Received: from smtp22.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy5.mail.ord1d.rsapps.net with LMTPS id KE6sMkPHZWCKMQAA8Zzt7w (envelope-from ) for ; Thu, 01 Apr 2021 09:14:43 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp22.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: 3887a7f4-92ec-11eb-bafe-5254001a15c2-1-1 Received: from [216.105.38.7] ([216.105.38.7:60316] helo=lists.sourceforge.net) by smtp22.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 23/4D-21051-247C5606; Thu, 01 Apr 2021 09:14:43 -0400 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.90_1) (envelope-from ) id 1lRx93-0001CQ-14; Thu, 01 Apr 2021 13:13:57 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8z-0001Bt-84 for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=tmfS1KtG8g5f0kEiRUZfQ1n0rGXoX11Z6hAsg98D68Y=; b=W6YJahDfsABuZzBGHbVy4pvM3b HC+MOfVEkRLKei95CvZ6iTAAL9lbguLOWm1gwuH8/lbIjubIhS7L2tC4Npy4c2b97XD4gS3W4e0sf KGTHfq8j0R1jFRBbRGfBIMyD1sv9lyjYI5nx1LrsHpFDsozbTdyTonN+YMChAub/rooA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding: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=tmfS1KtG8g5f0kEiRUZfQ1n0rGXoX11Z6hAsg98D68Y=; b=VxlsMw2vsYfEME4/n1UfRbUYNx mS59RJeuFYQHm+/zTDhCstgbIldkpWvNo2EzK/wVaivXfBe4O16H06MfnFAfE8gNdIsuDHav1BPvo L/nM01Gd499ig6tcBLOTEbp2OhbM7WWFCja4Pz5AkwEATiU9hWcXOutGraDQKZw9WfUM=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1lRx8s-0036al-IR for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:53 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.94 (FreeBSD)) (envelope-from ) id 1lRx8k-000J8L-FC for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3760 invoked by uid 10006); Thu, 01 Apr 2021 13:13:38 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:33 +0200 Message-Id: <20210401131337.3684-11-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210401131337.3684-1-arne@rfc2549.org> References: <20210401131337.3684-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 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: rfc2549.org] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lRx8s-0036al-IR Subject: [Openvpn-devel] [PATCH 10/14] Remove thread_mode field of multi_context 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox This is leftover of a never functional multi threaded openvpn implementation attempt. It serves no purposes anymore. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/mtcp.c | 2 +- src/openvpn/mudp.c | 2 +- src/openvpn/multi.c | 67 +++++++++++++++++++-------------------------- src/openvpn/multi.h | 10 +------ 4 files changed, 31 insertions(+), 50 deletions(-) diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 7d2a69b99..babed29ef 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -789,7 +789,7 @@ tunnel_server_tcp(struct context *top) } /* initialize global multi_context object */ - multi_init(&multi, top, true, MC_SINGLE_THREADED); + multi_init(&multi, top, true); /* initialize our cloned top object */ multi_top_init(&multi, top); diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 7977ece5d..90e32a8ec 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -300,7 +300,7 @@ tunnel_server_udp(struct context *top) } /* initialize global multi_context object */ - multi_init(&multi, top, false, MC_SINGLE_THREADED); + multi_init(&multi, top, false); /* initialize our cloned top object */ multi_top_init(&multi, top); diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index f7e0f6805..9b4a3383f 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -290,7 +290,7 @@ int_compare_function(const void *key1, const void *key2) * Main initialization function, init multi_context object. */ void -multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread_mode) +multi_init(struct multi_context *m, struct context *t, bool tcp_mode) { int dev = DEV_TYPE_UNDEF; @@ -308,8 +308,6 @@ multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread */ CLEAR(*m); - m->thread_mode = thread_mode; - /* * Real address hash table (source port number is * considered to be part of the address). Used @@ -703,53 +701,44 @@ multi_close_instance(struct multi_context *m, void multi_uninit(struct multi_context *m) { - if (m->thread_mode & MC_WORK_THREAD) - { - multi_top_free(m); - m->thread_mode = MC_UNDEF; - } - else if (m->thread_mode) + if (m->hash) { - if (m->hash) - { - struct hash_iterator hi; - struct hash_element *he; + struct hash_iterator hi; + struct hash_element *he; - hash_iterator_init(m->iter, &hi); - while ((he = hash_iterator_next(&hi))) - { - struct multi_instance *mi = (struct multi_instance *) he->value; - mi->did_iter = false; - multi_close_instance(m, mi, true); - } - hash_iterator_free(&hi); + hash_iterator_init(m->iter, &hi); + while ((he = hash_iterator_next(&hi))) + { + struct multi_instance *mi = (struct multi_instance *) he->value; + mi->did_iter = false; + multi_close_instance(m, mi, true); + } + hash_iterator_free(&hi); - multi_reap_all(m); + multi_reap_all(m); - hash_free(m->hash); - hash_free(m->vhash); - hash_free(m->iter); + hash_free(m->hash); + hash_free(m->vhash); + hash_free(m->iter); #ifdef ENABLE_MANAGEMENT - hash_free(m->cid_hash); + hash_free(m->cid_hash); #endif - m->hash = NULL; + m->hash = NULL; - free(m->instances); + free(m->instances); #ifdef ENABLE_ASYNC_PUSH - hash_free(m->inotify_watchers); - m->inotify_watchers = NULL; + hash_free(m->inotify_watchers); + m->inotify_watchers = NULL; #endif - schedule_free(m->schedule); - mbuf_free(m->mbuf); - ifconfig_pool_free(m->ifconfig_pool); - frequency_limit_free(m->new_connection_limiter); - multi_reap_free(m->reaper); - mroute_helper_free(m->route_helper); - multi_tcp_free(m->mtcp); - m->thread_mode = MC_UNDEF; - } + schedule_free(m->schedule); + mbuf_free(m->mbuf); + ifconfig_pool_free(m->ifconfig_pool); + frequency_limit_free(m->new_connection_limiter); + multi_reap_free(m->reaper); + mroute_helper_free(m->route_helper); + multi_tcp_free(m->mtcp); } } diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index 7669508c3..b7078b711 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -150,14 +150,6 @@ struct multi_instance { * server-mode. */ struct multi_context { -#define MC_UNDEF 0 -#define MC_SINGLE_THREADED (1<<0) -#define MC_MULTI_THREADED_MASTER (1<<1) -#define MC_MULTI_THREADED_WORKER (1<<2) -#define MC_MULTI_THREADED_SCHEDULER (1<<3) -#define MC_WORK_THREAD (MC_MULTI_THREADED_WORKER|MC_MULTI_THREADED_SCHEDULER) - int thread_mode; - struct multi_instance **instances; /**< Array of multi_instances. An instance can be * accessed using peer-id as an index. */ @@ -261,7 +253,7 @@ const char *multi_instance_string(const struct multi_instance *mi, bool null, st * Called by mtcp.c, mudp.c, or other (to be written) protocol drivers */ -void multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread_mode); +void multi_init(struct multi_context *m, struct context *t, bool tcp_mode); void multi_uninit(struct multi_context *m);