]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix removal of on-link prefix on windows with netsh
authorGert Doering <gert@greenie.muc.de>
Tue, 20 Feb 2018 16:00:16 +0000 (17:00 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 22 Feb 2018 15:39:51 +0000 (16:39 +0100)
When adding / removing IPv6 routes, the host bits need to be zeroed or
netsh.exe will refuse to handle the route.

Commit a24dd2e31 changed the way this is done, breaking removal of
the on-link IPv6 prefix for windows + netsh.exe.

Fix by adding explicitly calling route_ipv6_clear_host_bits() from
delete_route_connected_v6_net().

Trac: #1003

Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Selva Nair <selva.nair@gmail.com>
Message-Id: <20180220160016.69786-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16508.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 2cea72005cb5a825c25494959d550ae16562676a)

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

index 6f1131c9c7e8b020e858bbafe7b26aef2ad03e5d..2d6428b231326f53c8691e8b5d56838597937052 100644 (file)
@@ -1820,7 +1820,7 @@ done:
 }
 
 
-static void
+void
 route_ipv6_clear_host_bits( struct route_ipv6 *r6 )
 {
     /* clear host bit parts of route
index 2c6f9f16d1bdbf210db7394b450f7e0751d849c3..69420228dc4e0473433715da6a2ed9e4cce39acb 100644 (file)
@@ -254,6 +254,8 @@ void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest,
                                  const struct route_ipv6_option_list *src,
                                  struct gc_arena *a);
 
+void route_ipv6_clear_host_bits( struct route_ipv6 *r6 );
+
 void add_route_ipv6(struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es);
 
 void delete_route_ipv6(const struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es);
index a022217c39de07f3e0c4a7320187ef4878eadb4a..b071823a163951127cf31eeb8a687f3f181680c0 100644 (file)
@@ -839,6 +839,7 @@ delete_route_connected_v6_net(struct tuntap *tt,
     r6.gateway = tt->local_ipv6;
     r6.metric  = 0;                     /* connected route */
     r6.flags   = RT_DEFINED | RT_ADDED | RT_METRIC_DEFINED;
+    route_ipv6_clear_host_bits(&r6);
     delete_route_ipv6(&r6, tt, 0, es);
 }
 #endif /* if defined(_WIN32) || defined(TARGET_DARWIN) || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD) */