Skip to contentSkip to conversation

Do not set ipv6 address if '--ip-win32 manual' is used

PATCH In review Selva Nair 2 participants 4 messages Nov 20, 2016 – Nov 21, 2016

lore
Share & tools
lore

Selva Nair

author
#0 lore raw

PATCH 1/1 Do not set ipv6 address if '--ip-win32 manual' is used

This also applies to --ifconfig-noexec.

Resolves Trac #723

---
 src/openvpn/tun.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
src/openvpn/tun.c +11 -2
index 77ae72f..36e0b15 100644
@@ -1372,7 +1372,13 @@ do_ifconfig (struct tuntap *tt,
 
     if ( do_ipv6 )
       {
-	if (tt->options.msg_channel)
+	if (tt->options.ip_win32_type == IPW32_SET_MANUAL)
+	  {
+	    msg (M_INFO, "******** NOTE:  Please manually set the v6 IP of '%s' to %s (if it is not already set)",
+	         actual,
+	         ifconfig_ipv6_local);
+          }
+	else if (tt->options.msg_channel)
 	  {
 	    do_address_service (true, AF_INET6, tt);
 	  }
@@ -1391,7 +1397,10 @@ do_ifconfig (struct tuntap *tt,
 	  }
 
 	/* explicit route needed */
-	add_route_connected_v6_net(tt, es);
+	if (tt->options.ip_win32_type != IPW32_SET_MANUAL)
+	  {
+	    add_route_connected_v6_net(tt, es);
+	  }
       }
 #else
       msg (M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
Signature · 1 line
2.1.4
#1 lore raw

Hi,

Quoted 5 lines · Selva Nair

This also applies to --ifconfig-noexec.

Resolves Trac #723

The patch is fine code-wise, but I'm not sure if it is the best approach.

We have this funny bit of special-case code:

options.c, around line 2550

#ifdef _WIN32
...
if (options->ifconfig_noexec)

    {
      options->tuntap_options.ip_win32_type = IPW32_SET_MANUAL;
      options->ifconfig_noexec = false;
    }

#endif

I skimmed through init.c and tun.c / do_ifconfig(), and even though Heiko normalized the IFCONFIG_BEFORE_TUN_OPEN part, Windows is still not "normal" - part of the ifconfig is done in open_tun(), which is always called, but *only* if ip_win32 is not "IPW32_SET_MANUAL"...

So, I wonder if just removing the "options->ifconfig_noexec = false;" line from the code above would achieve the desired effect, with a smaller windows special case code base? It would still call open_tun(), which would not touch anything (because IPW32_SET_MANUAL) and then skip do_ifconfig() later on, so IPv6 would not happen.

Of course there is a slight asymmetry if someone insists on explicitely configuring "ip-win32 manual" - in that case, v4 would not happen and v6 would. This was partly intentional when doing the IPv6 stuff, as I consider the whole "ip-win32" nightmare to be not applicable to IPv6...

Please do not consider this a NAK, just a "what if..." thinking loud.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw
In reply to Selva Nair

ACK.

This solves the issue at hand for the time being, without breaking people's configs by removing "ip-win32 manual", and without changing expectations "how things work on Windows".

For 2.5, we should look at removing the "ip-win32 manual" code path (and maybe map it in the other direction, setting "--ifconfig_nexec" instead)

Your patch has been applied to the master branch.

(It does not apply cleanly to release/2.3 as the surrounding code is too different - the actual change is trivially adjusted, but I think it should see review - thus, not doing on-the-fly here)

commit d6ad8cac443f7f7540da595a3dbe7082d0f0a0cf (master)

Author: Selva Nair
Date:   Sun Nov 20 16:18:54 2016 -0500
     Do not set ipv6 address if '--ip-win32 manual' is used

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

--
kind regards,

Gert Doering

author
#3 lore raw
Quoted 9 lines · Gert Doering

This solves the issue at hand for the time being, without breaking people's configs by removing "ip-win32 manual", and without changing expectations "how things work on Windows".

For 2.5, we should look at removing the "ip-win32 manual" code path (and maybe map it in the other direction, setting "--ifconfig_nexec" instead)

Your patch has been applied to the master branch.

While this skips setting the ipv6 address when --ifconfig-noexec is in use, the code still tries to delete the ipv6 address and fails during SIGHUP restarts. Its a non-fatal failure, so ignore for now?

Selva