]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
redirect-gateway: only redirect traffic through TUN if address families match
authorMarco Baffo <marco@mandelbit.com>
Sat, 11 Oct 2025 11:14:11 +0000 (13:14 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 11 Oct 2025 11:44:54 +0000 (13:44 +0200)
Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN
only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
Github: see also OpenVPN/openvpn#863

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Signed-off-by: mrbff <marco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
Message-Id: <20251011111417.11802-1-gert@greenie.muc.de>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245295/
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/init.c

index f8a0fee61fc61b63211a73f6651dacaa1ca9c5f8..aaa05737bb942af89084ae4e53ace8e246c153ad 100644 (file)
@@ -1523,7 +1523,7 @@ do_init_route_ipv6_list(const struct options *options, struct route_ipv6_list *r
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;