Skip to contentSkip to conversation

attempt to add IPv6 route even when no IPv6 address was configured

PATCH In review Antonio Quartulli 2 participants 2 messages Jan 31, 2017 – Feb 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 attempt to add IPv6 route even when no IPv6 address was configured

Even if no IPv6 address is configured, OpenVPN still supports transporting IPv6 segments, therefore adding an IPv6 route should always be allowed.

However, the route might fail to be installed or may just not work as expected, therefore, a proper warning should be printed to inform the user of the possible pitfall.

Always allow adding an IPv6 route and print a WARNING when no IPv6 address is configured for the interface.

Trac: #832

---
 src/openvpn/route.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
src/openvpn/route.c +9 -8
index 223cb5f4..0145db3c 100644
@@ -1196,6 +1196,15 @@ add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tunt
     if (rl6 && !(rl6->iflags & RL_ROUTES_ADDED) )
     {
         struct route_ipv6 *r;
+
+        if (!tt->did_ifconfig_ipv6_setup)
+        {
+            msg(M_INFO, "WARNING: OpenVPN was configured to add an IPv6 "
+                "route over %s. However, no IPv6 has been configured for "
+                "this interface, therefore the route installation may "
+                "fail or may not work as expected.", tt->actual_name);
+        }
+
         for (r = rl6->routes_ipv6; r; r = r->next)
         {
             if (flags & ROUTE_DELETE_FIRST)
@@ -1882,14 +1891,6 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, unsigned int flag
     }
 #endif
 
-    if (!tt->did_ifconfig_ipv6_setup)
-    {
-        msg( M_INFO, "add_route_ipv6(): not adding %s/%d: "
-             "no IPv6 address been configured on interface %s",
-             network, r6->netbits, device);
-        return;
-    }
-
     msg( M_INFO, "add_route_ipv6(%s/%d -> %s metric %d) dev %s",
          network, r6->netbits, gateway, r6->metric, device );
 
Signature · 1 line
2.11.0
#1 lore raw

ACK. What we had was too strict in some cases, breaking people's configs - with this change, we give users enough rope to hang themselves if they insist to do so, but point out in the log file that this might be a stupid idea...

(That this came up in the first place is a consequence of commit 86e2fa5597fd1ad8e, 2.3 "supported" this mode of operation "fine")

Tested on linux - and it does the right motions. Whether or not "route6 without ifconfig6" does the right thing on platform <x> is not something we guarantee or promise :-)

Your patch has been applied to the master and release/2.4 branch.

commit 2b7650e7ec9241745e4f66c932d6cffaece927d7 (master) commit c74d574417b8b491fe6ad44e89843af8479cc9be (release/2.4)

Author: Antonio Quartulli
Date:   Tue Jan 31 19:21:31 2017 +0800
     attempt to add IPv6 route even when no IPv6 address was configured

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg13994.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering