diff options
author | James Yonan <james@openvpn.net> | 2010-07-16 18:01:11 +0000 |
---|---|---|
committer | James Yonan <james@openvpn.net> | 2010-07-16 18:01:11 +0000 |
commit | b90c6f17b476b0ef1bd831f4a475425c94ba237f (patch) | |
tree | ba7a9f24437743b1c07ba8d396e0fbafadcc0762 /tun.c | |
parent | Implemented multi-address DNS expansion on the network field of route (diff) | |
download | openvpn-b90c6f17b476b0ef1bd831f4a475425c94ba237f.tar.xz |
Added --register-dns option for Windows.
Fixed some issues on Windows with --log, subprocess creation
for command execution, and stdout/stderr redirection.
Version 2.1.1m.
git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@6304 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to '')
-rw-r--r-- | tun.c | 39 |
1 files changed, 38 insertions, 1 deletions
@@ -3383,6 +3383,28 @@ netsh_command (const struct argv *a, int n) } void +ipconfig_register_dns (const struct env_set *es) +{ + struct argv argv; + bool status; + const char err[] = "ERROR: Windows ipconfig command failed"; + + netcmd_semaphore_lock (); + argv_init (&argv); + argv_printf (&argv, "%s%sc /flushdns", + get_win_sys_path(), + WIN_IPCONFIG_PATH_SUFFIX); + status = openvpn_execve_check (&argv, es, 0, err); + argv_reset(&argv); + argv_printf (&argv, "%s%sc /registerdns", + get_win_sys_path(), + WIN_IPCONFIG_PATH_SUFFIX); + status = openvpn_execve_check (&argv, es, 0, err); + argv_reset(&argv); + netcmd_semaphore_release (); +} + +void ip_addr_string_to_array (in_addr_t *dest, int *dest_len, const IP_ADDR_STRING *src) { int i = 0; @@ -3817,7 +3839,7 @@ fork_dhcp_action (struct tuntap *tt) buf_printf (&cmd, " --dhcp-pre-release"); if (tt->options.dhcp_renew) buf_printf (&cmd, " --dhcp-renew"); - buf_printf (&cmd, " --dhcp-rr %u", (unsigned int)tt->adapter_index); + buf_printf (&cmd, " --dhcp-internal %u", (unsigned int)tt->adapter_index); fork_to_self (BSTR (&cmd)); gc_free (&gc); @@ -3825,6 +3847,21 @@ fork_dhcp_action (struct tuntap *tt) } void +fork_register_dns_action (struct tuntap *tt) +{ + if (tt && tt->options.register_dns) + { + struct gc_arena gc = gc_new (); + struct buffer cmd = alloc_buf_gc (256, &gc); + const int verb = 3; + + buf_printf (&cmd, "openvpn --verb %d --register-dns --rdns-internal", verb); + fork_to_self (BSTR (&cmd)); + gc_free (&gc); + } +} + +void open_tun (const char *dev, const char *dev_type, const char *dev_node, bool ipv6, struct tuntap *tt) { struct gc_arena gc = gc_new (); |