fatal errors.
.\"*********************************************************
.TP
+.B \-\-windows\-driver
+Specifies which tun driver to use. Values are
+.B tap-windows6
+(default) and
+.B wintun.
+This is Windows-only option.
+.\"*********************************************************
+.TP
.B \-\-dhcp\-renew
Ask Windows to renew the TAP adapter lease on startup.
This option is normally unnecessary, as Windows automatically
" optional parameter controls the initial state of ex.\n"
"--show-net-up : Show " PACKAGE_NAME "'s view of routing table and net adapter list\n"
" after TAP adapter is up and routes have been added.\n"
-#ifdef _WIN32
+ "--windows-driver : Which tun driver to use?\n"
+ " tap-windows6 (default)\n"
+ " wintun\n"
"--block-outside-dns : Block DNS on other network adapters to prevent DNS leaks\n"
-#endif
"Windows Standalone Options:\n"
"\n"
"--show-adapters : Show all TAP-Windows adapters.\n"
o->tuntap_options.dhcp_masq_offset = 0; /* use network address as internal DHCP server address */
o->route_method = ROUTE_METHOD_ADAPTIVE;
o->block_outside_dns = false;
+ o->wintun = false;
#endif
o->vlan_accept = VLAN_ALL;
o->vlan_pvid = 1;
options->ifconfig_noexec = false;
}
+ /* for wintun kernel doesn't send DHCP requests, so use ipapi to set IP address and netmask */
+ if (options->wintun)
+ {
+ options->tuntap_options.ip_win32_type = IPW32_SET_IPAPI;
+ }
+
remap_redirect_gateway_flags(options);
#endif
}
}
+#ifdef _WIN32
+/**
+ * Parses --windows-driver config option
+ *
+ * @param str value of --windows-driver option
+ * @param msglevel msglevel to report parsing error
+ * @return bool true if --windows-driver is wintun, false otherwise
+ */
+static bool
+parse_windows_driver(const char *str, const int msglevel)
+{
+ if (streq(str, "tap-windows6"))
+ {
+ return false;
+ }
+ else if (streq(str, "wintun"))
+ {
+ return true;
+ }
+ else
+ {
+ msg(msglevel, "--windows-driver must be tap-windows6 or wintun");
+ return false;
+ }
+}
+#endif
+
/*
* parse/print topology coding
*/
VERIFY_PERMISSION(OPT_P_GENERAL);
options->dev_type = p[1];
}
+#ifdef _WIN32
+ else if (streq(p[0], "windows-driver") && p[1] && !p[2])
+ {
+ VERIFY_PERMISSION(OPT_P_GENERAL);
+ options->wintun = parse_windows_driver(p[1], M_FATAL);
+ }
+#endif
else if (streq(p[0], "dev-node") && p[1] && !p[2])
{
VERIFY_PERMISSION(OPT_P_GENERAL);