[Openvpn-devel,v2,7/8] route: warn on IPv4 routes installation when no IPv4 is configured

Message ID 20180608052017.6696-8-a@unstable.cc
State New
Delegated to: Gert Doering
Headers show
Series
  • Allow IPv6-only tunnels
Related show

Commit Message

Antonio Quartulli June 8, 2018, 5:20 a.m.
From: Antonio Quartulli <antonio@openvpn.net>

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
---
 src/openvpn/route.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/src/openvpn/route.c b/src/openvpn/route.c
index 8990a986..64fd08c0 100644
--- a/src/openvpn/route.c
+++ b/src/openvpn/route.c
@@ -981,7 +981,7 @@  del_bypass_routes(struct route_bypass *rb,
 static void
 redirect_default_route_to_vpn(struct route_list *rl, const struct tuntap *tt, unsigned int flags, const struct env_set *es)
 {
-    const char err[] = "NOTE: unable to redirect default gateway --";
+    const char err[] = "NOTE: unable to redirect IPv4 default gateway --";
 
     if (rl && rl->flags & RG_ENABLE)
     {
@@ -1171,6 +1171,14 @@  add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tunt
     {
         struct route_ipv4 *r;
 
+        if (rl->routes && !tt->did_ifconfig_setup)
+        {
+            msg(M_INFO, "WARNING: OpenVPN was configured to add an IPv4 "
+                "route over %s. However, no IPv4 has been configured for "
+                "this interface, therefore the route installation may "
+                "fail or may not work as expected.", tt->actual_name);
+        }
+
 #ifdef ENABLE_MANAGEMENT
         if (management && rl->routes)
         {