Skip to contentSkip to conversation

dco-win: support for --dev-node

PATCH In review Lev Stipakov 2 participants 2 messages May 18, 2023 – May 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dco-win: support for --dev-node

From: Lev Stipakov <[email protected]...>

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
---
 src/openvpn/options.c | 4 ++--
 src/openvpn/tun.c     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
src/openvpn/options.c +2 -2
index fa435c1d..e4c596b8 100644
@@ -3771,14 +3771,14 @@ options_postprocess_mutate(struct options *o, struct env_set *es)
             o->windows_driver = WINDOWS_DRIVER_TAP_WINDOWS6;
         }
     }
-#endif
-
+#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 */
     options_postprocess_mutate_invariant(o);
src/openvpn/tun.c +1 -1
index df10dbd2..4ef390ad 100644
@@ -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)
Signature · 1 line
2.23.0.windows.1
Acked-by on v1 1/1
#1 lore raw

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 <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg26702.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering