From: Antonio Quartulli <a@...2181...>
To: openvpn-devel@lists.sourceforge.net
Cc: Antonio Quartulli <a@...2181...>
Subject: [Openvpn-devel] [PATCH 07/25] dco: add option check - disable DCO if conflict is detected
Date: Fri, 24 Jun 2022 10:37:51 +0200 [thread overview]
Message-ID: <20220624083809.23487-8-a@...2181...> (raw)
In-Reply-To: <20220624083809.23487-1-a@...2181...>
Signed-off-by: Antonio Quartulli <a@...2181...>
---
src/openvpn/Makefile.am | 2 +-
src/openvpn/dco.c | 149 ++++++++++++++++++++++++++++
src/openvpn/openvpn.vcxproj | 1 +
src/openvpn/openvpn.vcxproj.filters | 3 +
4 files changed, 154 insertions(+), 1 deletion(-)
create mode 100644 src/openvpn/dco.c
diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index 91635b67..aaa1dbce 100644
--- a/src/openvpn/Makefile.am
+++ b/src/openvpn/Makefile.am
@@ -53,7 +53,7 @@ openvpn_SOURCES = \
crypto.c crypto.h crypto_backend.h \
crypto_openssl.c crypto_openssl.h \
crypto_mbedtls.c crypto_mbedtls.h \
- dco.h dco_internal.h \
+ dco.c dco.h dco_internal.h \
dco_linux.c dco_linux.h \
dhcp.c dhcp.h \
dns.c dns.h \
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
new file mode 100644
index 00000000..1e45130a
--- /dev/null
+++ b/src/openvpn/dco.c
@@ -0,0 +1,149 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks
+ * over a single TCP/UDP port, with support for SSL/TLS-based
+ * session authentication and key exchange,
+ * packet encryption, packet authentication, and
+ * packet compression.
+ *
+ * Copyright (C) 2021-2022 Arne Schwabe <arne@...1227...>
+ * Copyright (C) 2021-2022 Antonio Quartulli <a@...2181...>
+ * Copyright (C) 2021-2022 OpenVPN Inc <sales@...515...>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program (see the file COPYING included with this
+ * distribution); if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#elif defined(_MSC_VER)
+#include "config-msvc.h"
+#endif
+
+#if defined(ENABLE_DCO)
+
+#include "syshead.h"
+#include "dco.h"
+
+static bool
+dco_check_option_conflict_ce(const struct connection_entry *ce, int msglevel)
+{
+ if (ce->fragment)
+ {
+ msg(msglevel, "Note: --fragment disables data channel offload.");
+ return false;
+ }
+
+ if (ce->http_proxy_options)
+ {
+ msg(msglevel, "Note: --http-proxy disables data channel offload.");
+ return false;
+ }
+
+ if (ce->socks_proxy_server)
+ {
+ msg(msglevel, "Note: --socks-proxy disables data channel offload.");
+ return false;
+ }
+
+ return true;
+}
+
+bool
+dco_check_option_conflict(int msglevel, const struct options *o)
+{
+ if (o->tuntap_options.disable_dco)
+ {
+ /* already disabled by --disable-dco, no need to print warnings */
+ return false;
+ }
+
+ if (!dco_available(msglevel))
+ {
+ return false;
+ }
+
+ if (dev_type_enum(o->dev, o->dev_type) != DEV_TYPE_TUN)
+ {
+ msg(msglevel, "Note: dev-type not tun, disabling data channel offload.");
+ return false;
+ }
+
+ /* At this point the ciphers have already been normalised */
+ if (o->enable_ncp_fallback
+ && !tls_item_in_cipher_list(o->ciphername, DCO_SUPPORTED_CIPHERS))
+ {
+ msg(msglevel, "Note: --data-cipher-fallback with cipher '%s' "
+ "disables data channel offload.", o->ciphername);
+ return false;
+ }
+
+ if (o->connection_list)
+ {
+ const struct connection_list *l = o->connection_list;
+ for (int i = 0; i < l->len; ++i)
+ {
+ if (!dco_check_option_conflict_ce(l->array[i], msglevel))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ if (!dco_check_option_conflict_ce(&o->ce, msglevel))
+ {
+ return false;
+ }
+ }
+
+ if (o->mode == MODE_SERVER && o->topology != TOP_SUBNET)
+ {
+ msg(msglevel, "Note: NOT using '--topology subnet' disables data channel offload.");
+ return false;
+ }
+
+#if defined(USE_COMP)
+ if (o->comp.alg != COMP_ALG_UNDEF)
+ {
+ msg(msglevel, "Note: Using compression disables data channel offload.");
+
+ if (o->mode == MODE_SERVER && !(o->comp.flags & COMP_F_MIGRATE))
+ {
+ /* We can end up here from the multi.c call, only print the
+ * note if it is not already enabled */
+ msg(msglevel, "Consider using the '--compress migrate' option.");
+ }
+ return false;
+ }
+#endif
+
+ struct gc_arena gc = gc_new();
+ char *tmp_ciphers = string_alloc(o->ncp_ciphers, &gc);
+ const char *token;
+ while ((token = strsep(&tmp_ciphers, ":")))
+ {
+ if (!tls_item_in_cipher_list(token, DCO_SUPPORTED_CIPHERS))
+ {
+ msg(msglevel, "Note: cipher '%s' in --data-ciphers is not supported "
+ "by ovpn-dco, disabling data channel offload.", token);
+ gc_free(&gc);
+ return false;
+ }
+ }
+ gc_free(&gc);
+
+ return true;
+}
+
+#endif /* defined(ENABLE_DCO) */
diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj
index bc1a0300..0b3db7c7 100644
--- a/src/openvpn/openvpn.vcxproj
+++ b/src/openvpn/openvpn.vcxproj
@@ -276,6 +276,7 @@
<ClCompile Include="crypto.c" />
<ClCompile Include="crypto_openssl.c" />
<ClCompile Include="cryptoapi.c" />
+ <ClCompile Include="dco.c" />
<ClCompile Include="dco_linux.c" />
<ClCompile Include="dhcp.c" />
<ClCompile Include="dns.c" />
diff --git a/src/openvpn/openvpn.vcxproj.filters b/src/openvpn/openvpn.vcxproj.filters
index 3c21a4c6..16905079 100644
--- a/src/openvpn/openvpn.vcxproj.filters
+++ b/src/openvpn/openvpn.vcxproj.filters
@@ -36,6 +36,9 @@
<ClCompile Include="cryptoapi.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="dco.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
<ClCompile Include="dco_linux.c">
<Filter>Source Files</Filter>
</ClCompile>
--
2.35.1
next prev parent reply other threads:[~2022-06-24 8:37 UTC|newest]
Thread overview: 157+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-24 8:37 [Openvpn-devel] [PATCH 00/25] ovpn-dco: introduce data-channel offload support Antonio Quartulli
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 01/25] dco: introduce low-level code for handling ovpn-dco in the Linux kernel Antonio Quartulli
2022-06-27 11:03 ` Arne Schwabe
2022-06-28 15:07 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-28 15:46 ` Heiko Hund
2022-06-28 15:50 ` Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 02/25] dco: add helper function to detect if DCO is enabled or not Antonio Quartulli
2022-06-27 11:47 ` Arne Schwabe
2022-06-28 15:11 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-07-05 12:36 ` [Openvpn-devel] [PATCH 02/25] " Heiko Hund
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 03/25] dco: use specific metric when installing routes Antonio Quartulli
2022-06-27 11:04 ` Arne Schwabe
2022-06-28 18:56 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-06-28 20:52 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 04/25] dco: create DCO interface using SITNL Antonio Quartulli
2022-06-27 11:06 ` Arne Schwabe
2022-06-28 15:21 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 05/25] dco: let open_tun_generic handle the DCO case Antonio Quartulli
[not found] ` <1b657825-faa9-ea35-fb12-84a940c1e0ba@...1227...>
2022-06-27 11:32 ` Antonio Quartulli
2022-06-27 11:47 ` Arne Schwabe
2022-06-28 18:58 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-06-29 12:29 ` [Openvpn-devel] [PATCH v3] " Antonio Quartulli
2022-06-29 12:49 ` [Openvpn-devel] [PATCH v4] " Antonio Quartulli
2022-06-30 13:44 ` Heiko Hund
2022-06-30 13:51 ` Antonio Quartulli
2022-06-30 14:08 ` [Openvpn-devel] [PATCH v5 05/25] " Antonio Quartulli
2022-07-06 14:29 ` [Openvpn-devel] [PATCH pre-05/25] networking: add net_iface_type API Antonio Quartulli
2022-07-06 14:29 ` [Openvpn-devel] [PATCH v6 05/25] dco: let open_tun_generic handle the DCO case Antonio Quartulli
2022-07-11 13:12 ` [Openvpn-devel] [PATCH v7] " Antonio Quartulli
2022-07-11 13:55 ` [Openvpn-devel] [PATCH v8 05/25] " Antonio Quartulli
2022-07-12 21:46 ` [Openvpn-devel] [PATCH v9 " Antonio Quartulli
2022-07-14 14:11 ` Gert Doering
2022-07-19 14:16 ` [Openvpn-devel] [PATCH v10 " Antonio Quartulli
2022-07-21 18:10 ` Gert Doering
2022-07-21 18:24 ` [Openvpn-devel] [PATCH v11 05/25] dco: introduce open_tun_dco_generic() to open dynamic or fixed-name DCO devices Gert Doering
2022-07-27 13:06 ` Antonio Quartulli
2022-07-27 18:00 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-07-11 8:10 ` [Openvpn-devel] [PATCH v2 pre-05/25] networking: add net_iface_type API Antonio Quartulli
2022-07-13 10:53 ` Gert Doering
2022-07-13 12:05 ` Antonio Quartulli
2022-07-13 12:43 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-07-13 12:55 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 06/25] dco: initialize context and save pointer in TLS object Antonio Quartulli
2022-06-27 11:47 ` Arne Schwabe
2022-07-14 14:27 ` Gert Doering
2022-07-18 22:50 ` Antonio Quartulli
2022-07-20 12:30 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-07-27 18:14 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` Antonio Quartulli [this message]
2022-06-27 11:17 ` [Openvpn-devel] [PATCH 07/25] dco: add option check - disable DCO if conflict is detected Arne Schwabe
2022-07-12 22:13 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-07-18 22:17 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-07-19 9:25 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-07-12 22:16 ` [Openvpn-devel] [PATCH pre-07/25] tun: create tun_name_is_fixed helper Antonio Quartulli
2022-07-14 18:20 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 08/25] dco: allow user to disable it at runtime Antonio Quartulli
2022-06-27 11:32 ` Arne Schwabe
2022-07-05 12:32 ` Heiko Hund
2022-07-18 20:31 ` Antonio Quartulli
2022-07-18 22:19 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-07-19 9:40 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 09/25] dco: configure keys in DCO right after generating them Antonio Quartulli
2022-06-27 12:42 ` Arne Schwabe
2022-07-20 12:32 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-07-28 12:56 ` Arne Schwabe
2022-07-28 13:01 ` Antonio Quartulli
2022-07-28 15:20 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-07-28 15:38 ` Arne Schwabe
2022-08-01 14:06 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-08-01 15:14 ` Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 10/25] dco: periodically check and possibly rotate/delete keys Antonio Quartulli
2022-06-28 14:23 ` Arne Schwabe
2022-07-28 19:35 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-07-29 7:41 ` Frank Lichtenheld
2022-07-29 7:48 ` Antonio Quartulli
2022-08-01 15:44 ` Frank Lichtenheld
2022-08-02 8:07 ` Antonio Quartulli
2022-08-02 15:16 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-08-03 9:10 ` Frank Lichtenheld
2022-08-03 14:30 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 11/25] dco: split option parsing routines Antonio Quartulli
2022-06-28 14:29 ` Arne Schwabe
2022-07-28 19:47 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-08-02 10:53 ` Gert Doering
2022-08-03 8:51 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-08-03 9:50 ` [Openvpn-devel] [PATCH v4 " Antonio Quartulli
2022-08-03 15:56 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 12/25] dco: check that pulled options are compatible Antonio Quartulli
2022-06-28 14:32 ` Arne Schwabe
2022-07-14 20:14 ` Gert Doering
2022-07-18 22:54 ` Antonio Quartulli
2022-07-18 23:12 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 13/25] dco: implement dco support for p2p/client code path Antonio Quartulli
2022-07-05 12:30 ` Heiko Hund
2022-07-05 12:38 ` Antonio Quartulli
2022-08-04 7:14 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-08-04 13:30 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-08-04 13:51 ` Antonio Quartulli
2022-08-04 15:17 ` Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 14/25] dco: implement dco support for p2mp/server " Antonio Quartulli
2022-07-05 12:31 ` Heiko Hund
2022-07-05 14:53 ` Antonio Quartulli
2022-07-05 15:14 ` Arne Schwabe
2022-07-28 19:55 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-08-01 13:10 ` Heiko Hund
2022-08-05 6:45 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-08-05 14:55 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:37 ` [Openvpn-devel] [PATCH 15/25] dco: add documentation for ovpn-dco-linux Antonio Quartulli
2022-07-04 8:29 ` Frank Lichtenheld
2022-07-04 8:33 ` Antonio Quartulli
2022-07-05 12:31 ` Heiko Hund
2022-07-05 14:09 ` Antonio Quartulli
2022-08-05 6:58 ` [Openvpn-devel] [PATCH v2 " Antonio Quartulli
2022-08-05 8:12 ` Frank Lichtenheld
2022-08-05 9:37 ` [Openvpn-devel] [PATCH v3 " Antonio Quartulli
2022-08-05 10:04 ` Frank Lichtenheld
2022-08-05 10:58 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 16/25] GitHub Actions: add Linux DCO build (on Ubuntu 20.04) Antonio Quartulli
2022-07-04 8:58 ` Frank Lichtenheld
2022-07-19 16:52 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 17/25] tun: extract close_tun_handle into its own fucntion and print correct type Antonio Quartulli
2022-07-04 8:47 ` Frank Lichtenheld
2022-07-19 20:13 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 18/25] dco: turn supported ciphers list into a function Antonio Quartulli
2022-07-05 12:31 ` Heiko Hund
2022-08-07 10:04 ` [Openvpn-devel] [PATCH v2 18/18] " Antonio Quartulli
2022-08-07 14:58 ` [Openvpn-devel] [PATCH applied] " Gert Doering
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 19/25] dco-win: implement GetOverlappedResultEx for mingw32 Antonio Quartulli
2022-06-24 18:53 ` Selva Nair
2022-06-27 10:30 ` Lev Stipakov
2022-06-27 18:50 ` Antonio Quartulli
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 20/25] dco-win: add platform dependant check on incompatible options Antonio Quartulli
2022-07-05 12:31 ` Heiko Hund
2022-07-19 20:17 ` Gert Doering
2022-08-11 20:58 ` Gert Doering
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 21/25] do_open_tun: restyle "can preserve TUN" check Antonio Quartulli
2022-07-05 12:31 ` Heiko Hund
2022-07-05 18:47 ` Antonio Quartulli
2022-08-04 11:49 ` Lev Stipakov
2022-08-04 12:07 ` Antonio Quartulli
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 22/25] dco-win: introduce low-level code for handling ovpn-dco-win in Windows Antonio Quartulli
2022-06-27 10:38 ` Lev Stipakov
2022-06-28 8:36 ` Lev Stipakov
2022-07-05 12:32 ` Heiko Hund
2022-07-05 12:40 ` Antonio Quartulli
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 23/25] dco-win: implement ovpn-dco support in P2P Windows code path Antonio Quartulli
2022-06-28 8:46 ` Lev Stipakov
2022-07-05 12:32 ` Heiko Hund
2022-07-11 14:19 ` [Openvpn-devel] [PATCH v2 23/23] " Antonio Quartulli
2022-07-11 15:04 ` Heiko Hund
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 24/25] dco-win: add documentation to README.dco.md Antonio Quartulli
2022-07-05 12:32 ` Heiko Hund
2022-06-24 8:38 ` [Openvpn-devel] [PATCH 25/25] dco-win: update GH Actions config file Antonio Quartulli
2022-07-05 9:32 ` Frank Lichtenheld
2022-07-05 9:36 ` Antonio Quartulli
2022-07-05 10:38 ` Lev Stipakov
2022-08-04 15:28 ` Gert Doering
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220624083809.23487-8-a@...2181... \
--to=openvpn-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.