From: Gert Doering Date: Sun, 28 Feb 2010 21:50:41 +0000 (+0100) Subject: add IPv6 route add / route delete code for windows (using "netsh") X-Git-Tag: v2.3-alpha1~239^2~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6607def82270d0c31900736912e12dfec7a025b4;p=thirdparty%2Fopenvpn.git add IPv6 route add / route delete code for windows (using "netsh") - somewhat preliminary, as the next-hop setting requirements of tun/tap driver are not decided yet, and "route add" might need to be adapted --- diff --git a/route.c b/route.c index 4b8e5e421..1604e9eb5 100644 --- a/route.c +++ b/route.c @@ -1340,7 +1340,24 @@ add_route_ipv6 (struct route_ipv6 *r6, const struct tuntap *tt, unsigned int fla #elif defined (WIN32) - msg( M_FATAL, "no idea how to set IPv6 routes on windows (unimplemented)" ); + /* netsh interface ipv6 add route 2001:db8::/32 MyTunDevice */ + argv_printf (&argv, "%s%sc interface ipv6 add route %s/%d %s", + get_win_sys_path(), + NETSH_PATH_SUFFIX, + network, + r6->netbits, + device); + +#if 0 + if (r->metric_defined) + argv_printf_cat (&argv, "METRIC %d", r->metric); +#endif + + argv_msg (D_ROUTE, &argv); + + netcmd_semaphore_lock (); + status = openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add ipv6 command failed"); + netcmd_semaphore_release (); #elif defined (TARGET_SOLARIS) @@ -1586,7 +1603,24 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne #elif defined (WIN32) - msg( M_FATAL, "no idea how to delete IPv6 routes on windows (unimplemented)" ); + /* netsh interface ipv6 delete route 2001:db8::/32 MyTunDevice */ + argv_printf (&argv, "%s%sc interface ipv6 delete route %s/%d %s", + get_win_sys_path(), + NETSH_PATH_SUFFIX, + network, + r6->netbits, + device); + +#if 0 + if (r->metric_defined) + argv_printf_cat (&argv, "METRIC %d", r->metric); +#endif + + argv_msg (D_ROUTE, &argv); + + netcmd_semaphore_lock (); + openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add ipv6 command failed"); + netcmd_semaphore_release (); #elif defined (TARGET_SOLARIS)