[Openvpn-devel] dco-win: support for --dev-node

Message ID 20230518110058.1382-1-lstipakov@gmail.com
State Accepted
Headers show
Series [Openvpn-devel] dco-win: support for --dev-node | expand

Commit Message

Lev Stipakov May 18, 2023, 11 a.m. UTC
From: Lev Stipakov <lev@openvpn.net>

With --dev-node on Windows, one can specify GUID
of the adapter openvpn should use. Those can be listed with:

  C:\Program Files\OpenVPN\bin>openvpn.exe --show-adapters

While on it, remove "TAP-WIN32 / Wintun" from --show-adapters output.

Fixes https://github.com/OpenVPN/openvpn/issues/336

Change-Id: I57de4d3c069465fb730bb635bfdbdf360fc8c475
Signed-off-by: Lev Stipakov <lev@openvpn.net>
 src/openvpn/options.c | 4 ++--
 src/openvpn/tun.c     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)


Gert Doering May 19, 2023, 6:39 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

The patch is actually quite trivial - just prevent the "if (dco)"
option checker from unsetting --dev-node...

I have not tested it beyond "stare-at-code" and "do a MinGW test compile".

Your patch has been applied to the master and release/2.6 branch.

commit c543cf464e97866e20345feb46c82752fedc9d71 (master)
commit ea9382d7b41849a92a9d18fa3f5420925277144e (release/2.6)
Author: Lev Stipakov
Date:   Thu May 18 14:00:58 2023 +0300

     dco-win: support for --dev-node

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20230518110058.1382-1-lstipakov@gmail.com>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26702.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index fa435c1d..e4c596b8 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3771,14 +3771,14 @@  options_postprocess_mutate(struct options *o, struct env_set *es)
             o->windows_driver = WINDOWS_DRIVER_TAP_WINDOWS6;
+#else  /* _WIN32 */
     if (dco_enabled(o) && o->dev_node)
         msg(M_WARN, "Note: ignoring --dev-node as it has no effect when using "
             "data channel offload");
         o->dev_node = NULL;
+#endif /* _WIN32 */
     /* this depends on o->windows_driver, which is set above */
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index df10dbd2..4ef390ad 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -4200,7 +4200,7 @@  show_tap_win_adapters(int msglev, int warnlev)
     const struct tap_reg *tap_reg = get_tap_reg(&gc);
     const struct panel_reg *panel_reg = get_panel_reg(&gc);
-    msg(msglev, "Available TAP-WIN32 / Wintun adapters [name, GUID, driver]:");
+    msg(msglev, "Available adapters [name, GUID, driver]:");
     /* loop through each TAP-Windows adapter registry entry */
     for (tr = tap_reg; tr != NULL; tr = tr->next)