summaryrefslogtreecommitdiff
path: root/src/openvpn/tun.c
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-01-20 12:01:07 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-01-20 12:01:07 +0100
commit19eab1fe2df20e38ea64d7a642d3e21c957082b8 (patch)
treefad602b603321d3e0e45807f8abb4f6c670a6cf2 /src/openvpn/tun.c
parent35807e5652390e8b2fd66b9051f3b41c9488302e (diff)
parent9653b1bffea4e96c1eb7c1814e8bed21fea62321 (diff)
Merge tag 'upstream/2.3.10'
Upstream version 2.3.10
Diffstat (limited to 'src/openvpn/tun.c')
-rw-r--r--src/openvpn/tun.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 3e20215..bb019c0 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -66,6 +66,8 @@ static void netsh_command (const struct argv *a, int n);
static const char *netsh_get_id (const char *dev_node, struct gc_arena *gc);
+static DWORD get_adapter_index_flexible (const char *name);
+
#endif
#ifdef TARGET_SOLARIS
@@ -633,7 +635,7 @@ void delete_route_connected_v6_net(struct tuntap * tt,
* is still point to point and no layer 2 resolution is done...
*/
-char *
+const char *
create_arbitrary_remote( struct tuntap *tt, struct gc_arena * gc )
{
in_addr_t remote;
@@ -642,7 +644,7 @@ create_arbitrary_remote( struct tuntap *tt, struct gc_arena * gc )
if ( remote == tt->local ) remote ++;
- return print_in_addr_t (remote, 0, &gc);
+ return print_in_addr_t (remote, 0, gc);
}
#endif
@@ -1228,18 +1230,22 @@ do_ifconfig (struct tuntap *tt,
if ( do_ipv6 )
{
char * saved_actual;
+ char iface[64];
+ DWORD idx;
if (!strcmp (actual, "NULL"))
msg (M_FATAL, "Error: When using --tun-ipv6, if you have more than one TAP-Windows adapter, you must also specify --dev-node");
- /* example: netsh interface ipv6 set address MyTap 2001:608:8003::d store=active */
+ idx = get_adapter_index_flexible(actual);
+ openvpn_snprintf(iface, sizeof(iface), "interface=%lu", idx);
+
+ /* example: netsh interface ipv6 set address interface=42 2001:608:8003::d store=active */
argv_printf (&argv,
- "%s%sc interface ipv6 set address %s %s store=active",
+ "%s%sc interface ipv6 set address %s %s store=active",
get_win_sys_path(),
NETSH_PATH_SUFFIX,
- actual,
- ifconfig_ipv6_local );
-
+ win32_version_info() == WIN_XP ? actual : iface,
+ ifconfig_ipv6_local);
netsh_command (&argv, 4);
/* explicit route needed */
@@ -1249,6 +1255,8 @@ do_ifconfig (struct tuntap *tt,
*/
saved_actual = tt->actual_name;
tt->actual_name = (char*) actual;
+ /* we use adapter_index in add_route_ipv6 */
+ tt->adapter_index = idx;
add_route_connected_v6_net(tt, es);
tt->actual_name = saved_actual;
}
@@ -2389,7 +2397,6 @@ close_tun (struct tuntap *tt)
}
else if (tt) /* close and destroy */
{
- struct gc_arena gc = gc_new ();
struct argv argv;
/* setup command, close tun dev (clears tt->actual_name!), run command