Browse code

Fix removal of on-link prefix on windows with netsh

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>

Gert Doering authored on 2018/02/21 01:00:16
Showing 3 changed files
... ...
@@ -1820,7 +1820,7 @@ done:
1820 1820
 }
1821 1821
 
1822 1822
 
1823
-static void
1823
+void
1824 1824
 route_ipv6_clear_host_bits( struct route_ipv6 *r6 )
1825 1825
 {
1826 1826
     /* clear host bit parts of route
... ...
@@ -254,6 +254,8 @@ void copy_route_ipv6_option_list(struct route_ipv6_option_list *dest,
254 254
                                  const struct route_ipv6_option_list *src,
255 255
                                  struct gc_arena *a);
256 256
 
257
+void route_ipv6_clear_host_bits( struct route_ipv6 *r6 );
258
+
257 259
 void add_route_ipv6(struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es);
258 260
 
259 261
 void delete_route_ipv6(const struct route_ipv6 *r, const struct tuntap *tt, unsigned int flags, const struct env_set *es);
... ...
@@ -839,6 +839,7 @@ delete_route_connected_v6_net(struct tuntap *tt,
839 839
     r6.gateway = tt->local_ipv6;
840 840
     r6.metric  = 0;                     /* connected route */
841 841
     r6.flags   = RT_DEFINED | RT_ADDED | RT_METRIC_DEFINED;
842
+    route_ipv6_clear_host_bits(&r6);
842 843
     delete_route_ipv6(&r6, tt, 0, es);
843 844
 }
844 845
 #endif /* if defined(_WIN32) || defined(TARGET_DARWIN) || defined(TARGET_NETBSD) || defined(TARGET_OPENBSD) */