aboutsummaryrefslogtreecommitdiff
path: root/win32.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-11-19 16:42:51 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2009-11-19 16:42:51 +0000
commit5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e (patch)
treeb900adb66ca9a3c7d57fb89fe647f6772df027f9 /win32.c
parentIncrease MAX_CERT_DEPTH to 16 (from 8), and when exceeded, (diff)
downloadopenvpn-5c30df12ae98c0289cdfb2a24aefba2a9d2cc52e.tar.xz
Fixed a client-side bug that occurred when the "dhcp-pre-release"
or "dhcp-renew" options were combined with "route-gateway dhcp". The problem is that the IP Helper functions for DHCP release and renew are blocking, and so calling them from a single-threaded client stops tunnel traffic forwarding, and hence breaks "route-gateway dhcp" which requires an active tunnel. The fix is to call the IP Helper functions for DHCP release and renew from another process. Version 2.1_rc21b. git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@5164 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'win32.c')
-rw-r--r--win32.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/win32.c b/win32.c
index 26e81a8..eb94eb8 100644
--- a/win32.c
+++ b/win32.c
@@ -1016,6 +1016,51 @@ openvpn_execve (const struct argv *a, const struct env_set *es, const unsigned i
return ret;
}
+/*
+ * call ourself in another process
+ */
+void
+fork_to_self (const char *cmdline)
+{
+ STARTUPINFO start_info;
+ PROCESS_INFORMATION proc_info;
+ char self_exe[256];
+ char *cl = string_alloc (cmdline, NULL);
+ DWORD status;
+
+ CLEAR (start_info);
+ CLEAR (proc_info);
+ CLEAR (self_exe);
+
+ status = GetModuleFileName (NULL, self_exe, sizeof(self_exe));
+ if (status == 0 || status == sizeof(self_exe))
+ {
+ msg (M_WARN|M_ERRNO, "fork_to_self: CreateProcess failed: cannot get module name via GetModuleFileName");
+ goto done;
+ }
+
+ /* fill in STARTUPINFO struct */
+ GetStartupInfo(&start_info);
+ start_info.cb = sizeof(start_info);
+ start_info.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
+ start_info.wShowWindow = SW_HIDE;
+ start_info.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
+ start_info.hStdOutput = start_info.hStdError = GetStdHandle(STD_OUTPUT_HANDLE);
+
+ if (CreateProcess (self_exe, cl, NULL, NULL, FALSE, 0, NULL, NULL, &start_info, &proc_info))
+ {
+ CloseHandle (proc_info.hThread);
+ CloseHandle (proc_info.hProcess);
+ }
+ else
+ {
+ msg (M_WARN|M_ERRNO, "fork_to_self: CreateProcess failed: %s", cmdline);
+ }
+
+ done:
+ free (cl);
+}
+
char *
get_win_sys_path (void)
{