path: root/src/openvpn/options.c
diff options
authorGert Doering <>2015-09-11 17:33:41 +0200
committerGert Doering <>2015-09-15 11:46:35 +0200
commitd8a8656f1a8721f56a08439afe24916beadfef55 (patch)
treee09cbf59cff743c9d87a5abfebd14bed728e221c /src/openvpn/options.c
parentc0da18cd7cca481fd918620331540e565f11ce23 (diff)
Create basic infrastructure for IPv6 default gateway handling / redirection.
- introduce get_default_gateway_ipv6() and add stub functions with the implementation plan to the 4 major code blocks here (Windows, Linux/Android, *BSD and Solaris, "others") - add &rgi6 to print_default_gateway(), and teach it to print v4, v6 or both, depending on the calling environment - unlike IPv4 (today), get_default_gateway_ipv6() is passed the actual target IPv6 address of the server we're looking for, so we can handle more complicated routing setups ("default to eth0, vpn server to ppp0") correctly - consequently, --show-gateway has an optional parameter now, the IPv6 address to look up (for debugging) - document --show-gateway and the extra option in openvpn.8 Acked-by: Arne Schwabe <> Message-Id: <> URL: Signed-off-by: Gert Doering <>
Diffstat (limited to 'src/openvpn/options.c')
1 files changed, 7 insertions, 2 deletions
diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index caf1394..93ea415 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -4156,12 +4156,17 @@ add_option (struct options *options,
read_config_file (options, p[1], level, file, line, msglevel, permission_mask, option_types_found, es);
#if defined(ENABLE_DEBUG) && !defined(ENABLE_SMALL)
- else if (streq (p[0], "show-gateway") && !p[1])
+ else if (streq (p[0], "show-gateway") && !p[2])
struct route_gateway_info rgi;
+ struct route_ipv6_gateway_info rgi6;
+ struct in6_addr remote = IN6ADDR_ANY_INIT;
+ if (p[1])
+ get_ipv6_addr (p[1], &remote, NULL, NULL, M_WARN);
- print_default_gateway(M_INFO, &rgi);
+ get_default_gateway_ipv6(&rgi6, &remote);
+ print_default_gateway(M_INFO, &rgi, &rgi6);
openvpn_exit (OPENVPN_EXIT_STATUS_GOOD); /* exit point */