#elif defined (WIN32)
+ struct buffer out = alloc_buf_gc (64, &gc);
if ( r6->adapter_index ) /* vpn server special route */
{
- struct buffer out = alloc_buf_gc (64, &gc);
buf_printf (&out, "interface=%d", r6->adapter_index );
- device = buf_bptr(&out);
gateway_needed = true;
}
+ else
+ {
+ buf_printf (&out, "interface=%d", tt->adapter_index );
+ }
+ device = buf_bptr(&out);
/* netsh interface ipv6 add route 2001:db8::/32 MyTunDevice */
argv_printf (&argv, "%s%sc interface ipv6 add route %s/%d %s",
#elif defined (WIN32)
+ struct buffer out = alloc_buf_gc (64, &gc);
if ( r6->adapter_index ) /* vpn server special route */
{
- struct buffer out = alloc_buf_gc (64, &gc);
buf_printf (&out, "interface=%d", r6->adapter_index );
- device = buf_bptr(&out);
gateway_needed = true;
}
+ else
+ {
+ buf_printf (&out, "interface=%d", tt->adapter_index );
+ }
+ device = buf_bptr(&out);
/* netsh interface ipv6 delete route 2001:db8::/32 MyTunDevice */
argv_printf (&argv, "%s%sc interface ipv6 delete route %s/%d %s",
{
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");
- openvpn_snprintf(iface, sizeof(iface), "interface=%lu", get_adapter_index_flexible(actual));
+ 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,
*/
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;
}