Change in openvpn[master]: iservice: set adapter DNS only with search domains
A message that is not in the archive (sent off-list or not yet received): gerrit.1765297693000.I6debe8bbedd5a08da417bfee1243a43ef6df7980@...2715...
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=email
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.
---
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
src/openvpnserv/interactive.c +12 -4
@@ -2869,11 +2869,19 @@ goto out; } -/* Set name servers */ - err =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 =SetNameServerAddresses (iid, msg->addresses); +if (err) + { + goto out; + } }/* Set search domains, if any */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980
Gerrit-Change-Number: 1429
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: d12fk, plaisthos.
selvanair has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email )
Change subject: iservice: set adapter DNS only with search domains
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
Lightly tested on Windows 10 -- does what it says and avoids dns query over VPN except for specified "resolve-domains".
With both search-domains and resolve-domains set, this is not ideal but there seems to be no easy way around it. In that case, the original intent of NRPT rule is preserved -- i.e not sending internal name queries to non-vpn interfaces which is good.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980
Gerrit-Change-Number: 1429
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Wed, 10 Dec 2025 01:41:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
PATCH 1/1 iservice: set adapter DNS only with search domains
In reply to a message not in the archiveFrom: Heiko Hund <[email protected]...>
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.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1429
---
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/+/1429
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Selva Nair <[email protected]...>
src/openvpnserv/interactive.c +12 -4
@@ -2869,11 +2869,19 @@ goto out; } -/* Set name servers */ - err =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 =SetNameServerAddresses (iid, msg->addresses); +if (err) + { + goto out; + } }/* Set search domains, if any */
[Openvpn-devel] [PATCH applied] Re: iservice: set adapter DNS only with search domains
So this is a workaround for windows DNS "search domain" and NRPT interfering in interesting ways - to make "search domain" work (aka "append these domains to unqualified hostnames") the search domain + DNS server need to be configured on the VPN interface. To make "resolve domain" work in non- surprising ways (aka "query that nameserver for these domains *and only* for these domains") the DNS server must not be added to the VPN interface...
In mobile environments with DNS64 and other surprises, querying "all DNS over the normal WAN, and only corp-internal resolve-domains via VPN" is the expected behaviour - so what we did so far (resolve-domains go to the VPN only, everything else *goes to all DNS servers*) was surprising, and breaks certain scenarios...
So this does
- if there is a search-domain
- or if there is *no* resolve-domain
- set the DNS on the adapter ("to be used by normal windows DNS processing")
what is not affected by the patch is what we already have
- if there is a resolve-domain, set up a NRTP rule ("for this domain, query these nameservers [only]")
More details in https://github.com/OpenVPN/openvpn/issues/473 ...
Thanks, Selva, for testing this so quickly :-) - I have only stared at the code, thought about the logic, and tried to make this explanatory e-mail as clear as possible.
Your patch has been applied to the master branch.
commit f7afbc511b9d30b27d0b6bbb3ee02dfb1abea646
Author: Heiko Hund Date: Wed Dec 10 08:29:44 2025 +0100
iservice: set adapter DNS only with search domains
Signed-off-by: Heiko Hund <[email protected]...>
Acked-by: Selva Nair <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1429
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34968.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by selvanair
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.
Github: OpenVPN/openvpn#473
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1429
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34968.html
---
M src/openvpnserv/interactive.c
1 file changed, 12 insertions(+), 4 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/29/1429/2
src/openvpnserv/interactive.c +12 -4
@@ -2869,11 +2869,19 @@ goto out; } -/* Set name servers */ - err =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 =SetNameServerAddresses (iid, msg->addresses); +if (err) + { + goto out; + } }/* Set search domains, if any */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980
Gerrit-Change-Number: 1429
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email )
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.
Github: OpenVPN/openvpn#473
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1429
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34968.html
---
M src/openvpnserv/interactive.c
1 file changed, 12 insertions(+), 4 deletions(-)
src/openvpnserv/interactive.c +12 -4
@@ -2869,11 +2869,19 @@ goto out; } -/* Set name servers */ - err =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 =SetNameServerAddresses (iid, msg->addresses); +if (err) + { + goto out; + } }/* Set search domains, if any */
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1429?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980
Gerrit-Change-Number: 1429
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: selvanair <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>