options.c: do not force route delay when not using DHCP
PATCH 1/1 options.c: do not force route delay when not using DHCP
From: Lev Stipakov <[email protected]...>
Route delay may be only necessary when we perform DHCP handshake. When we use IPAPI / netsh / manual, no delay needed.
--- src/openvpn/options.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
src/openvpn/options.c +11 -8
@@ -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 /*
Signature · 1 line
2.17.1
Code looks reasonable. Tested it.
Best regards,
Simon
Quoted 75 lines
-----Original Message-----
From: Lev Stipakov <[email protected]...>
Sent: Thursday, December 19, 2019 2:30 PM
To: [email protected]
Cc: Lev Stipakov <[email protected]...>
Subject: [Openvpn-devel] [PATCH]options.c: do not force route delay when not using DHCPFrom: Lev Stipakov <[email protected]...>
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 <[email protected]...>--- src/openvpn/options.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)src/openvpn/options.c index renamed from src/openvpn/options.c +0
-0
cebcbb07..a6f40e10100644src/openvpn/options.c +1
-0@@ -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 */
src/openvpn/options.c +5
-0+if (options->wintun) + { + options->tuntap_options.ip_win32_type =IPW32_SET_NETSH ; + } + if ((dev == DEV_TYPE_TUN || dev == DEV_TYPE_TAP) && !options-Quoted 1 line
route_delay_defined){src/openvpn/options.c +1
-1-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 */src/openvpn/options.c +1
-7-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
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Your patch has been applied to the master branch.
(Stared a bit at the code, sounds reasonable, no testing whatsoever)
commit dd4647acf40b26bb8d7403debc00a342c663d618
Author: Lev Stipakov Date: Thu Dec 19 15:29:53 2019 +0200
options.c: do not force route delay when not using DHCP
Signed-off-by: Lev Stipakov <[email protected]...>
Acked-By: Simon Rozman <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg19257.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering