[Openvpn-devel,v2] Fix --dns options for TAP adapter

Message ID 20250731104833.23305-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v2] Fix --dns options for TAP adapter | expand

Commit Message

Gert Doering July 31, 2025, 10:48 a.m. UTC
From: Lev Stipakov <lev@openvpn.net>

Commit

    2dfc4f ("dns: deal with --dhcp-options when --dns is active")

has accidentally removed setting of the DHCP_OPTIONS_DHCP_OPTIONAL
flag when copying --dns options. This flag is required to apply options
via DHCP string, which we do for TAP adapter. As a result, --dns options
stopped working for TAP.

Fix by setting this flag when copying --dns options to tuntap_options.

Change-Id: Id95cd14095a03afb3140a03ae96e9f5679e4fe89
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1120
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>

Comments

Gert Doering July 31, 2025, 10:55 a.m. UTC | #1
I have stared at the code, and together with the findings from the
previous commit (040e0d1c) this very much looks like the right fix.

I haven't tested it myself, just let the BBs compile-test on all
platforms (especially win32 <-> android, given the #ifdefs in the
neighbourhood)

Your patch has been applied to the master branch.

commit 264fe91660fb1a7a426161a9a042ed3f9bd0a7a6
Author: Lev Stipakov
Date:   Thu Jul 31 12:48:27 2025 +0200

     Fix --dns options for TAP adapter

     Signed-off-by: Lev Stipakov <lev@openvpn.net>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20250731104833.23305-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32436.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 53be6f5..3753810 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -3579,6 +3579,7 @@ 
             {
                 msg(M_WARN, "WARNING: couldn't copy all --dns server addresses to TUN/TAP");
             }
+            tt->dhcp_options |= DHCP_OPTIONS_DHCP_OPTIONAL;
             return;
         }
     }