Browse code

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
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20170131112131.13570-1-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13994.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Antonio Quartulli authored on 2017/01/31 20:21:31
Showing 1 changed files
... ...
@@ -1196,6 +1196,15 @@ add_routes(struct route_list *rl, struct route_ipv6_list *rl6, const struct tunt
1196 1196
     if (rl6 && !(rl6->iflags & RL_ROUTES_ADDED) )
1197 1197
     {
1198 1198
         struct route_ipv6 *r;
1199
+
1200
+        if (!tt->did_ifconfig_ipv6_setup)
1201
+        {
1202
+            msg(M_INFO, "WARNING: OpenVPN was configured to add an IPv6 "
1203
+                "route over %s. However, no IPv6 has been configured for "
1204
+                "this interface, therefore the route installation may "
1205
+                "fail or may not work as expected.", tt->actual_name);
1206
+        }
1207
+
1199 1208
         for (r = rl6->routes_ipv6; r; r = r->next)
1200 1209
         {
1201 1210
             if (flags & ROUTE_DELETE_FIRST)
... ...
@@ -1882,14 +1891,6 @@ add_route_ipv6(struct route_ipv6 *r6, const struct tuntap *tt, unsigned int flag
1882 1882
     }
1883 1883
 #endif
1884 1884
 
1885
-    if (!tt->did_ifconfig_ipv6_setup)
1886
-    {
1887
-        msg( M_INFO, "add_route_ipv6(): not adding %s/%d: "
1888
-             "no IPv6 address been configured on interface %s",
1889
-             network, r6->netbits, device);
1890
-        return;
1891
-    }
1892
-
1893 1885
     msg( M_INFO, "add_route_ipv6(%s/%d -> %s metric %d) dev %s",
1894 1886
          network, r6->netbits, gateway, r6->metric, device );
1895 1887