]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
IPv6 address/route delete fix for Win8
authorGert Doering <gert@greenie.muc.de>
Sun, 13 Apr 2014 11:12:02 +0000 (13:12 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 13 Apr 2014 19:36:31 +0000 (21:36 +0200)
Use "store=active" for IPv6 address and route deletion - seems to be
required on Windows 8 and up, and not doing it will break OpenVPN
reconnection (old addresses are not properly deleted, thus address can
not be configured on connect).

Reported-by: Cedric <cedric+openvpn@bgtn.net>
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Cedric Tabary <cedric+openvpn@bgtn.net>
Message-Id: <20140413170648.GU16637@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8499
(cherry picked from commit 4b4fac9184fcea1eab4f4223309211780cee188a)

src/openvpn/route.c
src/openvpn/tun.c

index 6333ee78b33d26aa86987dad3f0dfece655a0e9e..f470f7ea40c23cdffc33aa4bf1856b383a5925eb 100644 (file)
@@ -1974,10 +1974,16 @@ delete_route_ipv6 (const struct route_ipv6 *r6, const struct tuntap *tt, unsigne
     argv_printf_cat (&argv, "METRIC %d", r->metric);
 #endif
 
+  /* Windows XP to 7 "just delete" routes, wherever they came from, but
+   * in Windows 8(.1?), if you create them with "store=active", this is
+   * how you should delete them as well (pointed out by Cedric Tabary)
+   */
+  argv_printf_cat( &argv, " store=active" );
+
   argv_msg (D_ROUTE, &argv);
 
   netcmd_semaphore_lock ();
-  openvpn_execve_check (&argv, es, 0, "ERROR: Windows route add ipv6 command failed");
+  openvpn_execve_check (&argv, es, 0, "ERROR: Windows route delete ipv6 command failed");
   netcmd_semaphore_release ();
 
 #elif defined (TARGET_SOLARIS)
index 976cc528a99ca80dff9f930fe38b8b189524083b..ba4b15e1ca6d825c93bc89604f15cf7675961303 100644 (file)
@@ -5196,10 +5196,14 @@ close_tun (struct tuntap *tt)
          /* remove route pointing to interface */
          delete_route_connected_v6_net(tt, NULL);
 
+         /* "store=active" is needed in Windows 8(.1) to delete the
+          * address we added (pointed out by Cedric Tabary).
+          */
+
          /* netsh interface ipv6 delete address \"%s\" %s */
          ifconfig_ipv6_local = print_in6_addr (tt->local_ipv6, 0,  &gc);
          argv_printf (&argv,
-                   "%s%sc interface ipv6 delete address %s %s",
+                   "%s%sc interface ipv6 delete address %s %s store=active",
                     get_win_sys_path(),
                     NETSH_PATH_SUFFIX,
                     tt->actual_name,