Skip to content

Commit f7afbc5

Browse files
d12fkcron2
authored andcommitted
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: #473 Change-Id: I6debe8bbedd5a08da417bfee1243a43ef6df7980 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]>
1 parent a0813a9 commit f7afbc5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/openvpnserv/interactive.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,11 +2869,19 @@ HandleDNSConfigNrptMessage(const nrpt_dns_cfg_message_t *msg, DWORD ovpn_pid, un
28692869
goto out;
28702870
}
28712871

2872-
/* Set name servers */
2873-
err = SetNameServerAddresses(iid, msg->addresses);
2874-
if (err)
2872+
/*
2873+
* Set DNS on the adapter for search domains to be considered.
2874+
* If split DNS is configured, do this only when search domains
2875+
* are given, so that look-ups for other domains do not go over
2876+
* the VPN all the time.
2877+
*/
2878+
if (msg->search_domains[0] || !msg->resolve_domains[0])
28752879
{
2876-
goto out;
2880+
err = SetNameServerAddresses(iid, msg->addresses);
2881+
if (err)
2882+
{
2883+
goto out;
2884+
}
28772885
}
28782886

28792887
/* Set search domains, if any */

0 commit comments

Comments
 (0)