Hi,

On Wed, Jun 20, 2018 at 11:53 AM, Gert Doering <g...@greenie.muc.de> wrote:
> Hi,
>
> On Wed, Jun 13, 2018 at 10:12:13PM +0800, Antonio Quartulli wrote:
>> From: Antonio Quartulli <anto...@openvpn.net>
>>
>> This patch ensures that the TAP driver on a windows host is still
>> configured, even though no IPv4 has been provided.
>>
>> In this case the TAP driver ioctl will be invoked with a fake
>> 0.0.0.0/0.0.0.0 IPv4 which will simply start the interface and
>> get it to a working state.
>>
>> Trac: #208
>> Signed-off-by: Antonio Quartulli <anto...@openvpn.net>
>
> Well...
>
>> @@ -2642,7 +2642,11 @@ test_routes(const struct route_list *rl, const struct 
>> tuntap *tt)
>>          ret = true;
>>          adapter_up = true;
>>
>> -        if (rl)
>> +        /* we do this test only if we have IPv4 routes to install, and if
>> +         * the tun/tap interface has seen IPv4 ifconfig - because if we
>> +         * have no IPv4, the check will always fail, failing tun init
>> +         */
>> +        if (rl && c->c1.tuntap->did_ifconfig_setup)
>
> This code is a bit optimstic :-) - there is no "c" here...

When did this change?  In a previous version this was done as

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 7d9a338..51e43c2 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);
     }

That said, moving this to route.c but corrected as in Gert's
attachment looks better.

Selva

------------------------------------------------------------------------------
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