Message ID | 20231115120656.6825-1-gert@greenie.muc.de |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel,v1] Warn if pushed options require DHCP | expand |
The patch looks reasonable so far. Haven't tested it, just test compiled with GHA. Looking forward to the day we can get rid of --ip-win32, and simplify all these messages having '"%s ...", prefix' in them. I have taken the liberty of wrapping the open_tun() line - "80-110 chars" is our limit, not "155". Your patch has been applied to the master branch. commit 85fc834b0229b87e466b4f60bd2618b2ecd27a5f (master) commit 6127858f302785fa81cb9b943a71af972531070c (release/2.6) Author: Lev Stipakov Date: Wed Nov 15 13:06:56 2023 +0100 Warn if pushed options require DHCP Signed-off-by: Lev Stipakov <lev@openvpn.net> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Message-Id: <20231115120656.6825-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27403.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/options.c b/src/openvpn/options.c index abd2e0c..b34e2f6 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2477,10 +2477,10 @@ if (options->tuntap_options.dhcp_options & DHCP_OPTIONS_DHCP_REQUIRED) { - const char *prefix = "Some dhcp-options require DHCP server"; + const char *prefix = "Some --dhcp-option or --dns options require DHCP server"; if (options->windows_driver != WINDOWS_DRIVER_TAP_WINDOWS6) { - msg(M_USAGE, "%s, which is not supported by selected %s driver", + msg(M_USAGE, "%s, which is not supported by the selected %s driver", prefix, print_windows_driver(options->windows_driver)); } else if (options->tuntap_options.ip_win32_type != IPW32_SET_DHCP_MASQ diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index f857ed1..1b79d42 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -6826,6 +6826,13 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tuntap *tt, openvpn_net_ctx_t *ctx) { + if ((tt->options.dhcp_options & DHCP_OPTIONS_DHCP_REQUIRED) + && tt->windows_driver != WINDOWS_DRIVER_TAP_WINDOWS6) + { + msg(M_WARN, "Some --dhcp-option or --dns options require DHCP server, which is not supported by the selected %s driver. They will be ignored.", + print_windows_driver(tt->windows_driver)); + } + /* dco-win already opened the device, which handle we treat as socket */ if (tuntap_is_dco_win(tt)) {