Allow --dhcp-option in config file when windows-driver is wintun
PATCH 1/1 Allow --dhcp-option in config file when windows-driver is wintun
From: Selva Nair <[email protected]...>
When wintun is in use we mutate ip_win32_type to NETSH and then complain that ip-win32 option should be dynamic or adaptive if any --dhcp-option directive is present in the config file. This causes a fatal error.
How to reproduce: specify a --dhcp-option in the config and change the --windows-driver to wintun.
Fix this behaviour. A typo in the message is also corrected.
--- src/openvpn/options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/options.c +2 -1
@@ -2181,10 +2181,11 @@ options_postprocess_verify_ce(const struct options *options, const struct connec }if (options->tuntap_options.dhcp_options + && options->windows_driver !=WINDOWS_DRIVER_WINTUN && options->tuntap_options.ip_win32_type !=IPW32_SET_DHCP_MASQ && options->tuntap_options.ip_win32_type !=IPW32_SET_ADAPTIVE ) { -msg (M_USAGE ,"--dhcp-options requires --ip-win32 dynamic or adaptive" ); +msg (M_USAGE ,"--dhcp-option requires --ip-win32 dynamic or adaptive" ); }if (options->windows_driver ==WINDOWS_DRIVER_WINTUN && dev !=DEV_TYPE_TUN )
Signature · 1 line
2.1.4
Hi,
src/openvpn/options.c options_postprocess_verify_ce(const struct options *options, const struct connec · line 2188
Quoted 2 lines
src/openvpn/options.c +1
-1-msg (M_USAGE ,"--dhcp-options requires --ip-win32 dynamic or adaptive" ); +msg (M_USAGE ,"--dhcp-option requires --ip-win32 dynamic or adaptive" );
Nice, this typo has been there since at least 2005.
It looks like that warning is not quite correct - for example, DNS can be set via iservice or netsh, which means that
--ip-win32 netsh
--dhcp-option DNS 8.8.8.8
is a valid combination regardless of driver type. On the other hand, NBDD/NTP are set via DHCP.
It would be good to make the warning condition more fine-grained, but this patch is good enough as it is, since it fixes important case - specify DNS in the ovpn profile when using wintun.
Built and tested with MSVC.
Your patch has been applied to the master and release/2.5 branch.
("Looks good to me" as well, Lev just beat me with testing and ACKing)
commit b8625abbd5be21a810b648058e6e411a7ff19702 (master) commit 9fe13491de31fff127bdceb6026fc05732f7dfb3 (release/2.5)
Author: Selva Nair Date: Mon Sep 14 19:29:41 2020 -0400
Allow --dhcp-option in config file when windows-driver is wintun
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Lev Stipakov <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg21005.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hi
Quoted 15 lines · Lev Stipakov
Hi,
Quoted 1 line
- msg(M_USAGE, "--dhcp-options requires --ip-win32 dynamic or
adaptive");
Quoted 1 line
+ msg(M_USAGE, "--dhcp-option requires --ip-win32 dynamic or
adaptive");
Nice, this typo has been there since at least 2005.
It looks like that warning is not quite correct - for example, DNS can be set via iservice or netsh, which means that
--ip-win32 netsh
--dhcp-option DNS 8.8.8.8
Quoted 7 lines
is a valid combination regardless of driver type. On the other hand, NBDD/NTP are set via DHCP.
It would be good to make the warning condition more fine-grained, but this patch is good enough as it is, since it fixes important case - specify DNS in the ovpn profile when using wintun.
We could deprecate --ip-win32 as a user option. Default to dynamic or adaptive, automatically fail-over to alternate methods or change it internally as required for wintun etc.
And work towards supporting more dhcp-options when dhcp is not possible -- using iservice, API, netsh etc.
Selva