From: Antonio Quartulli <anto...@openvpn.net>

Signed-off-by: Antonio Quartulli <anto...@openvpn.net>
---
 src/openvpn/forward.c |  4 +++-
 src/openvpn/tun.c     | 24 +++++++++++++++++-------
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 7d9a338d..51e43c28 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -292,7 +292,9 @@ check_add_routes_action(struct context *c, const bool 
errors)
 void
 check_add_routes_dowork(struct context *c)
 {
-    if (test_routes(c->c1.route_list, c->c1.tuntap))
+    /* skip route check if no IPv4 was configured */
+    if (!c->c1.tuntap->did_ifconfig_setup
+        || test_routes(c->c1.route_list, c->c1.tuntap))
     {
         check_add_routes_action(c, false);
     }
diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index 8509d489..d183aea7 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -5718,7 +5718,10 @@ open_tun(const char *dev, const char *dev_type, const 
char *dev_node, struct tun
             msg(M_FATAL, "ERROR: --dev tun also requires --ifconfig");
         }
 
-        if (tt->topology == TOP_SUBNET)
+        /* send 0/0/0 to the TAP driver even if we have no IPv4 configured to
+         * ensure it is somehow initialized.
+         */
+        if (!tt->did_ifconfig_setup || tt->topology == TOP_SUBNET)
         {
             in_addr_t ep[3];
             BOOL status;
@@ -5731,12 +5734,19 @@ open_tun(const char *dev, const char *dev_type, const 
char *dev_node, struct tun
                                      ep, sizeof(ep),
                                      ep, sizeof(ep), &len, NULL);
 
-            msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet mode 
network/local/netmask = %s/%s/%s [%s]",
-                print_in_addr_t(ep[1], IA_NET_ORDER, &gc),
-                print_in_addr_t(ep[0], IA_NET_ORDER, &gc),
-                print_in_addr_t(ep[2], IA_NET_ORDER, &gc),
-                status ? "SUCCEEDED" : "FAILED");
-
+            if (tt->did_ifconfig_setup)
+            {
+                msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN subnet 
mode network/local/netmask = %s/%s/%s [%s]",
+                    print_in_addr_t(ep[1], IA_NET_ORDER, &gc),
+                    print_in_addr_t(ep[0], IA_NET_ORDER, &gc),
+                    print_in_addr_t(ep[2], IA_NET_ORDER, &gc),
+                    status ? "SUCCEEDED" : "FAILED");
+            }
+            else
+            {
+                msg(status ? M_INFO : M_FATAL, "Set TAP-Windows TUN with fake 
IPv4 [%s]",
+                    status ? "SUCCEEDED" : "FAILED");
+            }
         }
         else
         {
-- 
2.17.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to