]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Adds support for setting the default IPv6 gateway for routes using the route-ipv6...
authorJames Bekkema <james@sparklabs.com>
Mon, 23 Jul 2018 03:28:31 +0000 (13:28 +1000)
committerGert Doering <gert@greenie.muc.de>
Wed, 5 Dec 2018 21:26:50 +0000 (22:26 +0100)
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <777939F9-A753-4A66-B40E-1346AFD588DE@sparklabs.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17290.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
doc/openvpn.8
src/openvpn/init.c
src/openvpn/options.c
src/openvpn/options.h

index 4a7752feef1671393a0c373f52887970e1489447..07cf3113daec9ca25e95e1f1f104a6fc689f9b44 100644 (file)
@@ -6219,8 +6219,16 @@ into OpenVPN's ``tun''.  The gateway parameter is only used for
 IPv6 routes across ``tap'' devices, and if missing, the ``ipv6remote''
 field from
 .B \-\-ifconfig\-ipv6
+or
+.B \-\-route\-ipv6\-gateway
 is used.
 .TP
+.B \-\-route\-ipv6\-gateway gw
+Specify a default gateway
+.B gw
+for use with
+.B \-\-route\-ipv6.
+.TP
 .B \-\-server\-ipv6 ipv6addr/bits
 convenience\-function to enable a number of IPv6 related options at
 once, namely
index 2a1b38ead36051e5b0d717e884ca1ed266342a07..d24634cc9d55f0253fb934cfcbcebcada2039f63 100644 (file)
@@ -1466,12 +1466,10 @@ do_init_route_ipv6_list(const struct options *options,
     int metric = -1;            /* no metric set */
 
     gw = options->ifconfig_ipv6_remote;         /* default GW = remote end */
-#if 0                                   /* not yet done for IPv6 - TODO!*/
-    if (options->route_ipv6_default_gateway)            /* override? */
+    if (options->route_ipv6_default_gateway)
     {
         gw = options->route_ipv6_default_gateway;
     }
-#endif
 
     if (options->route_default_metric)
     {
index 38f668ff5aa7d64edb5af83b951bc214b3f92b96..26f056fcd5032f1fc633b588ce370bb380a1ad2f 100644 (file)
@@ -200,8 +200,10 @@ static const char usage_message[] =
     "--route-ipv6 network/bits [gateway] [metric] :\n"
     "                  Add IPv6 route to routing table after connection\n"
     "                  is established.  Multiple routes can be specified.\n"
-    "                  gateway default: taken from 'remote' in --ifconfig-ipv6\n"
+    "                  gateway default: taken from --route-ipv6-gateway or 'remote'\n"
+    "                  in --ifconfig-ipv6\n"
     "--route-gateway gw|'dhcp' : Specify a default gateway for use with --route.\n"
+    "--route-ipv6-gateway gw : Specify a default gateway for use with --route-ipv6.\n"
     "--route-metric m : Specify a default metric for use with --route.\n"
     "--route-delay n [w] : Delay n seconds after connection initiation before\n"
     "                  adding routes (may be 0).  If not specified, routes will\n"
@@ -6228,6 +6230,18 @@ add_option(struct options *options,
             }
         }
     }
+    else if (streq(p[0], "route-ipv6-gateway") && p[1] && !p[2])
+    {
+        if (ipv6_addr_safe(p[1]))
+        {
+            options->route_ipv6_default_gateway = p[1];
+        }
+        else
+        {
+            msg(msglevel, "route-ipv6-gateway parm '%s' must be a valid address", p[1]);
+            goto err;
+        }
+    }
     else if (streq(p[0], "route-metric") && p[1] && !p[2])
     {
         VERIFY_PERMISSION(OPT_P_ROUTE);
index 93df21b4b5be9f910b4f91672243e4bd2048d39b..e2b389399de162a774e06f357e0f87098c8c96ef 100644 (file)
@@ -343,6 +343,7 @@ struct options
     const char *route_script;
     const char *route_predown_script;
     const char *route_default_gateway;
+    const char *route_ipv6_default_gateway;
     int route_default_metric;
     bool route_noexec;
     int route_delay;