mirror of
https://github.com/OpenVPN/openvpn.git
synced 2024-09-20 03:52:28 +02:00
Do not restart dns client service as a part of --register-dns processing
As reported and discussed on Trac #775, restarting dns service has unwanted side effects when there are dependent services. And it appears unnecessary to restart this service to get DNS registered on Windows. Resolve by removing two actions from --register-dns: 'net stop dnscache' and 'net start dnscache' run through the service or directly. Trac: #775 Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <1480542696-7123-1-git-send-email-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13331.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
788e5e4a08
commit
fb56058a98
@ -251,6 +251,10 @@ User-visible Changes
|
||||
as the VPN server, are dropped. This could be disabled with
|
||||
--allow-recursive-routing option.
|
||||
|
||||
- on Windows, when the ``--register-dns`` option is set, OpenVPN no longer
|
||||
restarts the ``dnscache`` service - this had unwanted side effects, and
|
||||
seems to be no longer necessary with currently supported Windows versions.
|
||||
|
||||
Maintainer-visible changes
|
||||
--------------------------
|
||||
- OpenVPN no longer supports building with crypto support, but without TLS
|
||||
|
@ -5811,8 +5811,7 @@ above.
|
||||
.\"*********************************************************
|
||||
.TP
|
||||
.B \-\-register\-dns
|
||||
Run net stop dnscache, net start dnscache, ipconfig /flushdns
|
||||
and ipconfig /registerdns on connection initiation.
|
||||
Run ipconfig /flushdns and ipconfig /registerdns on connection initiation.
|
||||
This is known to kick Windows into
|
||||
recognizing pushed DNS servers.
|
||||
.\"*********************************************************
|
||||
|
@ -717,8 +717,8 @@ static const char usage_message[] =
|
||||
"--dhcp-pre-release : Ask Windows to release the previous TAP adapter lease on\n"
|
||||
" startup.\n"
|
||||
"--dhcp-release : Ask Windows to release the TAP adapter lease on shutdown.\n"
|
||||
"--register-dns : Run net stop dnscache, net start dnscache, ipconfig /flushdns\n"
|
||||
" and ipconfig /registerdns on connection initiation.\n"
|
||||
"--register-dns : Run ipconfig /flushdns and ipconfig /registerdns\n"
|
||||
" on connection initiation.\n"
|
||||
"--tap-sleep n : Sleep for n seconds after TAP adapter open before\n"
|
||||
" attempting to set adapter properties.\n"
|
||||
"--pause-exit : When run from a console window, pause before exiting.\n"
|
||||
|
@ -4597,23 +4597,9 @@ ipconfig_register_dns (const struct env_set *es)
|
||||
bool status;
|
||||
const char err[] = "ERROR: Windows ipconfig command failed";
|
||||
|
||||
msg (D_TUNTAP_INFO, "Start net commands...");
|
||||
msg (D_TUNTAP_INFO, "Start ipconfig commands for register-dns...");
|
||||
netcmd_semaphore_lock ();
|
||||
|
||||
argv_printf (&argv, "%s%sc stop dnscache",
|
||||
get_win_sys_path(),
|
||||
WIN_NET_PATH_SUFFIX);
|
||||
argv_msg (D_TUNTAP_INFO, &argv);
|
||||
status = openvpn_execve_check (&argv, es, 0, err);
|
||||
argv_reset(&argv);
|
||||
|
||||
argv_printf (&argv, "%s%sc start dnscache",
|
||||
get_win_sys_path(),
|
||||
WIN_NET_PATH_SUFFIX);
|
||||
argv_msg (D_TUNTAP_INFO, &argv);
|
||||
status = openvpn_execve_check (&argv, es, 0, err);
|
||||
argv_reset(&argv);
|
||||
|
||||
argv_printf (&argv, "%s%sc /flushdns",
|
||||
get_win_sys_path(),
|
||||
WIN_IPCONFIG_PATH_SUFFIX);
|
||||
@ -4629,7 +4615,7 @@ ipconfig_register_dns (const struct env_set *es)
|
||||
argv_reset(&argv);
|
||||
|
||||
netcmd_semaphore_release ();
|
||||
msg (D_TUNTAP_INFO, "End net commands...");
|
||||
msg (D_TUNTAP_INFO, "End ipconfig commands for register-dns...");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -899,8 +899,7 @@ RegisterDNS (LPVOID unused)
|
||||
WCHAR sys_path[MAX_PATH];
|
||||
DWORD timeout = RDNS_TIMEOUT * 1000; /* in milliseconds */
|
||||
|
||||
/* default paths of net and ipconfig commands */
|
||||
WCHAR net[MAX_PATH] = L"C:\\Windows\\system32\\net.exe";
|
||||
/* default path of ipconfig command */
|
||||
WCHAR ipcfg[MAX_PATH] = L"C:\\Windows\\system32\\ipconfig.exe";
|
||||
|
||||
struct
|
||||
@ -909,8 +908,6 @@ RegisterDNS (LPVOID unused)
|
||||
WCHAR *cmdline;
|
||||
DWORD timeout;
|
||||
} cmds [] = {
|
||||
{ net, L"net stop dnscache", timeout },
|
||||
{ net, L"net start dnscache", timeout },
|
||||
{ ipcfg, L"ipconfig /flushdns", timeout },
|
||||
{ ipcfg, L"ipconfig /registerdns", timeout },
|
||||
};
|
||||
@ -920,9 +917,6 @@ RegisterDNS (LPVOID unused)
|
||||
|
||||
if(GetSystemDirectory(sys_path, MAX_PATH))
|
||||
{
|
||||
_snwprintf (net, MAX_PATH, L"%s\\%s", sys_path, L"net.exe");
|
||||
net[MAX_PATH-1] = L'\0';
|
||||
|
||||
_snwprintf (ipcfg, MAX_PATH, L"%s\\%s", sys_path, L"ipconfig.exe");
|
||||
ipcfg[MAX_PATH-1] = L'\0';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user