From patchwork Thu Apr 1 02:13:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1693 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id YKuINEHHZWByDAAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:41 -0400 Received: from proxy1.mail.ord1d.rsapps.net ([172.30.191.6]) by director13.mail.ord1d.rsapps.net with LMTP id QLslNEHHZWCdPgAA91zNiA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:41 -0400 Received: from smtp4.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1d.rsapps.net with LMTPS id UIOjM0HHZWDZEQAAasrz9Q (envelope-from ) for ; Thu, 01 Apr 2021 09:14:41 -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: smtp4.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: 373c9c92-92ec-11eb-b1e3-525400760ffc-1-1 Received: from [216.105.38.7] ([216.105.38.7:60268] helo=lists.sourceforge.net) by smtp4.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id CB/AF-10941-047C5606; Thu, 01 Apr 2021 09:14:40 -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 1lRx8y-0001BR-2d; Thu, 01 Apr 2021 13:13:52 +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 1lRx8w-0001BE-6L for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=8LqDpQT9oz+mBz7M9Mtg9LGU4yofdyUq0IbDDdzo3ZA=; b=CgRqgHXvfEU8EIy81gHgg9tDyK G3HzJpgqZi+WhNrpp25VlX3hsLkboNBYwsjCPmgEbId9qOHXy4kNXIsqa0TzXKrcfrQd8NncbDeMo rCAL9bHM5LpwiSRbVgzdbwbnbXoddgJQDfbia56JViyQ182J0A6bu5MFrFNf6VAwW7og=; 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=8LqDpQT9oz+mBz7M9Mtg9LGU4yofdyUq0IbDDdzo3ZA=; b=DI2TF1wQCvQv9676nLAeJG4C9J MuUYk0tejIDsVrGbU9RQk7EhA2yYhHe5YaTfawwVLOvgK+BbbNDh1ftCu/IpyaKiNgqbmJ4kg3LVb 9ACOw9jmz+bO5TbUJVyycUgl1V9UOYpQEwu6GNKtn7TxrCT/WIa92OXMNgqnCkQ0j2Z0=; 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-0036af-JD for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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 1lRx8j-000J7t-OD for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:37 +0200 Received: (nullmailer pid 3732 invoked by uid 10006); Thu, 01 Apr 2021 13:13:37 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:24 +0200 Message-Id: <20210401131337.3684-2-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-0036af-JD Subject: [Openvpn-devel] [PATCH 01/14] Remove code for aligning non-swapped compression 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 an optimisation for memory alignment for lzo. Compression is deprecated so this optimisation is not very important anymore. Furthermore it is conditionally compiled on !defined(ENABLE_LZ4), which makes the code not compiled in by default anyway. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/comp.h | 6 ------ src/openvpn/init.c | 31 ------------------------------- src/openvpn/mtu.h | 6 ------ 3 files changed, 43 deletions(-) diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index 5c0322ca6..5c9d77fe1 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -198,11 +198,5 @@ comp_non_stub_enabled(const struct compress_options *info) && info->alg != COMP_ALG_UNDEF; } -static inline bool -comp_unswapped_prefix(const struct compress_options *info) -{ - return !(info->flags & COMP_F_SWAP); -} - #endif /* USE_COMP */ #endif /* ifndef OPENVPN_COMP_H */ diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 132d47e4e..1a6015452 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3082,37 +3082,6 @@ do_init_frame(struct context *c) { comp_add_to_extra_frame(&c->c2.frame); -#if !defined(ENABLE_LZ4) - /* - * Compression usage affects buffer alignment when non-swapped algs - * such as LZO is used. - * Newer algs like LZ4 and comp-stub with COMP_F_SWAP don't need - * any special alignment because of the control-byte swap approach. - * LZO alignment (on the other hand) is problematic because - * the presence of the control byte means that either the output of - * decryption must be written to an unaligned buffer, or the input - * to compression (or packet dispatch if packet is uncompressed) - * must be read from an unaligned buffer. - * This code tries to align the input to compression (or packet - * dispatch if packet is uncompressed) at the cost of requiring - * decryption output to be written to an unaligned buffer, so - * it's more of a tradeoff than an optimal solution and we don't - * include it when we are doing a modern build with LZ4. - * Strictly speaking, on the server it would be better to execute - * this code for every connection after we decide the compression - * method, but currently the frame code doesn't appear to be - * flexible enough for this, since the frame is already established - * before it is known which compression options will be pushed. - */ - if (comp_unswapped_prefix(&c->options.comp) && CIPHER_ENABLED(c)) - { - frame_add_to_align_adjust(&c->c2.frame, COMP_PREFIX_LEN); - frame_or_align_flags(&c->c2.frame, - FRAME_HEADROOM_MARKER_FRAGMENT - |FRAME_HEADROOM_MARKER_DECRYPT); - } -#endif - #ifdef ENABLE_FRAGMENT comp_add_to_extra_frame(&c->c2.frame_fragment_omit); /* omit compression frame delta from final frame_fragment */ #endif diff --git a/src/openvpn/mtu.h b/src/openvpn/mtu.h index 0c8bdf8ba..92cbe1874 100644 --- a/src/openvpn/mtu.h +++ b/src/openvpn/mtu.h @@ -300,12 +300,6 @@ frame_add_to_extra_buffer(struct frame *frame, const int increment) frame->extra_buffer += increment; } -static inline void -frame_add_to_align_adjust(struct frame *frame, const int increment) -{ - frame->align_adjust += increment; -} - static inline void frame_align_to_extra_frame(struct frame *frame) { From patchwork Thu Apr 1 02:13:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1692 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 YJV0MUHHZWBeFAAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:41 -0400 Received: from proxy14.mail.ord1d.rsapps.net ([172.30.191.6]) by director15.mail.ord1d.rsapps.net with LMTP id ONH8MEHHZWA0BwAAIcMcQg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:41 -0400 Received: from smtp9.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.ord1d.rsapps.net with LMTPS id EGBSEELHZWB5YAAAtEH5vw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -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: smtp9.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: 375f0732-92ec-11eb-b2c6-525400bd3b1f-1-1 Received: from [216.105.38.7] ([216.105.38.7:52840] helo=lists.sourceforge.net) by smtp9.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B0/66-05275-047C5606; Thu, 01 Apr 2021 09:14:41 -0400 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.90_1) (envelope-from ) id 1lRx90-0000Ob-5D; Thu, 01 Apr 2021 13:13:54 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8w-0000Nj-65 for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=5QHpLaFJWRGHQdWzUDyMHJ/h5dVFieZecoeBuFvSAxo=; b=UwLxb8oo1pFyfCI9dMFLnnGvly H1HGeGc/8p3zFPXV3EmQWsSeE9ymZHFvK7TF5OB1o8vIeEXnedM4YntU/L9AmCKdKPEjAwX0oqoXQ mmz2biYs4g8Zvju5CDFZOTH9IYJxPuWhRJMkvj/UAErbnn00CL6j1/onP65JkuxHAbOo=; 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=5QHpLaFJWRGHQdWzUDyMHJ/h5dVFieZecoeBuFvSAxo=; b=SOp5wccolQ+eOnJMFdLnc9gLPn qSzjXR064yHjUdDJf3Kpxr3Zl/nGjOdIpQ8GsGOpURfrEw+sLMR+vuRAN9qcrDhpL5MB1P8pVGdxk Gw8I7cWVsbJT4QC+GPiZaCoP9ZN315zfzIUFV+QX31ymMnNLeMuzisiXI+6ro2WL9vxk=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8q-0003Ui-40 for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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 1lRx8j-000J7x-Qe for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:37 +0200 Received: (nullmailer pid 3735 invoked by uid 10006); Thu, 01 Apr 2021 13:13:37 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:25 +0200 Message-Id: <20210401131337.3684-3-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: 1lRx8q-0003Ui-40 Subject: [Openvpn-devel] [PATCH 02/14] Remove superflous ifdefs around enum like defines 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 The variables are not used without the configured options but the ifdef around them does not help readibility either. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/mtcp.c | 5 ----- src/openvpn/mudp.c | 2 -- src/openvpn/openvpn.h | 4 ---- 3 files changed, 11 deletions(-) diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 22c824aaa..7d2a69b99 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -59,13 +59,8 @@ #define MTCP_SOCKET ((void *)1) #define MTCP_TUN ((void *)2) #define MTCP_SIG ((void *)3) /* Only on Windows */ -#ifdef ENABLE_MANAGEMENT #define MTCP_MANAGEMENT ((void *)4) -#endif - -#ifdef ENABLE_ASYNC_PUSH #define MTCP_FILE_CLOSE_WRITE ((void *)5) -#endif #define MTCP_N ((void *)16) /* upper bound on MTCP_x */ diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index e95a7ac81..5af1081fc 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -195,12 +195,10 @@ multi_process_io_udp(struct multi_context *m) { strcat(buf, "TW/"); } -#ifdef ENABLE_ASYNC_PUSH else if (status & FILE_CLOSED) { strcat(buf, "FC/"); } -#endif printf("IO %s\n", buf); #endif /* ifdef MULTI_DEBUG_EVENT_LOOP */ diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 3cef26381..1063351d3 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -252,13 +252,9 @@ struct context_2 #define TUN_WRITE (1<<3) #define ES_ERROR (1<<4) #define ES_TIMEOUT (1<<5) -#ifdef ENABLE_MANAGEMENT #define MANAGEMENT_READ (1<<6) #define MANAGEMENT_WRITE (1<<7) -#endif -#ifdef ENABLE_ASYNC_PUSH #define FILE_CLOSED (1<<8) -#endif unsigned int event_set_status; From patchwork Thu Apr 1 02:13:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1699 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 0I/vBUjHZWA3DQAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:48 -0400 Received: from proxy8.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net with LMTP id iK/CBUjHZWDKKgAAIasKDg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:48 -0400 Received: from smtp15.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy8.mail.ord1d.rsapps.net with LMTPS id SJxDBUjHZWCfNgAAGdz6CA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:48 -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: smtp15.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: 3b48ec64-92ec-11eb-95c4-5254007ab6c8-1-1 Received: from [216.105.38.7] ([216.105.38.7:53148] helo=lists.sourceforge.net) by smtp15.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 52/D4-01558-747C5606; Thu, 01 Apr 2021 09:14:47 -0400 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.90_1) (envelope-from ) id 1lRx95-0000QI-Iq; Thu, 01 Apr 2021 13:13:59 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8w-0000O5-On for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=GT405I9v69S37xotFhdaLpjIhLScV6fuLafIY4gCqLA=; b=MHc03THQlG5Bjrg5rZKtzrRn8s CvN9Wt5BnnRYXApNREvmx2WPbreXKaFo1GQGaOQLJgfM4kOUjkan+AFShX3hlXWZu5cyfWjn591P0 B72y4pOxScvXuy4uLDL+0sb/byvp2n60YTM5JRhkh8ph5CKnFBvhiB7q3DqFczLl4tik=; 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=GT405I9v69S37xotFhdaLpjIhLScV6fuLafIY4gCqLA=; b=WKiNaBUzeNpBNiZ1efjcqevEIU eeEmog5U7x2AUyu0wFwTRtDaW7ln9xTHLJb+UytqQpSFQ2YiPc0E6/gvu1C8D95wOsPO4aRFprrul OfFzuYqoMjLmJesWwOIGqctpd5ayDZ20XnV9+pxgvObONmO/gtULck/nGysnecviC7QA=; 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-0036ag-Iq for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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 1lRx8j-000J80-Si for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:37 +0200 Received: (nullmailer pid 3738 invoked by uid 10006); Thu, 01 Apr 2021 13:13:37 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:26 +0200 Message-Id: <20210401131337.3684-4-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-0036ag-Iq Subject: [Openvpn-devel] [PATCH 03/14] Rename tunnel_server_udp_single_threaded to tunnel_server_udp 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 also eliminates the confusing name and eliminates tunnel_server_udp as wrapper that only calls tunnel_server_udp_single_threaded Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- doc/doxygen/doc_eventloop.h | 2 +- doc/doxygen/doc_tunnel_state.h | 2 +- src/openvpn/mudp.c | 21 ++------------------- src/openvpn/mudp.h | 7 +++---- src/openvpn/openvpn.h | 2 +- 5 files changed, 8 insertions(+), 26 deletions(-) diff --git a/doc/doxygen/doc_eventloop.h b/doc/doxygen/doc_eventloop.h index 8bd26355e..e9f7ea6f4 100644 --- a/doc/doxygen/doc_eventloop.h +++ b/doc/doxygen/doc_eventloop.h @@ -61,6 +61,6 @@ * event loop function is called to drive the event processing. The * following implementations are available: * - Client mode using UDP or TCP: \c tunnel_point_to_point() - * - Server mode using UDP: \c tunnel_server_udp_single_threaded() + * - Server mode using UDP: \c tunnel_server_udp() * - Server mode using TCP: \c tunnel_server_tcp() */ diff --git a/doc/doxygen/doc_tunnel_state.h b/doc/doxygen/doc_tunnel_state.h index 46e750fda..104df2e91 100644 --- a/doc/doxygen/doc_tunnel_state.h +++ b/doc/doxygen/doc_tunnel_state.h @@ -118,7 +118,7 @@ * tunnel_point_to_point() or \c tunnel_server(). * * In server-mode, \c main() calls the \c tunnel_server() function, which - * transfers control to \c tunnel_server_udp_single_threaded() or \c + * transfers control to \c tunnel_server_udp() or \c * tunnel_server_tcp() depending on the external transport protocol. * * These functions receive the \c context created in \c main(). This diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 5af1081fc..7977ece5d 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -284,19 +284,8 @@ p2mp_iow_flags(const struct multi_context *m) } -/**************************************************************************/ -/** - * Main event loop for OpenVPN in UDP server mode. - * @ingroup eventloop - * - * This function implements OpenVPN's main event loop for UDP server mode. - * At this time, OpenVPN does not yet support multithreading. This - * function's name is therefore slightly misleading. - * - * @param top - Top-level context structure. - */ -static void -tunnel_server_udp_single_threaded(struct context *top) +void +tunnel_server_udp(struct context *top) { struct multi_context multi; @@ -374,9 +363,3 @@ tunnel_server_udp_single_threaded(struct context *top) close_instance(top); } -void -tunnel_server_udp(struct context *top) -{ - tunnel_server_udp_single_threaded(top); -} - diff --git a/src/openvpn/mudp.h b/src/openvpn/mudp.h index 460a768b3..340381e08 100644 --- a/src/openvpn/mudp.h +++ b/src/openvpn/mudp.h @@ -32,14 +32,13 @@ struct context; struct multi_context; -/**************************************************************************/ /** - * Main event loop wrapper function for OpenVPN in UDP server mode. + * Main event loop for OpenVPN in UDP server mode. * @ingroup eventloop * - * This function simply calls \c tunnel_server_udp_single_threaded(). + * This function implements OpenVPN's main event loop for UDP server mode. * - * @param top - Top-level context structure. + * @param top - Top-level context structure. */ void tunnel_server_udp(struct context *top); diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 1063351d3..0ddaeb730 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -230,7 +230,7 @@ is_cas_pending(enum client_connect_status cas) * \c SIGUSR1 restarts. * * This structure is initialized at the top of the \c - * tunnel_point_to_point(), \c tunnel_server_udp_single_threaded(), and \c + * tunnel_point_to_point(), \c tunnel_server_udp(), and \c * tunnel_server_tcp() functions. In other words, it is reset for every * iteration of the \c main() function's inner \c SIGUSR1 loop. */ From patchwork Thu Apr 1 02:13:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1685 X-Patchwork-Delegate: a@unstable.cc Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id kFLnHDvHZWBeFAAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from proxy15.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id mGeJHDvHZWA8CgAAfY0hYg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from smtp20.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy15.mail.ord1d.rsapps.net with LMTPS id mFhNHDvHZWDiGQAAAY1PeQ (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -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: smtp20.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: 33a00eca-92ec-11eb-8022-525400b8bfda-1-1 Received: from [216.105.38.7] ([216.105.38.7:53430] helo=lists.sourceforge.net) by smtp20.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 4F/AE-13943-A37C5606; Thu, 01 Apr 2021 09:14:34 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lRx8v-0007EV-1V; Thu, 01 Apr 2021 13:13:49 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lRx8t-0007EO-Ml for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:47 +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=LEg34XuGlLWjkPopzl+0+q31ZRS+VRnLIo0BJ2UcbaU=; b=nIo959T2Zocvd3WyvVuh6hhhtb tc9jXQLvSAh4/nZQlhN0e62HnlWCTDSEFg9Y3T8MC4K+PUyGIDCBa5MGPjqi9OZBq+aKokIS3gv1F Yoyp6g3eusB+TLdk+P4+RZSi654Iw0Hzu7AFnsqIJ+1mM4XuW3N8Jl+ABzmgjFHjbSvY=; 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=LEg34XuGlLWjkPopzl+0+q31ZRS+VRnLIo0BJ2UcbaU=; b=ElGfVCjUC/V7Ezl3GlpJbrm8O7 tgecCpt9pA6W8YZOE7BHU+geenXsIQEhfjvPxrTYegY00YM/Cjrf33XnZAWPAdgU4fQlxjIIdhWnS 0/QnGO71fA/BAyTIip8FKroKlqBJ0syQGIpJTbg4wfdDgSreDnsbc0lZ57IIUihY2+Iw=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8q-0003Uj-DJ for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:47 +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-000J83-0K for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3741 invoked by uid 10006); Thu, 01 Apr 2021 13:13:37 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:27 +0200 Message-Id: <20210401131337.3684-5-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.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 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] X-Headers-End: 1lRx8q-0003Uj-DJ Subject: [Openvpn-devel] [PATCH 04/14] Add documentation on EVENT_READ/EVENT_WRITE constants 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 Signed-off-by: Arne Schwabe --- src/openvpn/forward.c | 3 ++- src/openvpn/openvpn.h | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 6f7a50048..98caf6651 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -1880,7 +1880,8 @@ io_wait_dowork(struct context *c, const unsigned int flags) unsigned int tuntap = 0; struct event_set_return esr[4]; - /* These shifts all depend on EVENT_READ and EVENT_WRITE */ + /* These shifts all depend on EVENT_READ (=1) and EVENT_WRITE (=2) */ + /* and are added to the shift. */ static int socket_shift = 0; /* depends on SOCKET_READ and SOCKET_WRITE */ static int tun_shift = 2; /* depends on TUN_READ and TUN_WRITE */ static int err_shift = 4; /* depends on ES_ERROR */ diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 0ddaeb730..322ab3ee1 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -245,7 +245,17 @@ struct context_2 int event_set_max; bool event_set_owned; - /* event flags returned by io_wait */ + /* event flags returned by io_wait, + * All these event are their respective shift as defined in io_wait_dowork + * adding a shift of 0 for the READ event and 1 for the write event. + * + * E.g. management_shift = 6; + * MANAGMENT_READ = (1<<(6+0)), + * MANAGEMNET_WRITE = (1<<(6+1)) + * + * Some shifts (error, file_close) are using read/write for diferent + * signals. + */ #define SOCKET_READ (1<<0) #define SOCKET_WRITE (1<<1) #define TUN_READ (1<<2) From patchwork Thu Apr 1 02:13:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1698 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id KEaWKETHZWBZFAAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:44 -0400 Received: from proxy4.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id EK1HKETHZWB7CQAAfY0hYg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:44 -0400 Received: from smtp28.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.ord1d.rsapps.net with LMTPS id MGXjJ0THZWDYLAAAiYrejw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:44 -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: smtp28.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: 39619694-92ec-11eb-81da-525400ea129b-1-1 Received: from [216.105.38.7] ([216.105.38.7:53620] helo=lists.sourceforge.net) by smtp28.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 40/BA-02292-447C5606; Thu, 01 Apr 2021 09:14:44 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lRx91-0007Fb-PB; Thu, 01 Apr 2021 13:13:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lRx8z-0007Ez-7O 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=UKv2fxmM/KjnzkTcqN1x9UrXx6rPkwg9CzPSqo/dzx0=; b=JulJkRmcVQo+TWvRmONdOIKNJh aeYUfXNyodTCFaA8rOOKb4mWEkPr2+g/q9v045aC8gZkc4anKcB7zBtb4Rl2xsnKL2sHXlquAF1Kc e7UwK794oA6obHdhw5AXoLyisWvcbQ56WnJKGFYXalXllgL3OxaJ7JI9gsIaEI09PG/Q=; 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=UKv2fxmM/KjnzkTcqN1x9UrXx6rPkwg9CzPSqo/dzx0=; b=T+kfp14SRhotUQIaH96OS1CnT8 VRrkb0d/256z/x5iDhLTyAIyI++fVhqGXyDkwywQMBtLmh3AmV+mbhxcMh8frTrlXUQBZorqfeaiy 3P2/PMJ0To7edgb2WxwXxJwXsU7lA40zTBtshvFrphs+pFzNu3vFCil2pyXjz7Omk39M=; 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-0036ai-Ib 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-000J86-39 for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3745 invoked by uid 10006); Thu, 01 Apr 2021 13:13:37 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Apr 2021 15:13:28 +0200 Message-Id: <20210401131337.3684-6-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-0036ai-Ib Subject: [Openvpn-devel] [PATCH 05/14] Remove unused variable pass_config_info 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 Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/ssl_common.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/openvpn/ssl_common.h b/src/openvpn/ssl_common.h index 4e1ff6c84..18bce403a 100644 --- a/src/openvpn/ssl_common.h +++ b/src/openvpn/ssl_common.h @@ -293,10 +293,6 @@ struct tls_options char *x509_username_field[2]; #endif - /* allow openvpn config info to be - * passed over control channel */ - bool pass_config_info; - /* struct crypto_option flags */ unsigned int crypto_flags; From patchwork Thu Apr 1 02:13:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1688 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id eHEoBz3HZWCwSgAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:37 -0400 Received: from proxy5.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id oDnPBj3HZWBTFQAAovjBpQ (envelope-from ) for ; Thu, 01 Apr 2021 09:14:37 -0400 Received: from smtp3.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 WI+ZBj3HZWCHMQAA8Zzt7w (envelope-from ) for ; Thu, 01 Apr 2021 09:14:37 -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: smtp3.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: 34a6d6a0-92ec-11eb-a110-5254006d4589-1-1 Received: from [216.105.38.7] ([216.105.38.7:60210] helo=lists.sourceforge.net) by smtp3.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 98/E4-12681-C37C5606; Thu, 01 Apr 2021 09:14:36 -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 1lRx8v-0001B2-RK; Thu, 01 Apr 2021 13:13:49 +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 1lRx8t-0001As-Mz for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:47 +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=2ckhPw6l3Edb/PrZAreEgKZgZ3aPhofSVsvs6m6ckOE=; b=X2cUdJZS8yZDf+Q3wWK7sCmtG4 p1WAqjtSmidjXS1Qi4z1v8GIulfv1b2+Ph8YvW+EidPEc2XTJ1tHOspmN7KHDoYIGPCJIq+3v7aSh kmCkTKoVgz8ZdRzg8FUlMWFOqHuXOgDRqZ1LRZ1ZDOwlNIaHEzkKlrt9GpUooWv9zIkA=; 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=2ckhPw6l3Edb/PrZAreEgKZgZ3aPhofSVsvs6m6ckOE=; b=VUfEwcK8PovBSAj8ZBUFLY6OSX 4LUA0JJI6gDIYaSWh2GjnqJWe+VzN0bEHUYq3LtQwXhxFrb+wFeTNYiTDgOOMZm2oH1C01V0bPYd+ 6QYcHJpZCikCOdVWiQUrgnNXj5vrJ1FzmzqosriseZy3aOSY5k/Pvl0Wm76oXy240OyI=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8q-0003Uk-Cy for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:47 +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-000J89-5g for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3748 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:29 +0200 Message-Id: <20210401131337.3684-7-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.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 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] X-Headers-End: 1lRx8q-0003Uk-Cy Subject: [Openvpn-devel] [PATCH 06/14] Remove pointless tun_adjust_frame_parameters function 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 functions seem to serve no purpose other than to add confusion. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/init.c | 2 +- src/openvpn/tun.h | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 1a6015452..f0ae0b7f1 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3101,7 +3101,7 @@ do_init_frame(struct context *c) */ if (c->options.ce.tun_mtu_extra_defined) { - tun_adjust_frame_parameters(&c->c2.frame, c->options.ce.tun_mtu_extra); + frame_add_to_extra_tun(&c->c2.frame, c->options.ce.tun_mtu_extra); } /* diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 902665cc6..7e8fb7647 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -315,16 +315,6 @@ void check_subnet_conflict(const in_addr_t ip, void warn_on_use_of_common_subnets(openvpn_net_ctx_t *ctx); -/* - * Inline functions - */ - -static inline void -tun_adjust_frame_parameters(struct frame *frame, int size) -{ - frame_add_to_extra_tun(frame, size); -} - /* * Should ifconfig be called before or after * tun dev open? From patchwork Thu Apr 1 02:13:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1689 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id EKSNJz7HZWA3DQAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:38 -0400 Received: from proxy15.mail.ord1d.rsapps.net ([172.30.191.6]) by director11.mail.ord1d.rsapps.net with LMTP id AM1WJz7HZWCDRwAAvGGmqA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:38 -0400 Received: from smtp36.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy15.mail.ord1d.rsapps.net with LMTPS id WNbcJj7HZWCDGQAAAY1PeQ (envelope-from ) for ; Thu, 01 Apr 2021 09:14:38 -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: smtp36.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: 356cf10a-92ec-11eb-accf-525400c11307-1-1 Received: from [216.105.38.7] ([216.105.38.7:53492] helo=lists.sourceforge.net) by smtp36.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 26/C1-23998-D37C5606; Thu, 01 Apr 2021 09:14:37 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lRx98-0007H8-1F; Thu, 01 Apr 2021 13:14:02 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lRx96-0007Gk-NP for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:14:00 +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=hqb8Be+Hnd1LFuJ2R91l8odkykIp5AOO0AYAIcwhYl8=; b=dthNgTyYViNI/0ND+PsEPyYGrw 4Wgj2/o2ZjYraUIYTM6CdWPRbntxtbE/g3KvEZ2zCADMYrWWUdgjOxmZ/+70j/hiuNMhAxEslKnI8 0BFjstRmJVjojumaDDRhLSKZ+zPv2ur8cG9spWvluRrXB0W8IKZdZDRwwXWy6acNLwiw=; 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=hqb8Be+Hnd1LFuJ2R91l8odkykIp5AOO0AYAIcwhYl8=; b=bntFYANhzLqEwlaoD95VztefcD pWPE6EnCLE4ohe89YWy/1QXEjYAiK5Sufvz5gyZ9QO1OgjZbgyHIRhmgh5r7DUbycjYNd+yotUICd 6TGr9ai9W36LhymR63BEGHZVBGrTTbkypGUq/PJ3cnoro6CuEHgtX/MgKayVXEBOh6gA=; 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-0036aj-Hg for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:14:00 +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-000J8C-7j for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3751 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:30 +0200 Message-Id: <20210401131337.3684-8-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-0036aj-Hg Subject: [Openvpn-devel] [PATCH 07/14] Remove unused field txqueuelen from struct tuntap 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 The code uses tuntap->options.txqueuelen instead. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/tun.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h index 7e8fb7647..60ebfdcba 100644 --- a/src/openvpn/tun.h +++ b/src/openvpn/tun.h @@ -165,9 +165,6 @@ struct tuntap char *actual_name; /* actual name of TUN/TAP dev, usually including unit number */ - /* number of TX buffers */ - int txqueuelen; - /* ifconfig parameters */ in_addr_t local; in_addr_t remote_netmask; From patchwork Thu Apr 1 02:13:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1694 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id QA8yBkLHZWAPNgAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -0400 Received: from proxy14.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id APrcBULHZWDdCQAAfY0hYg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -0400 Received: from smtp9.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy14.mail.ord1d.rsapps.net with LMTPS id CGnIIELHZWC5YAAAtEH5vw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -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: smtp9.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: 37caaba4-92ec-11eb-b2c6-525400bd3b1f-1-1 Received: from [216.105.38.7] ([216.105.38.7:52866] helo=lists.sourceforge.net) by smtp9.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B4/66-05275-147C5606; Thu, 01 Apr 2021 09:14:41 -0400 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.90_1) (envelope-from ) id 1lRx91-0000Os-2Q; Thu, 01 Apr 2021 13:13:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8w-0000Nk-6q for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=7g7aQWe6GCX5oxQ4uCfXcNXhfCLNVGEkbV9BQ6PnvnE=; b=jvbavhXRhl0kQOmy5GTd1rP+j1 oz8VvdEiLF0a5ahUFeYurIbv8aNldE1H4A4bmVDSYqx/IQdpjXUQz1qEk7j+zxWHj5MOszlaJkuRU KC3okJtlbqjZPEv7UBB//tNf0HsyxhMZlv9Zoow2lkSbWLr8cQp6U5N/Y05ByHpoNF34=; 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=7g7aQWe6GCX5oxQ4uCfXcNXhfCLNVGEkbV9BQ6PnvnE=; b=WDYbZgwUXbYumsmgtrI/FOZUtM tobeHc6Puw5QJ3bztfbXwc6CP/JY0XCpw4qT0ccHtRzHbTVgblceGWXmxKNpQahLas+4qVrbL9tbD w+kjvVXig6u4nQ4nWD/cI3wLE/zPFQEchodqIp924nubYiDRoTGCcgdGbrkkvIymL4a8=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8q-0003Um-Mg for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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-000J8F-9d for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3754 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:31 +0200 Message-Id: <20210401131337.3684-9-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: 1lRx8q-0003Um-Mg Subject: [Openvpn-devel] [PATCH 08/14] Remove unused function tls_test_auth_deferred_interval 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 function appears to completely unused and has not been touched since 2008. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/ssl.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/openvpn/ssl.h b/src/openvpn/ssl.h index 8c8cbe028..300a70d35 100644 --- a/src/openvpn/ssl.h +++ b/src/openvpn/ssl.h @@ -530,17 +530,6 @@ tls_initial_packet_received(const struct tls_multi *multi) return multi->n_sessions > 0; } -static inline bool -tls_test_auth_deferred_interval(const struct tls_multi *multi) -{ - if (multi) - { - const struct key_state *ks = &multi->session[TM_ACTIVE].key[KS_PRIMARY]; - return now < ks->auth_deferred_expire; - } - return false; -} - static inline int tls_test_payload_len(const struct tls_multi *multi) { From patchwork Thu Apr 1 02:13:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1695 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id MNYWC0LHZWByDAAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -0400 Received: from proxy6.mail.ord1d.rsapps.net ([172.30.191.6]) by director12.mail.ord1d.rsapps.net with LMTP id IKXuCkLHZWCFJwAAIasKDg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -0400 Received: from smtp27.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy6.mail.ord1d.rsapps.net with LMTPS id EAH0CULHZWBpQgAAQyIf0w (envelope-from ) for ; Thu, 01 Apr 2021 09:14:42 -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: smtp27.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: 37c60ba8-92ec-11eb-bf95-5254003773d7-1-1 Received: from [216.105.38.7] ([216.105.38.7:60290] helo=lists.sourceforge.net) by smtp27.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 48/C8-22125-147C5606; Thu, 01 Apr 2021 09:14:41 -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 1lRx8y-0001Bg-9k; Thu, 01 Apr 2021 13:13:52 +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 1lRx8w-0001BK-Of for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=iSQkXvEmdFxAYO82UsdWFIjKfj6OSRRxRB1zBYbPCpk=; b=OUorVwO04U3gS7nv9VaDFKfjjb 704O9eGV1ius41UUUdviXfXiZ8elJtsnJYYm/OzKR9q/cKGVMCXuIuUYFDaSZZIr4a3HbN1Cb4G4Z Z0KFcBCaSyTLOLDBpIVt+acOX+6lpyZIpd1k/IaEInNNu3Tmy03kgYsTDsbkmDIFvPak=; 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=iSQkXvEmdFxAYO82UsdWFIjKfj6OSRRxRB1zBYbPCpk=; b=jYr/NgERwP01vJ+r6eZNmORVTw TYKCGqxtsqPivyc8zS33hQVPfh2UNiagBDRmiP27fnPtHM3pUuNyKtIlJn8Y/Sq1o6jO1MnDVEbvZ gyBJsUYgyrtOpvxJ9IP1OqYZKnPxB6PtBa9csdQXJq9isK4TnNByYTNRYCFN3CBaOMV8=; 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-0036ak-It for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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-000J8I-C3 for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3757 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:32 +0200 Message-Id: <20210401131337.3684-10-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-0036ak-It Subject: [Openvpn-devel] [PATCH 09/14] Move is_proto function to the socket.h header 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 These functions are small enough to be inlined and also avoids dependency on socket.c from unit_tests using those functions. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/socket.c | 36 ------------------------------- src/openvpn/socket.h | 50 +++++++++++++++++++++++++++++++++----------- 2 files changed, 38 insertions(+), 48 deletions(-) diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 0d9b793cd..6fed4b660 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -3101,42 +3101,6 @@ static const struct proto_names proto_names[] = { {"tcp6", "TCPv6", AF_INET6, PROTO_TCP}, }; -bool -proto_is_net(int proto) -{ - if (proto < 0 || proto >= PROTO_N) - { - ASSERT(0); - } - return proto != PROTO_NONE; -} - -bool -proto_is_dgram(int proto) -{ - return proto_is_udp(proto); -} - -bool -proto_is_udp(int proto) -{ - if (proto < 0 || proto >= PROTO_N) - { - ASSERT(0); - } - return proto == PROTO_UDP; -} - -bool -proto_is_tcp(int proto) -{ - if (proto < 0 || proto >= PROTO_N) - { - ASSERT(0); - } - return proto == PROTO_TCP_CLIENT || proto == PROTO_TCP_SERVER; -} - int ascii2proto(const char *proto_name) { diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index 4099f6ea5..d58fda4d3 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -474,18 +474,6 @@ socket_descriptor_t socket_do_accept(socket_descriptor_t sd, struct link_socket_actual *act, const bool nowait); -/* - * proto related - */ -bool proto_is_net(int proto); - -bool proto_is_dgram(int proto); - -bool proto_is_udp(int proto); - -bool proto_is_tcp(int proto); - - #if UNIX_SOCK_SUPPORT socket_descriptor_t create_socket_unix(void); @@ -572,6 +560,44 @@ enum proto_num { PROTO_N }; +static inline bool +proto_is_net(int proto) +{ + ASSERT(proto >= 0 && proto < PROTO_N); + return proto != PROTO_NONE; +} + +/** + * @brief Returns if the protocol being used is UDP + */ +static inline bool +proto_is_udp(int proto) +{ + ASSERT(proto >= 0 && proto < PROTO_N); + return proto == PROTO_UDP; +} + +/** + * @brief Return if the protocol is datagram (UDP) + * + */ +static inline bool +proto_is_dgram(int proto) +{ + return proto_is_udp(proto); +} + +/** + * @brief returns if the proto is a TCP variant (tcp-server, tcp-client or tcp) + */ +static inline bool +proto_is_tcp(int proto) +{ + ASSERT(proto >= 0 && proto < PROTO_N); + return proto == PROTO_TCP_CLIENT || proto == PROTO_TCP_SERVER; +} + + int ascii2proto(const char *proto_name); sa_family_t ascii2af(const char *proto_name); 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); From patchwork Thu Apr 1 02:13:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1690 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director14.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id eOuWFD/HZWDOYQAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:39 -0400 Received: from proxy11.mail.ord1d.rsapps.net ([172.30.191.6]) by director14.mail.ord1d.rsapps.net with LMTP id SLphFD/HZWAwKAAAeJ7fFg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:39 -0400 Received: from smtp3.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.ord1d.rsapps.net with LMTPS id UImjHjTHZWB/UgAAgKDEHA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:28 -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: smtp3.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: 362e1d44-92ec-11eb-a110-5254006d4589-1-1 Received: from [216.105.38.7] ([216.105.38.7:52764] helo=lists.sourceforge.net) by smtp3.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 44/F4-12681-E37C5606; Thu, 01 Apr 2021 09:14:38 -0400 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.90_1) (envelope-from ) id 1lRx91-0000P2-61; Thu, 01 Apr 2021 13:13:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8w-0000Nt-8j for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=lFXPKIE6a5tyQ7YvfUIgrbXUW2YiFYKgfvwN9fUP/xA=; b=Hnoir5wy5a1PwMulE4GTVZxxTn /uVODX7TnuSfVa0ilFMShAkC23rvV8PcLIlMVNhbDdN7k5TIvoE1WPk1BtNS41MxwePM030AZGp++ SMzN5GcMmvmB0r3cgzpnhOsj6J9PwoJb0VY/Ub0+/YTyNZ906kLEJ5HFkRaSHzf6e5TY=; 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=lFXPKIE6a5tyQ7YvfUIgrbXUW2YiFYKgfvwN9fUP/xA=; b=Vc4PWSY2a3qnbTMw3UNMXf3MJa BnXW0DHvEF69DrgHDpL7VIW635Ub9p3pCF3NdtryF355+b4RkG7Ghe7X4Lr9JrFacLUDUobmiIt9b szwnKLSekg1pZ8piXxDbydWUt2UjBITHp6OQe/yBxw9PihWKYvpCExsoiprljBfjyKVk=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8r-0003Uo-PV for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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-000J8O-Iq for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3764 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:34 +0200 Message-Id: <20210401131337.3684-12-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: 1lRx8r-0003Uo-PV Subject: [Openvpn-devel] [PATCH 11/14] Remove P2MP mode and check for gettimeofday 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 Using OpenVPN without P2MP support (pull, TLS) is unrealistic and building a binary without it is not something we realistically want to support anyway. Signed-off-by: Arne Schwabe --- src/compat/compat-gettimeofday.c | 2 +- src/openvpn/forward.c | 23 ++----------- src/openvpn/forward.h | 6 ---- src/openvpn/helper.c | 3 -- src/openvpn/init.c | 29 +---------------- src/openvpn/manage.c | 4 --- src/openvpn/mbuf.c | 3 -- src/openvpn/mbuf.h | 3 -- src/openvpn/multi.c | 7 ++++ src/openvpn/openvpn.h | 7 ---- src/openvpn/options.c | 55 ++++---------------------------- src/openvpn/options.h | 49 ++++++++++++++++------------ src/openvpn/otime.c | 4 --- src/openvpn/pool.c | 4 --- src/openvpn/pool.h | 3 -- src/openvpn/push.c | 3 -- src/openvpn/push.h | 3 -- src/openvpn/pushlist.h | 4 +-- src/openvpn/route.h | 2 -- src/openvpn/shaper.c | 5 +-- src/openvpn/shaper.h | 4 --- src/openvpn/syshead.h | 32 ------------------- 22 files changed, 49 insertions(+), 206 deletions(-) diff --git a/src/compat/compat-gettimeofday.c b/src/compat/compat-gettimeofday.c index 117aee7d7..e63c8d7f8 100644 --- a/src/compat/compat-gettimeofday.c +++ b/src/compat/compat-gettimeofday.c @@ -93,7 +93,7 @@ gettimeofday(struct timeval *tv, void *tz) { /* We try to dampen out backtracks of less than backtrack_hold_seconds. * Larger backtracks will be passed through and dealt with by the - * TIME_BACKTRACK_PROTECTION code (if enabled) */ + * TIME_BACKTRACK_PROTECTION code */ if (sec > last_sec - backtrack_hold_seconds) { sec = last_sec; diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 98caf6651..01f3f3b9b 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -189,8 +189,6 @@ check_tls_errors_nco(struct context *c) register_signal(c, c->c2.tls_exit_signal, "tls-error"); /* SOFT-SIGUSR1 -- TLS error */ } -#if P2MP - /* * Handle incoming configuration * messages on the control channel. @@ -269,8 +267,6 @@ check_push_request(struct context *c) event_timeout_modify_wakeup(&c->c2.push_request_interval, PUSH_REQUEST_INTERVAL); } -#endif /* P2MP */ - /* * Things that need to happen immediately after connection initiation should go here. * @@ -286,7 +282,6 @@ check_connection_established(struct context *c) if (CONNECTION_ESTABLISHED(c)) { -#if P2MP /* if --pull was specified, send a push request to server */ if (c->c2.tls_multi && c->options.pull) { @@ -313,7 +308,6 @@ check_connection_established(struct context *c) reset_coarse_timers(c); } else -#endif /* if P2MP */ { do_up(c, false, 0); } @@ -428,7 +422,6 @@ get_server_poll_remaining_time(struct event_timeout *server_poll_timeout) int remaining = event_timeout_remaining(server_poll_timeout); return max_int(0, remaining); } -#if P2MP void check_server_poll_timeout(struct context *c) @@ -466,8 +459,6 @@ check_scheduled_exit(struct context *c) register_signal(c, c->c2.scheduled_exit_signal, "delayed-exit"); } -#endif /* if P2MP */ - /* * Should we write timer-triggered status file. */ @@ -635,13 +626,12 @@ process_coarse_timers(struct context *c) { check_connection_established(c); } -#if P2MP + /* see if we should send a push_request (option --pull) */ if (event_timeout_trigger(&c->c2.push_request_interval, &c->c2.timeval, ETT_DEFAULT)) { check_push_request(c); } -#endif #ifdef PLUGIN_PF if (c->c2.pf.enabled @@ -676,7 +666,6 @@ process_coarse_timers(struct context *c) return; } -#if P2MP if (c->c2.tls_multi) { if (c->options.ce.connect_timeout @@ -697,7 +686,6 @@ process_coarse_timers(struct context *c) return; } } -#endif /* Should we send an OCC_REQUEST message? */ check_send_occ_req(c); @@ -1583,13 +1571,12 @@ process_outgoing_link(struct context *c) * Let the traffic shaper know how many bytes * we wrote. */ -#ifdef ENABLE_FEATURE_SHAPER if (c->options.shaper) { shaper_wrote_bytes(&c->c2.shaper, BLEN(&c->c2.to_link) + datagram_overhead(c->options.ce.proto)); } -#endif + /* * Let the pinger know that we sent a packet. */ @@ -1843,14 +1830,12 @@ pre_select(struct context *c) return; } -#if P2MP /* check for incoming control messages on the control channel like * push request/reply, or authentication failure and 2FA messages */ if (tls_test_payload_len(c->c2.tls_multi) > 0) { check_incoming_control_channel(c); } -#endif /* Should we send an OCC message? */ check_send_occ_msg(c); @@ -1920,7 +1905,6 @@ io_wait_dowork(struct context *c, const unsigned int flags) * quota, don't send -- instead compute the delay we must wait * until it will be OK to send the packet. */ -#ifdef ENABLE_FEATURE_SHAPER int delay = 0; /* set traffic shaping delay in microseconds */ @@ -1937,9 +1921,6 @@ io_wait_dowork(struct context *c, const unsigned int flags) { shaper_soonest_event(&c->c2.timeval, delay); } -#else /* ENABLE_FEATURE_SHAPER */ - socket |= EVENT_WRITE; -#endif /* ENABLE_FEATURE_SHAPER */ } else { diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 9ce3bc1c7..2a67c1445 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -74,15 +74,12 @@ void check_tls_errors_co(struct context *c); void check_tls_errors_nco(struct context *c); -#if P2MP void check_incoming_control_channel(struct context *c); void check_scheduled_exit(struct context *c); void check_push_request(struct context *c); -#endif /* P2MP */ - #ifdef ENABLE_FRAGMENT void check_fragment(struct context *c); @@ -336,11 +333,8 @@ void reschedule_multi_process(struct context *c); void process_ip_header(struct context *c, unsigned int flags, struct buffer *buf); -#if P2MP void schedule_exit(struct context *c, const int n_seconds, const int signal); -#endif - static inline struct link_socket_info * get_link_socket_info(struct context *c) { diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c index a1d030706..963578d43 100644 --- a/src/openvpn/helper.c +++ b/src/openvpn/helper.c @@ -149,7 +149,6 @@ helper_client_server(struct options *o) { struct gc_arena gc = gc_new(); -#if P2MP /* * Get tun/tap/null device type @@ -494,8 +493,6 @@ helper_client_server(struct options *o) o->tls_client = true; } -#endif /* P2MP */ - gc_free(&gc); } diff --git a/src/openvpn/init.c b/src/openvpn/init.c index f0ae0b7f1..98cc1ebe9 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -192,7 +192,6 @@ run_up_down(const char *command, static void update_options_ce_post(struct options *options) { -#if P2MP /* * In pull mode, we usually import --ping/--ping-restart parameters from * the server. However we should also set an initial default --ping-restart @@ -206,7 +205,6 @@ update_options_ce_post(struct options *options) options->ping_rec_timeout = PRE_PULL_INITIAL_PING_RESTART; options->ping_rec_timeout_action = PING_RESTART; } -#endif } #ifdef ENABLE_MANAGEMENT @@ -592,7 +590,6 @@ init_query_passwords(const struct context *c) pem_password_setup(c->options.key_pass_file); } -#if P2MP /* Auth user/pass input */ if (c->options.auth_user_pass_file) { @@ -602,7 +599,6 @@ init_query_passwords(const struct context *c) auth_user_pass_setup(c->options.auth_user_pass_file, NULL); #endif } -#endif } /* @@ -1446,14 +1442,12 @@ do_init_timers(struct context *c, bool deferred) static void do_init_traffic_shaper(struct context *c) { -#ifdef ENABLE_FEATURE_SHAPER /* initialize traffic shaper (i.e. transmit bandwidth limiter) */ if (c->options.shaper) { shaper_init(&c->c2.shaper, c->options.shaper); shaper_msg(&c->c2.shaper); } -#endif } /* @@ -1978,9 +1972,7 @@ do_close_tun_simple(struct context *c) c->c1.tuntap = NULL; } c->c1.tuntap_owned = false; -#if P2MP CLEAR(c->c1.pulled_options_digest_save); -#endif } static void @@ -2131,7 +2123,6 @@ tun_abort(void) * Handle delayed tun/tap interface bringup due to --up-delay or --pull */ -#if P2MP /** * Helper for do_up(). Take two option hashes and return true if they are not * equal, or either one is all-zeroes. @@ -2144,7 +2135,6 @@ options_hash_changed_or_zero(const struct sha256_digest *a, return memcmp(a, b, sizeof(struct sha256_digest)) || !memcmp(a, &zero, sizeof(struct sha256_digest)); } -#endif /* P2MP */ bool do_up(struct context *c, bool pulled_options, unsigned int option_types_found) @@ -2168,7 +2158,6 @@ do_up(struct context *c, bool pulled_options, unsigned int option_types_found) c->c2.did_open_tun = do_open_tun(c); update_time(); -#if P2MP /* * Was tun interface object persisted from previous restart iteration, * and if so did pulled options string change from previous iteration? @@ -2186,14 +2175,11 @@ do_up(struct context *c, bool pulled_options, unsigned int option_types_found) c->c2.did_open_tun = do_open_tun(c); update_time(); } -#endif } if (c->c2.did_open_tun) { -#if P2MP c->c1.pulled_options_digest_save = c->c2.pulled_options_digest; -#endif /* if --route-delay was specified, start timer */ if ((route_order() == ROUTE_AFTER_TUN) && c->options.route_delay_defined) @@ -2360,6 +2346,7 @@ do_deferred_options(struct context *c, const unsigned int found) /* process (potentially pushed) crypto options */ if (c->options.pull) { + if (!check_pull_client_ncp(c, found)) { return false; @@ -2432,12 +2419,10 @@ socket_restart_pause(struct context *c) } #endif -#if P2MP if (auth_retry_get() == AR_NOINTERACT) { sec = 10; } -#endif /* Slow down reconnection after 5 retries per remote -- for tcp only in client mode */ if (c->options.ce.proto != PROTO_TCP_SERVER) @@ -2721,7 +2706,6 @@ do_init_crypto_tls_c1(struct context *c) init_ssl(options, &(c->c1.ks.ssl_ctx)); if (!tls_ctx_initialised(&c->c1.ks.ssl_ctx)) { -#if P2MP switch (auth_retry_get()) { case AR_NONE: @@ -2740,9 +2724,6 @@ do_init_crypto_tls_c1(struct context *c) } c->sig->signal_text = "private-key-password-failure"; return; -#else /* if P2MP */ - msg(M_FATAL, "Error: private key password verification failed"); -#endif /* if P2MP */ } /* Do not warn if we only have BF-CBC in options->ciphername @@ -2938,11 +2919,9 @@ do_init_crypto_tls(struct context *c, const unsigned int flags) to.x509_track = options->x509_track; -#if P2MP #ifdef ENABLE_MANAGEMENT to.sci = &options->sc_info; #endif -#endif #ifdef USE_COMP to.comp_options = options->comp; @@ -3207,7 +3186,6 @@ do_option_warnings(struct context *c) msg(M_WARN, "WARNING: you are using chroot without specifying user and group -- this may cause the chroot jail to be insecure"); } -#if P2MP if (o->pull && o->ifconfig_local && c->first_time) { msg(M_WARN, "WARNING: using --pull/--client and --ifconfig together is probably not what you want"); @@ -3233,7 +3211,6 @@ do_option_warnings(struct context *c) msg(M_WARN, "WARNING: --keepalive option is missing from server config"); } } -#endif /* if P2MP */ if (!o->replay) { @@ -3771,13 +3748,11 @@ do_setup_fast_io(struct context *c) } else { -#ifdef ENABLE_FEATURE_SHAPER if (c->options.shaper) { msg(M_INFO, "NOTE: --fast-io is disabled since we are using --shaper"); } else -#endif { c->c2.fast_io = true; } @@ -4141,13 +4116,11 @@ init_instance(struct context *c, const struct env_set *env, const unsigned int f platform_mlockall(true); } -#if P2MP /* get passwords if undefined */ if (auth_retry_get() == AR_INTERACT) { init_query_passwords(c); } -#endif /* initialize context level 2 --verb/--mute parms */ init_verb_mute(c, IVM_LEVEL_2); diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index df987f53c..7e61061ab 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -1416,7 +1416,6 @@ man_dispatch_command(struct management *man, struct status_output *so, const cha } else if (streq(p[0], "auth-retry")) { -#if P2MP if (p[1]) { if (auth_retry_set(M_CLIENT, p[1])) @@ -1432,9 +1431,6 @@ man_dispatch_command(struct management *man, struct status_output *so, const cha { msg(M_CLIENT, "SUCCESS: auth-retry=%s", auth_retry_print()); } -#else /* if P2MP */ - msg(M_CLIENT, "ERROR: auth-retry feature is unavailable"); -#endif } else if (streq(p[0], "state")) { diff --git a/src/openvpn/mbuf.c b/src/openvpn/mbuf.c index 76f478b8c..6b7db6501 100644 --- a/src/openvpn/mbuf.c +++ b/src/openvpn/mbuf.c @@ -29,8 +29,6 @@ #include "syshead.h" -#if P2MP - #include "buffer.h" #include "error.h" #include "integer.h" @@ -171,4 +169,3 @@ mbuf_dereference_instance(struct mbuf_set *ms, struct multi_instance *mi) } } } -#endif /* P2MP */ diff --git a/src/openvpn/mbuf.h b/src/openvpn/mbuf.h index f37563dff..759546c6c 100644 --- a/src/openvpn/mbuf.h +++ b/src/openvpn/mbuf.h @@ -28,8 +28,6 @@ * Handle both multicast and broadcast functions. */ -#if P2MP - /* define this to enable special test mode */ /*#define MBUF_TEST*/ @@ -111,5 +109,4 @@ mbuf_peek(struct mbuf_set *ms) } } -#endif /* if P2MP */ #endif /* ifndef MBUF_H */ diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 9b4a3383f..071bd5b61 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2642,6 +2642,13 @@ multi_connection_established(struct multi_context *m, struct multi_instance *mi) (*cur_handler_index)++; } + /* Check if we have forbidding options in the current mode */ + if (dco_enabled( &mi->context.options) + && check_option_conflict_dco(D_MULTI_ERRORS, &mi->context.options)) + { + msg(D_MULTI_ERRORS, "MULTI: client has been reject due to incompatible options"); + cc_succeeded = false; + } if (cc_succeeded) { diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index 322ab3ee1..c30ffacb7 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -189,7 +189,6 @@ struct context_1 struct socks_proxy_info *socks_proxy; bool socks_proxy_owned; -#if P2MP /* persist --ifconfig-pool db to file */ struct ifconfig_pool_persist *ifconfig_pool_persist; bool ifconfig_pool_persist_owned; @@ -203,7 +202,6 @@ struct context_1 struct user_pass *auth_user_pass; /**< Username and password for * authentication. */ -#endif }; @@ -288,12 +286,10 @@ struct context_2 struct frame frame_fragment_omit; #endif -#ifdef ENABLE_FEATURE_SHAPER /* * Traffic shaper object. */ struct shaper shaper; -#endif /* * Statistics @@ -445,8 +441,6 @@ struct context_2 /* don't wait for TUN/TAP/UDP to be ready to accept write */ bool fast_io; -#if P2MP - /* --ifconfig endpoints to be pushed to client */ bool push_request_received; bool push_ifconfig_defined; @@ -473,7 +467,6 @@ struct context_2 struct event_timeout scheduled_exit; int scheduled_exit_signal; -#endif /* if P2MP */ /* packet filter */ #ifdef ENABLE_PF diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 51bd56c2b..88721b0da 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -403,7 +403,6 @@ static const char usage_message[] = "--vlan-tagging : Enable 802.1Q-based VLAN tagging.\n" "--vlan-accept tagged|untagged|all : Set VLAN tagging mode. Default is 'all'.\n" "--vlan-pvid v : Sets the Port VLAN Identifier. Defaults to 1.\n" -#if P2MP "\n" "Multi-Client Server options (when --mode server is used):\n" "--server network netmask : Helper option to easily configure server mode.\n" @@ -508,7 +507,6 @@ static const char usage_message[] = " waiting for a response before trying the next server.\n" "--allow-recursive-routing : When this option is set, OpenVPN will not drop\n" " incoming tun packets with same destination as host.\n" -#endif /* if P2MP */ "--explicit-exit-notify [n] : On exit/restart, send exit signal to\n" " server/remote. n = # of retries, default=1.\n" "\n" @@ -848,9 +846,7 @@ init_options(struct options *o, const bool init_gc) o->max_routes_per_client = 256; o->stale_routes_check_interval = 0; o->ifconfig_pool_persist_refresh_freq = 600; -#if P2MP o->scheduled_exit_interval = 5; -#endif o->ncp_enabled = true; o->ncp_ciphers = "AES-256-GCM:AES-128-GCM"; o->authname = "SHA1"; @@ -1293,8 +1289,6 @@ print_vlan_accept(enum vlan_acceptable_frames mode) return NULL; } -#if P2MP - #ifndef ENABLE_SMALL static void @@ -1422,7 +1416,6 @@ option_iroute_ipv6(struct options *o, ir->next = o->iroutes_ipv6; o->iroutes_ipv6 = ir; } -#endif /* P2MP */ #ifndef ENABLE_SMALL static void @@ -1616,9 +1609,7 @@ show_settings(const struct options *o) SHOW_INT(ifconfig_ipv6_netbits); SHOW_STR(ifconfig_ipv6_remote); -#ifdef ENABLE_FEATURE_SHAPER SHOW_INT(shaper); -#endif SHOW_INT(mtu_test); SHOW_BOOL(mlock); @@ -1844,9 +1835,7 @@ show_settings(const struct options *o) SHOW_BOOL(pkcs11_id_management); #endif /* ENABLE_PKCS11 */ -#if P2MP show_p2mp_parms(o); -#endif #ifdef _WIN32 SHOW_BOOL(show_net_up); @@ -2106,9 +2095,7 @@ options_postprocess_verify_ce(const struct options *options, } /* will we be pulling options from server? */ -#if P2MP pull = options->pull; -#endif /* * Sanity check on --local, --remote, and --ifconfig @@ -2743,10 +2730,13 @@ options_postprocess_verify_ce(const struct options *options, if (sum == 0) { -#if P2MP if (!options->auth_user_pass_file) -#endif - msg(M_USAGE, "No client-side authentication method is specified. You must use either --cert/--key, --pkcs12, or --auth-user-pass"); + { + msg(M_USAGE, "No client-side authentication method is " + "specified. You must use either " + "--cert/--key, --pkcs12, or " + "--auth-user-pass"); + } } else if (sum == 2) { @@ -2834,12 +2824,10 @@ options_postprocess_verify_ce(const struct options *options, } #undef MUST_BE_UNDEF -#if P2MP if (options->auth_user_pass_file && !options->pull) { msg(M_USAGE, "--auth-user-pass requires --pull"); } -#endif uninit_options(&defaults); } @@ -2857,7 +2845,6 @@ options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce) } } -#if P2MP if (o->client) { if (ce->proto == PROTO_TCP) @@ -2865,7 +2852,6 @@ options_postprocess_mutate_ce(struct options *o, struct connection_entry *ce) ce->proto = PROTO_TCP_CLIENT; } } -#endif if (ce->proto == PROTO_TCP_CLIENT && !ce->local && !ce->local_port_defined && !ce->bind_defined) @@ -3131,6 +3117,7 @@ options_postprocess_cipher(struct options *o) } } + static void options_postprocess_mutate(struct options *o) { @@ -3218,12 +3205,10 @@ options_postprocess_mutate(struct options *o) o->verify_hash_no_ca = true; } -#if P2MP /* * Save certain parms before modifying options via --pull */ pre_pull_save(o); -#endif } /* @@ -3530,12 +3515,9 @@ options_postprocess_filechecks(struct options *options) options->management_user_pass, R_OK, "--management user/password file"); #endif /* ENABLE_MANAGEMENT */ -#if P2MP errs |= check_file_access(CHKACC_FILE|CHKACC_ACPTSTDIN|CHKACC_PRIVATE, options->auth_user_pass_file, R_OK, "--auth-user-pass"); -#endif /* P2MP */ - /* ** System related ** */ errs |= check_file_access(CHKACC_FILE, options->chroot_dir, R_OK|X_OK, "--chroot directory"); @@ -3576,8 +3558,6 @@ options_postprocess(struct options *options) #endif /* !ENABLE_SMALL */ } -#if P2MP - /* * Save/Restore certain option defaults before --pull is applied. */ @@ -3678,7 +3658,6 @@ pre_pull_restore(struct options *o, struct gc_arena *gc) o->data_channel_use_ekm = false; } -#endif /* if P2MP */ /** * Calculate the link-mtu to advertise to our peer. The actual value is not * relevant, because we will possibly perform data channel cipher negotiation @@ -4272,8 +4251,6 @@ print_topology(const int topology) } } -#if P2MP - /* * Manage auth-retry variable */ @@ -4328,8 +4305,6 @@ auth_retry_print(void) } } -#endif /* if P2MP */ - /* * Print the help message. */ @@ -5064,8 +5039,6 @@ options_string_import(struct options *options, read_config_string("[CONFIG-STRING]", options, config, msglevel, permission_mask, option_types_found, es); } -#if P2MP - #define VERIFY_PERMISSION(mask) { \ if (!verify_permission(p[0], file, line, (mask), permission_mask, \ option_types_found, msglevel, options, is_inline)) \ @@ -5127,12 +5100,6 @@ verify_permission(const char *name, return true; } -#else /* if P2MP */ - -#define VERIFY_PERMISSION(mask) - -#endif /* if P2MP */ - /* * Check that an option doesn't have too * many parameters. @@ -6137,7 +6104,6 @@ add_option(struct options *options, } else if (streq(p[0], "shaper") && p[1] && !p[2]) { -#ifdef ENABLE_FEATURE_SHAPER int shaper; VERIFY_PERMISSION(OPT_P_SHAPER); @@ -6149,11 +6115,6 @@ add_option(struct options *options, goto err; } options->shaper = shaper; -#else /* ENABLE_FEATURE_SHAPER */ - VERIFY_PERMISSION(OPT_P_GENERAL); - msg(msglevel, "--shaper requires the gettimeofday() function which is missing"); - goto err; -#endif /* ENABLE_FEATURE_SHAPER */ } else if (streq(p[0], "port") && p[1] && !p[2]) { @@ -6731,7 +6692,6 @@ add_option(struct options *options, VERIFY_PERMISSION(OPT_P_GENERAL); options->occ = false; } -#if P2MP else if (streq(p[0], "server") && p[1] && p[2] && !p[4]) { const int lev = M_WARN; @@ -7321,7 +7281,6 @@ add_option(struct options *options, } } #endif -#endif /* if P2MP */ else if (streq(p[0], "msg-channel") && p[1]) { #ifdef _WIN32 diff --git a/src/openvpn/options.h b/src/openvpn/options.h index f3208c719..85ebd2aed 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -58,8 +58,6 @@ extern const char title_string[]; -#if P2MP - /* certain options are saved before --pull modifications are applied */ struct options_pre_pull { @@ -86,7 +84,6 @@ struct options_pre_pull int foreign_option_index; }; -#endif #if !defined(ENABLE_CRYPTO_OPENSSL) && !defined(ENABLE_CRYPTO_MBEDTLS) #error "At least one of OpenSSL or mbed TLS needs to be defined." #endif @@ -272,9 +269,7 @@ struct options const char *ifconfig_ipv6_remote; bool ifconfig_noexec; bool ifconfig_nowarn; -#ifdef ENABLE_FEATURE_SHAPER int shaper; -#endif int proto_force; @@ -410,10 +405,6 @@ struct options struct plugin_option_list *plugin_list; #endif - - -#if P2MP - /* the tmp dir is for now only used in the P2P server context */ const char *tmp_dir; bool server_defined; @@ -509,8 +500,6 @@ struct options #ifdef ENABLE_MANAGEMENT struct static_challenge_info sc_info; #endif -#endif /* if P2MP */ - /* Cipher parms */ const char *shared_secret_file; bool shared_secret_file_inline; @@ -706,10 +695,8 @@ struct options #define OPT_P_DEFAULT (~(OPT_P_INSTANCE|OPT_P_PULL_MODE)) -#if P2MP #define PULL_DEFINED(opt) ((opt)->pull) #define PUSH_DEFINED(opt) ((opt)->push_list) -#endif #ifndef PULL_DEFINED #define PULL_DEFINED(opt) (false) @@ -725,11 +712,8 @@ struct options #define ROUTE_OPTION_FLAGS(o) (0) #endif -#ifdef ENABLE_FEATURE_SHAPER + #define SHAPER_DEFINED(opt) ((opt)->shaper) -#else -#define SHAPER_DEFINED(opt) (false) -#endif #ifdef ENABLE_PLUGIN #define PLUGIN_OPTION_LIST(opt) ((opt)->plugin_list) @@ -848,8 +832,6 @@ const char *print_topology(const int topology); * Manage auth-retry variable */ -#if P2MP - #define AR_NONE 0 #define AR_INTERACT 1 #define AR_NOINTERACT 2 @@ -860,8 +842,6 @@ bool auth_retry_set(const int msglevel, const char *option); const char *auth_retry_print(void); -#endif - void options_string_import(struct options *options, const char *config, const int msglevel, @@ -869,4 +849,31 @@ void options_string_import(struct options *options, unsigned int *option_types_found, struct env_set *es); +/** + * Returns whether the current configuration has dco enabled. + */ +#ifdef ENABLE_LINUXDCO +static inline bool +dco_enabled(struct options *o) { return !o->tuntap_options.disable_dco; } + +/** + * Checks wether the optiosn struct has any option that is not supported by + * our current dco implementation. If so it prints a warning at warning level + * for the first conflicting option found and returns false + * @param msglevel the msg level to use to print the warnings + * @param o the optiions struct that hold the options + * @return true if a conflict with dco is detected. + */ +bool +check_option_conflict_dco(int msglevel, struct options *o) +#else +/* Dummy functions to avoid ifdefs in the other code */ + +static inline bool +dco_enabled(struct options *o) { return false; } + +static inline bool +check_option_conflict_dco(int msglevel, struct options *o) { return false; } +#endif + #endif /* ifndef OPTIONS_H */ diff --git a/src/openvpn/otime.c b/src/openvpn/otime.c index 640168a97..a3ca3e59d 100644 --- a/src/openvpn/otime.c +++ b/src/openvpn/otime.c @@ -35,8 +35,6 @@ time_t now = 0; /* GLOBAL */ -#if TIME_BACKTRACK_PROTECTION - static time_t now_adj = 0; /* GLOBAL */ time_t now_usec = 0; /* GLOBAL */ @@ -79,8 +77,6 @@ update_now_usec(struct timeval *tv) } } -#endif /* TIME_BACKTRACK_PROTECTION */ - /* * Return a numerical string describing a struct timeval. */ diff --git a/src/openvpn/pool.c b/src/openvpn/pool.c index ece0784ff..4a300abbc 100644 --- a/src/openvpn/pool.c +++ b/src/openvpn/pool.c @@ -37,8 +37,6 @@ #include "memdbg.h" -#if P2MP - static void ifconfig_pool_entry_free(struct ifconfig_pool_entry *ipe, bool hard) { @@ -835,5 +833,3 @@ ifconfig_pool_test(in_addr_t start, in_addr_t end) } #endif /* ifdef IFCONFIG_POOL_TEST */ - -#endif /* if P2MP */ diff --git a/src/openvpn/pool.h b/src/openvpn/pool.h index b06424c95..0e3055969 100644 --- a/src/openvpn/pool.h +++ b/src/openvpn/pool.h @@ -24,8 +24,6 @@ #ifndef POOL_H #define POOL_H -#if P2MP - /*#define IFCONFIG_POOL_TEST*/ #include "basic.h" @@ -102,5 +100,4 @@ void ifconfig_pool_test(in_addr_t start, in_addr_t end); #endif -#endif /* if P2MP */ #endif /* ifndef POOL_H */ diff --git a/src/openvpn/push.c b/src/openvpn/push.c index 18d7c1e00..47a67e503 100644 --- a/src/openvpn/push.c +++ b/src/openvpn/push.c @@ -39,8 +39,6 @@ #include "memdbg.h" #include "ssl_util.h" -#if P2MP - static char push_reply_cmd[] = "PUSH_REPLY"; /* @@ -1053,4 +1051,3 @@ remove_iroutes_from_push_route_list(struct options *o) gc_free(&gc); } } -#endif /* if P2MP */ diff --git a/src/openvpn/push.h b/src/openvpn/push.h index bb787a62a..b6388fcd7 100644 --- a/src/openvpn/push.h +++ b/src/openvpn/push.h @@ -24,8 +24,6 @@ #ifndef PUSH_H #define PUSH_H -#if P2MP - #include "forward.h" #define PUSH_MSG_ERROR 0 @@ -100,5 +98,4 @@ void send_push_reply_auth_token(struct tls_multi *multi); void receive_auth_pending(struct context *c, const struct buffer *buffer); -#endif /* if P2MP */ #endif /* ifndef PUSH_H */ diff --git a/src/openvpn/pushlist.h b/src/openvpn/pushlist.h index 967eda22a..6e682684d 100644 --- a/src/openvpn/pushlist.h +++ b/src/openvpn/pushlist.h @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if !defined(PUSHLIST_H) && P2MP +#if !defined(PUSHLIST_H) #define PUSHLIST_H /* parameters to be pushed to peer */ @@ -37,4 +37,4 @@ struct push_list { struct push_entry *tail; }; -#endif /* if !defined(PUSHLIST_H) && P2MP */ +#endif /* if !defined(PUSHLIST_H) */ diff --git a/src/openvpn/route.h b/src/openvpn/route.h index 7dd960914..935e14713 100644 --- a/src/openvpn/route.h +++ b/src/openvpn/route.h @@ -230,7 +230,6 @@ struct route_ipv6_list { struct gc_arena gc; }; -#if P2MP /* internal OpenVPN route */ struct iroute { in_addr_t network; @@ -243,7 +242,6 @@ struct iroute_ipv6 { unsigned int netbits; struct iroute_ipv6 *next; }; -#endif struct route_option_list *new_route_option_list(struct gc_arena *a); diff --git a/src/openvpn/shaper.c b/src/openvpn/shaper.c index 57a242416..d29b3b3ae 100644 --- a/src/openvpn/shaper.c +++ b/src/openvpn/shaper.c @@ -31,8 +31,6 @@ #include "shaper.h" #include "memdbg.h" -#ifdef ENABLE_FEATURE_SHAPER - /* * We want to wake up in delay microseconds. If timeval is larger * than delay, set timeval to delay. @@ -93,5 +91,4 @@ shaper_msg(struct shaper *s) { msg(M_INFO, "Output Traffic Shaping initialized at %d bytes per second", s->bytes_per_second); -} -#endif /* ENABLE_FEATURE_SHAPER */ +} \ No newline at end of file diff --git a/src/openvpn/shaper.h b/src/openvpn/shaper.h index bcdb5e365..d9b9daf57 100644 --- a/src/openvpn/shaper.h +++ b/src/openvpn/shaper.h @@ -26,8 +26,6 @@ /*#define SHAPER_DEBUG*/ -#ifdef ENABLE_FEATURE_SHAPER - #include "basic.h" #include "integer.h" #include "misc.h" @@ -173,6 +171,4 @@ shaper_change_pct(struct shaper *s, int pct) } #endif -#endif /* ENABLE_FEATURE_SHAPER */ - #endif /* ifndef SHAPER_H */ diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index cf9714593..de4fbbf94 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -405,13 +405,6 @@ typedef int MIB_TCP_STATE; #define PASSTOS_CAPABILITY 0 #endif -/* - * Do we have nanoseconds gettimeofday? - */ -#if defined(HAVE_GETTIMEOFDAY) || defined(_WIN32) -#define HAVE_GETTIMEOFDAY_NANOSECONDS 1 -#endif - /* * Do we have the capability to report extended socket errors? */ @@ -509,16 +502,6 @@ socket_defined(const socket_descriptor_t sd) #define ENABLE_FEATURE_EXECVE #endif -/* - * Do we have point-to-multipoint capability? - */ - -#if defined(HAVE_GETTIMEOFDAY_NANOSECONDS) -#define P2MP 1 -#else -#define P2MP 0 -#endif - /* * HTTPS port sharing capability */ @@ -596,21 +579,6 @@ socket_defined(const socket_descriptor_t sd) #define EPOLL 0 #endif -/* - * Reduce sensitivity to system clock instability - * and backtracks. - */ -#if defined(HAVE_GETTIMEOFDAY_NANOSECONDS) -#define TIME_BACKTRACK_PROTECTION 1 -#endif - -/* - * Enable traffic shaper. - */ -#if defined(HAVE_GETTIMEOFDAY_NANOSECONDS) -#define ENABLE_FEATURE_SHAPER 1 -#endif - /* * Is non-blocking connect() supported? */ From patchwork Thu Apr 1 02:13:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1687 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id +AXjMjvHZWA3DQAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from proxy5.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id KLWGMjvHZWBVJAAAalYnBA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from smtp12.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 gOtDMjvHZWBwMQAA8Zzt7w (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -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: smtp12.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: 33b122a0-92ec-11eb-b6b7-52540070b731-1-1 Received: from [216.105.38.7] ([216.105.38.7:60178] helo=lists.sourceforge.net) by smtp12.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id B4/90-14936-A37C5606; Thu, 01 Apr 2021 09:14:34 -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 1lRx92-0001C8-Gc; Thu, 01 Apr 2021 13:13:56 +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-0001Bs-7X 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=+6qX6VBuIQlKYYxj9jHCpSr5xMdeBsRBzoZux71okQ4=; b=iFLmEzjMw+jqvJB5LXHfbrCrLU j2JPAWXDbkyPLFByYyQJTmlCTfQOXls4S0NtPh1KIvaGQZSp4yhKyfDo7gJQv4aigYHw9xZxt59hu eWXQp3PbbWd9HqIYPtSXrf9YUYjkyPcmAJyKXVpbnK/GXshqzMhrR2RAtIo/HDZxW6kQ=; 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=+6qX6VBuIQlKYYxj9jHCpSr5xMdeBsRBzoZux71okQ4=; b=ezNnpJqKG9BaXWdmgRVGIIpYul hmIgUqFHey/W+m377z0G05tUeifPJXEeJ/KB2iZ9Ks4b3hKLdxlA0PznLn4ZiX/Qwresm9OyJXWCU ekv1sWCxquWGI7KxL4bzBZ3B4drwyWi9rvyLnXtR9J8tN4JatGkvyt9KHhxhDms76YsA=; 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-0036am-In 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-000J8R-Kp for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3767 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:35 +0200 Message-Id: <20210401131337.3684-13-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-0036am-In Subject: [Openvpn-devel] [PATCH 12/14] Extract multi_assign_peer_id into its own function 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 makes multi_get_create_instance_udp a bit shorter and better structured and also prepares this method to be called from the mutlti TCP context with DCO which will also need to assign unique peer ids to instances. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/mudp.c | 20 +------------------- src/openvpn/multi.c | 21 +++++++++++++++++++++ src/openvpn/multi.h | 10 ++++++++++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 90e32a8ec..9225d42de 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -103,27 +103,9 @@ multi_get_create_instance_udp(struct multi_context *m, bool *floated) mi = multi_create_instance(m, &real); if (mi) { - int i; - hash_add_fast(hash, bucket, &mi->real, hv, mi); mi->did_real_hash = true; - - /* max_clients must be less then max peer-id value */ - ASSERT(m->max_clients < MAX_PEER_ID); - - for (i = 0; i < m->max_clients; ++i) - { - if (!m->instances[i]) - { - mi->context.c2.tls_multi->peer_id = i; - m->instances[i] = mi; - break; - } - } - - /* should not really end up here, since multi_create_instance returns null - * if amount of clients exceeds max_clients */ - ASSERT(i < m->max_clients); + multi_assign_peer_id(m, mi); } } else diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 071bd5b61..d4c5304cb 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -4016,6 +4016,27 @@ init_management_callback_multi(struct multi_context *m) #endif /* ifdef ENABLE_MANAGEMENT */ } +void multi_assign_peer_id(struct multi_context *m, struct multi_instance *mi) +{ + /* max_clients must be less then max peer-id value */ + ASSERT(m->max_clients < MAX_PEER_ID); + + for (int i = 0; i < m->max_clients; ++i) + { + if (!m->instances[i]) + { + mi->context.c2.tls_multi->peer_id = i; + m->instances[i] = mi; + break; + } + } + + /* should not really end up here, since multi_create_instance returns null + * if amount of clients exceeds max_clients */ + ASSERT(mi->context.c2.tls_multi->peer_id < m->max_clients); +} + + /* * Top level event loop. */ diff --git a/src/openvpn/multi.h b/src/openvpn/multi.h index b7078b711..9d771f537 100644 --- a/src/openvpn/multi.h +++ b/src/openvpn/multi.h @@ -676,5 +676,15 @@ multi_set_pending(struct multi_context *m, struct multi_instance *mi) { m->pending = mi; } +/** + * Assigns a peer-id to a a client and adds the instance to the + * the instances array of the \c multi_context structure. + * + * @param m - The single \c multi_context structure. + * @param mi - The \c multi_instance of the VPN tunnel to be + * postprocessed. + */ +void multi_assign_peer_id(struct multi_context *m, struct multi_instance *mi); + #endif /* MULTI_H */ From patchwork Thu Apr 1 02:13:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1686 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 2FCpLTvHZWCwSgAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from proxy4.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id wMhsLTvHZWDcEwAAovjBpQ (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -0400 Received: from smtp31.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy4.mail.ord1d.rsapps.net with LMTPS id OH0iLTvHZWCcLAAAiYrejw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:35 -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: smtp31.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: 33a9fc32-92ec-11eb-939e-525400b3ac8c-1-1 Received: from [216.105.38.7] ([216.105.38.7:53432] helo=lists.sourceforge.net) by smtp31.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id E8/1F-31436-A37C5606; Thu, 01 Apr 2021 09:14:35 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lRx8z-0007F0-8F; Thu, 01 Apr 2021 13:13:53 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lRx8w-0007Ek-6Y for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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=Gn16S0buCBc+byfZ6nQEiWzcWuqDQYSCnXpspO9NaOM=; b=jEfBqALKrXXRAc2BpxeYg45C1C /WG473g4G84EzMPe2TTAtUv8MRWi3/LcQJpw01BZT/7sZmtTecIGgVR3mpl9hjiFe/VR6emd+XhFo po/hJaNYqgWKXtXJGIhLzF1eMsXDhNx7KZgwTjHwNGlP44cnvrayxCIWfq9UHYpQHGIM=; 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=Gn16S0buCBc+byfZ6nQEiWzcWuqDQYSCnXpspO9NaOM=; b=cIa1454eIPnqt6FWnSnqE70khz 170xUpoD4XKYytN/FxXXQwKMS1BSpjVRDV1wtBUu+Bq0gAIRgVBlf+gXD6zSF1Xv+aiSzfi8l5A4y XkxG1nA8qxF0ifFQIphqG9j84NiotlRjwcfdyyc8X4bongsLzAKt5GYCgVEUrMFE2o6E=; 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-0036an-Ij for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 13:13:50 +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-000J8U-Ms for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3770 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:36 +0200 Message-Id: <20210401131337.3684-14-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-0036an-Ij Subject: [Openvpn-devel] [PATCH 13/14] log file descriptor in more socket related error messages 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 add the fd to the epoll event error message and the x_check_status message. This helps debugging when thing go wrong with event handling. Also add logging when ep_del fails to remove a socket from the structure. In constract to ep_ctl that has this as a FATAL message (M_ERR), we only log here since the code has been ignoring the status forever there might be corner cases where a FATAL message could trigger an unintened regression. Signed-off-by: Arne Schwabe --- src/openvpn/error.c | 8 ++++---- src/openvpn/event.c | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/openvpn/error.c b/src/openvpn/error.c index e6f7ff0ff..4eebf41a9 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -690,15 +690,15 @@ x_check_status(int status, { if (extended_msg) { - msg(x_cs_info_level, "%s %s [%s]: %s (code=%d)", description, + msg(x_cs_info_level, "%s %s [%s]: %s (fd=%d,code=%d)", description, sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "", - extended_msg, strerror(my_errno), my_errno); + extended_msg, strerror(my_errno), my_errno, sock ? sock->sd : -1); } else { - msg(x_cs_info_level, "%s %s: %s (code=%d)", description, + msg(x_cs_info_level, "%s %s: %s (fd=%d,code=%d)", description, sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "", - strerror(my_errno), my_errno); + strerror(my_errno), my_errno, sock ? sock->sd : -1); } if (x_cs_err_delay_ms) diff --git a/src/openvpn/event.c b/src/openvpn/event.c index 49dfa861c..14a25155c 100644 --- a/src/openvpn/event.c +++ b/src/openvpn/event.c @@ -555,7 +555,10 @@ ep_del(struct event_set *es, event_t event) ASSERT(!eps->fast); CLEAR(ev); - epoll_ctl(eps->epfd, EPOLL_CTL_DEL, event, &ev); + if (epoll_ctl(eps->epfd, EPOLL_CTL_DEL, event, &ev) < 0) + { + msg(M_WARN|M_ERRNO, "EVENT: epoll_ctl EPOLL_CTL_DEL failed, sd=%d", (int)event); + } } static void @@ -844,7 +847,8 @@ po_wait(struct event_set *es, const struct timeval *tv, struct event_set_return } else if (pfdp->revents) { - msg(D_EVENT_ERRORS, "Error: poll: unknown revents=0x%04x", (unsigned int)pfdp->revents); + msg(D_EVENT_ERRORS, "Error: poll: unknown revents=0x%04x for fd=%d", + (unsigned int)pfdp->revents, pfdp->fd); } ++pfdp; } From patchwork Thu Apr 1 02:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 1691 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id iMQIGUDHZWA3DQAAIUCqbw (envelope-from ) for ; Thu, 01 Apr 2021 09:14:40 -0400 Received: from proxy18.mail.ord1d.rsapps.net ([172.30.191.6]) by director13.mail.ord1d.rsapps.net with LMTP id mI/EGEDHZWB5PgAA91zNiA (envelope-from ) for ; Thu, 01 Apr 2021 09:14:40 -0400 Received: from smtp17.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.ord1d.rsapps.net with LMTPS id 4OB2GEDHZWDJVAAATCaURg (envelope-from ) for ; Thu, 01 Apr 2021 09:14:40 -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: smtp17.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: 363b8402-92ec-11eb-855d-5254008de1cb-1-1 Received: from [216.105.38.7] ([216.105.38.7:52766] helo=lists.sourceforge.net) by smtp17.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 72/29-07571-E37C5606; Thu, 01 Apr 2021 09:14:39 -0400 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.90_1) (envelope-from ) id 1lRx96-0000Qm-NM; Thu, 01 Apr 2021 13:14:00 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRx8z-0000OQ-81 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=7wdvYxsg9y4qeDeEGWm1MtQ0IWhbU6baiXiT9Jjxz5A=; b=cRy4HpW53UVIsDea3fHx0Vg8ij 2/3U+Nbz/T6yI9t05yO5rmkR2NlV9ZC0DTtcGt2D7YiFCcnkwfEcJ6NyVcgCBfzmGzjta+PkOJoGu G6nLUWXEfgum/DZ9J22JKCGHE9WdeMy+zLwTBPX6DuTaHx8upe54TeIuUsYAlW/z+q4Q=; 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=7wdvYxsg9y4qeDeEGWm1MtQ0IWhbU6baiXiT9Jjxz5A=; b=BvGvNaekZhRF4q+LzOhgMSUjD3 HopF4M1mSVxv/s7SEWsW9J95AMdkWHDqJuwP6soFJkTuLgQKKEXx1iMV3aen5hax8hw49Z1VgEZg6 rBI1jHjink/ckmB4tSTbl3NcwAN2yr3KpNexbtmtFqDXVAjrsaQPIHgd05o+RloaPSpg=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1lRx8r-0003Uq-P4 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-000J8X-Pm for openvpn-devel@lists.sourceforge.net; Thu, 01 Apr 2021 15:13:38 +0200 Received: (nullmailer pid 3773 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:37 +0200 Message-Id: <20210401131337.3684-15-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: 1lRx8r-0003Uq-P4 Subject: [Openvpn-devel] [PATCH 14/14] Remove do_init_socket_2 and do_init_socket_1 wrapper function 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 These two function basically just pass a number of fields of context to the linit_socket_init1/2 functions. This wrapper add little to no value in understanding the code, especially since the linit_socket_init1 will just copy them to yet another structure. Remove these wrapper functions and pass context directly to the called function. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/init.c | 60 +----------------------- src/openvpn/socket.c | 109 +++++++++++++++++++------------------------ src/openvpn/socket.h | 40 ++-------------- 3 files changed, 52 insertions(+), 157 deletions(-) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index 98cc1ebe9..d6dd8675c 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -3339,62 +3339,6 @@ do_link_socket_new(struct context *c) c->c2.link_socket_owned = true; } -/* - * bind the TCP/UDP socket - */ -static void -do_init_socket_1(struct context *c, const int mode) -{ - unsigned int sockflags = c->options.sockflags; - -#if PORT_SHARE - if (c->options.port_share_host && c->options.port_share_port) - { - sockflags |= SF_PORT_SHARE; - } -#endif - - link_socket_init_phase1(c->c2.link_socket, - c->options.ce.local, - c->options.ce.local_port, - c->options.ce.remote, - c->options.ce.remote_port, - c->c1.dns_cache, - c->options.ce.proto, - c->options.ce.af, - c->options.ce.bind_ipv6_only, - mode, - c->c2.accept_from, - c->c1.http_proxy, - c->c1.socks_proxy, -#ifdef ENABLE_DEBUG - c->options.gremlin, -#endif - c->options.ce.bind_local, - c->options.ce.remote_float, - &c->c1.link_socket_addr, - c->options.ipchange, - c->plugins, - c->options.resolve_retry_seconds, - c->options.ce.mtu_discover_type, - c->options.rcvbuf, - c->options.sndbuf, - c->options.mark, - c->options.bind_dev, - &c->c2.server_poll_interval, - sockflags); -} - -/* - * finalize the TCP/UDP socket - */ -static void -do_init_socket_2(struct context *c) -{ - link_socket_init_phase2(c->c2.link_socket, &c->c2.frame, - c->sig); -} - /* * Print MTU INFO */ @@ -4255,7 +4199,7 @@ init_instance(struct context *c, const struct env_set *env, const unsigned int f /* bind the TCP/UDP socket */ if (c->mode == CM_P2P || c->mode == CM_TOP || c->mode == CM_CHILD_TCP) { - do_init_socket_1(c, link_socket_mode); + link_socket_init_phase1(c, link_socket_mode); } /* initialize tun/tap device object, @@ -4299,7 +4243,7 @@ init_instance(struct context *c, const struct env_set *env, const unsigned int f /* finalize the TCP/UDP socket */ if (c->mode == CM_P2P || c->mode == CM_TOP || c->mode == CM_CHILD_TCP) { - do_init_socket_2(c); + link_socket_init_phase2(c); } /* diff --git a/src/openvpn/socket.c b/src/openvpn/socket.c index 6fed4b660..6bb107de6 100644 --- a/src/openvpn/socket.c +++ b/src/openvpn/socket.c @@ -1876,77 +1876,60 @@ link_socket_new(void) } void -link_socket_init_phase1(struct link_socket *sock, - const char *local_host, - const char *local_port, - const char *remote_host, - const char *remote_port, - struct cached_dns_entry *dns_cache, - int proto, - sa_family_t af, - bool bind_ipv6_only, - int mode, - const struct link_socket *accept_from, - struct http_proxy_info *http_proxy, - struct socks_proxy_info *socks_proxy, -#ifdef ENABLE_DEBUG - int gremlin, -#endif - bool bind_local, - bool remote_float, - struct link_socket_addr *lsa, - const char *ipchange_command, - const struct plugin_list *plugins, - int resolve_retry_seconds, - int mtu_discover_type, - int rcvbuf, - int sndbuf, - int mark, - const char *bind_dev, - struct event_timeout *server_poll_timeout, - unsigned int sockflags) +link_socket_init_phase1(struct context *c, int mode) { + struct link_socket *sock = c->c2.link_socket; + struct options *o = &c->options; ASSERT(sock); - sock->local_host = local_host; - sock->local_port = local_port; + const char *remote_host = o->ce.remote; + const char *remote_port = o->ce.remote_port; + + sock->local_host = o->ce.local; + sock->local_port = o->ce.local_port; sock->remote_host = remote_host; sock->remote_port = remote_port; - sock->dns_cache = dns_cache; - sock->http_proxy = http_proxy; - sock->socks_proxy = socks_proxy; - sock->bind_local = bind_local; - sock->resolve_retry_seconds = resolve_retry_seconds; - sock->mtu_discover_type = mtu_discover_type; + sock->dns_cache = c->c1.dns_cache; + sock->http_proxy = c->c1.http_proxy; + sock->socks_proxy = c->c1.socks_proxy; + sock->bind_local = o->ce.bind_local; + sock->resolve_retry_seconds = o->resolve_retry_seconds; + sock->mtu_discover_type = o->ce.mtu_discover_type; #ifdef ENABLE_DEBUG - sock->gremlin = gremlin; + sock->gremlin = o->gremlin; #endif - sock->socket_buffer_sizes.rcvbuf = rcvbuf; - sock->socket_buffer_sizes.sndbuf = sndbuf; + sock->socket_buffer_sizes.rcvbuf = o->rcvbuf; + sock->socket_buffer_sizes.sndbuf = o->sndbuf; - sock->sockflags = sockflags; - sock->mark = mark; - sock->bind_dev = bind_dev; - - sock->info.proto = proto; - sock->info.af = af; - sock->info.remote_float = remote_float; - sock->info.lsa = lsa; - sock->info.bind_ipv6_only = bind_ipv6_only; - sock->info.ipchange_command = ipchange_command; - sock->info.plugins = plugins; - sock->server_poll_timeout = server_poll_timeout; + sock->sockflags = o->sockflags; +#if PORT_SHARE + if (o->port_share_host && o->port_share_port) + { + sock->sockflags |= SF_PORT_SHARE; + } +#endif + sock->mark = o->mark; + sock->bind_dev = o->bind_dev; + + sock->info.proto = o->ce.proto; + sock->info.af = o->ce.af; + sock->info.remote_float = o->ce.remote_float; + sock->info.lsa = &c->c1.link_socket_addr; + sock->info.bind_ipv6_only = o->ce.bind_ipv6_only; + sock->info.ipchange_command = o->ipchange; + sock->info.plugins = c->plugins; + sock->server_poll_timeout = &c->c2.server_poll_interval; sock->mode = mode; if (mode == LS_MODE_TCP_ACCEPT_FROM) { - ASSERT(accept_from); + ASSERT(c->c2.accept_from); ASSERT(sock->info.proto == PROTO_TCP_SERVER); - sock->sd = accept_from->sd; + sock->sd = c->c2.accept_from->sd; /* inherit (possibly guessed) info AF from parent context */ - sock->info.af = accept_from->info.af; + sock->info.af = c->c2.accept_from->info.af; } /* are we running in HTTP proxy mode? */ @@ -1955,8 +1938,8 @@ link_socket_init_phase1(struct link_socket *sock, ASSERT(sock->info.proto == PROTO_TCP_CLIENT); /* the proxy server */ - sock->remote_host = http_proxy->options.server; - sock->remote_port = http_proxy->options.port; + sock->remote_host = c->c1.http_proxy->options.server; + sock->remote_port = c->c1.http_proxy->options.port; /* the OpenVPN server we will use the proxy to connect to */ sock->proxy_dest_host = remote_host; @@ -1966,8 +1949,8 @@ link_socket_init_phase1(struct link_socket *sock, else if (sock->socks_proxy) { /* the proxy server */ - sock->remote_host = socks_proxy->server; - sock->remote_port = socks_proxy->port; + sock->remote_host = c->c1.socks_proxy->server; + sock->remote_port = c->c1.socks_proxy->port; /* the OpenVPN server we will use the proxy to connect to */ sock->proxy_dest_host = remote_host; @@ -2188,10 +2171,12 @@ phase2_socks_client(struct link_socket *sock, struct signal_info *sig_info) /* finalize socket initialization */ void -link_socket_init_phase2(struct link_socket *sock, - const struct frame *frame, - struct signal_info *sig_info) +link_socket_init_phase2(struct context *c) { + struct link_socket *sock = c->c2.link_socket; + const struct frame *frame = &c->c2.frame; + struct signal_info *sig_info = c->sig; + const char *remote_dynamic = NULL; int sig_save = 0; diff --git a/src/openvpn/socket.h b/src/openvpn/socket.h index d58fda4d3..6a86ee054 100644 --- a/src/openvpn/socket.h +++ b/src/openvpn/socket.h @@ -292,43 +292,9 @@ int openvpn_connect(socket_descriptor_t sd, /* * Initialize link_socket object. */ -/* *INDENT-OFF* uncrustify misparses this function declarion because of - * embedded #if/#endif tell it to skip this section */ -void -link_socket_init_phase1(struct link_socket *sock, - const char *local_host, - const char *local_port, - const char *remote_host, - const char *remote_port, - struct cached_dns_entry *dns_cache, - int proto, - sa_family_t af, - bool bind_ipv6_only, - int mode, - const struct link_socket *accept_from, - struct http_proxy_info *http_proxy, - struct socks_proxy_info *socks_proxy, -#ifdef ENABLE_DEBUG - int gremlin, -#endif - bool bind_local, - bool remote_float, - struct link_socket_addr *lsa, - const char *ipchange_command, - const struct plugin_list *plugins, - int resolve_retry_seconds, - int mtu_discover_type, - int rcvbuf, - int sndbuf, - int mark, - const char *bind_dev, - struct event_timeout *server_poll_timeout, - unsigned int sockflags); -/* Reenable uncrustify *INDENT-ON* */ - -void link_socket_init_phase2(struct link_socket *sock, - const struct frame *frame, - struct signal_info *sig_info); +void link_socket_init_phase1(struct context *c, int mode); + +void link_socket_init_phase2(struct context *c); void do_preresolve(struct context *c);