]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Warn if pushed options require DHCP
authorLev Stipakov <lev@openvpn.net>
Wed, 15 Nov 2023 12:06:56 +0000 (13:06 +0100)
committerGert Doering <gert@greenie.muc.de>
Wed, 15 Nov 2023 14:50:28 +0000 (15:50 +0100)
Some pushed options (such as DOMAIN-SEARCH) require DHCP server to work.

Warn user that such options will not work if the current driver (such
as dco-win) doesn't support DHCP.

Change-Id: Ie512544329a91fae15409cb18f29d8be617051a1
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>
src/openvpn/options.c
src/openvpn/tun.c

index bd731ffc6e85af01d395f15952ac94e606d96627..2594b665e59221cfbd6bc3af9cd0adadaec18724 100644 (file)
@@ -2476,10 +2476,10 @@ options_postprocess_verify_ce(const struct options *options,
 
     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
index f857ed18a13a2edc829ce5a6a9cf08cb70b16019..82ab6c05766f94993fa4b934fdd6c3be4dd5db24 100644 (file)
@@ -6826,6 +6826,14 @@ void
 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))
     {