[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openvpn-devel
Subject:    Re: [Openvpn-devel] [PATCH] options.c: do not force route delay when not using DHCP
From:       Simon Rozman <simon () rozman ! si>
Date:       2020-01-16 13:19:47
Message-ID: 99D61A626FDA8A4B90A270669121BE10D064BDE6 () PLANJAVA ! amebis ! doma
[Download RAW message or body]

Code looks reasonable. Tested it.

Acked-by: Simon Rozman <simon@rozman.si>

Best regards,
Simon

> -----Original Message-----
> From: Lev Stipakov <lstipakov@gmail.com>
> Sent: Thursday, December 19, 2019 2:30 PM
> To: openvpn-devel@lists.sourceforge.net
> Cc: Lev Stipakov <lev@openvpn.net>
> Subject: [Openvpn-devel] [PATCH] options.c: do not force route delay
> when not using DHCP
> 
> From: Lev Stipakov <lev@openvpn.net>
> 
> Route delay may be only necessary when we perform DHCP handshake. When
> we use IPAPI / netsh / manual, no delay needed.
> 
> Signed-off-by: Lev Stipakov <lev@openvpn.net>
> ---
>  src/openvpn/options.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/src/openvpn/options.c b/src/openvpn/options.c index
> cebcbb07..a6f40e10 100644
> --- a/src/openvpn/options.c
> +++ b/src/openvpn/options.c
> @@ -3001,9 +3001,18 @@ options_postprocess_mutate_invariant(struct
> options *options)
>      }
> 
>  #ifdef _WIN32
> +    /* when using wintun, kernel doesn't send DHCP requests, so use
> netsh to set IP address and netmask */
> +    if (options->wintun)
> +    {
> +        options->tuntap_options.ip_win32_type = IPW32_SET_NETSH;
> +    }
> +
>      if ((dev == DEV_TYPE_TUN || dev == DEV_TYPE_TAP) && !options-
> >route_delay_defined)
>      {
> -        if (options->mode == MODE_POINT_TO_POINT)
> +        /* delay may only be necessary when we perform DHCP handshake
> */
> +        const bool dhcp = (options->tuntap_options.ip_win32_type ==
> IPW32_SET_DHCP_MASQ)
> +                          || (options->tuntap_options.ip_win32_type ==
> IPW32_SET_ADAPTIVE);
> +        if ((options->mode == MODE_POINT_TO_POINT) && dhcp)
>          {
>              options->route_delay_defined = true;
>              options->route_delay = 5; /* Vista sometimes has a race
> without this */ @@ -3016,14 +3025,8 @@
> options_postprocess_mutate_invariant(struct options *options)
>          options->ifconfig_noexec = false;
>      }
> 
> -    /* for wintun kernel doesn't send DHCP requests, so use netsh to
> set IP address and netmask */
> -    if (options->wintun)
> -    {
> -        options->tuntap_options.ip_win32_type = IPW32_SET_NETSH;
> -    }
> -
>      remap_redirect_gateway_flags(options);
> -#endif
> +#endif /* ifdef _WIN32 */
> 
>  #if P2MP_SERVER
>      /*
> --
> 2.17.1
> 
> 
> 
> _______________________________________________
> Openvpn-devel mailing list
> Openvpn-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openvpn-devel

["smime.p7s" (application/pkcs7-signature)]
[Attachment #4 (--===============9003907909583111223==)]


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic