From: "d12fk (Code Review)" Date: Tue, 9 Dec 2025 16:28:15 +0000 References: Reply-To: heiko@...515..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <4ededcf1060c43b62924c0edaa39444e7c861c70-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="UZAYdFVXSuo="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: iservice: set adapter DNS only with search domains List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --UZAYdFVXSuo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=3Demail to review the following change. Change subject: iservice: set adapter DNS only with search domains ...................................................................... iservice: set adapter DNS only with search domains With NRPT the adapter name server configuration is not needed theoretically. However DNS config is not showing with traditional tools like ipconfig if they are left out. More importantly if there are no DNS servers configured for an adapter the adapter specific search domains are not recognized by the Windows resolver. However, adding the servers to the adapter has the side effect, that general look-ups are now also done using this adapter, which might come as unexpected and yield wrong results, if there is some trickery happening with the default DNS, for example. As a workaround, set the adapter DNS only when strictly needed. Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980 Signed-off-by: Heiko Hund --- M src/openvpnserv/interactive.c 1 file changed, 12 insertions(+), 4 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/1429/1 diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 6f04f6b..9327dfa 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -2869,11 +2869,19 @@ goto out; } - /* Set name servers */ - err =3D SetNameServerAddresses(iid, msg->addresses); - if (err) + /* + * Set DNS on the adapter for search domains to be considered. + * If split DNS is configured, do this only when search domains + * are given, so that look-ups for other domains do not go over + * the VPN all the time. + */ + if (msg->search_domains[0] || !msg->resolve_domains[0]) { - goto out; + err =3D SetNameServerAddresses(iid, msg->addresses); + if (err) + { + goto out; + } } /* Set search domains, if any */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980 Gerrit-Change-Number: 1429 Gerrit-PatchSet: 1 Gerrit-Owner: d12fk Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --UZAYdFVXSuo= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

d12fk would like plaisthos to review this change.

V= iew Change

iservice: set adapter DNS only with search =
domains

With NRPT the adapter name server configuration is not neede= d
theoretically. However DNS config is not showing with traditional
t= ools like ipconfig if they are left out. More importantly if
there are n= o DNS servers configured for an adapter the adapter
specific search doma= ins are not recognized by the Windows resolver.

However, adding the = servers to the adapter has the side effect, that
general look-ups are no= w also done using this adapter, which might
come as unexpected and yield= wrong results, if there is some trickery
happening with the default DNS= , for example.

As a workaround, set the adapter DNS only when strict= ly needed.

Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980
S= igned-off-by: Heiko Hund <heiko@...2662...>
---
M src/openvpnse= rv/interactive.c
1 file changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/c=
hanges/29/1429/1
diff --git a/src/openvpnserv/interactive.c b/src/o=
penvpnserv/interactive.c
index 6f04f6b..9327dfa 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/o= penvpnserv/interactive.c
@@ -2869,11 +2869,19 @@
= goto out;
}
- /* Set name servers */
- err =3D SetNameServerA= ddresses(iid, msg->addresses);
- if (err)
+ /*
+ * S= et DNS on the adapter for search domains to be considered.
+ * If split DNS is configured, d= o this only when search domains
+ * are given, so that look-ups for other domains do not go = over
+ * the VPN = all the time.
+ *= /
+ if (msg->se= arch_domains[0] || !msg->resolve_domains[0])
{
- goto out;+ err =3D SetNameServe= rAddresses(iid, msg->addresses);
+ if (err)
+ {
+ }
}

= /* Set search domains, if any */

To v= iew, visit change 1429. To unsubscribe, or for help writing mail filters, visit= settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6debe8bbedd5a08da417bfee124= 3a43ef6df7980
Gerrit-Change-Number: 1429
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <heiko@...515...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --UZAYdFVXSuo=--