Skip to content

Commit 2da11e9

Browse files
committed
dns option: handle allow_local_dns_resolvers
This flag was introduced to allow clients to decide if they want to ignore non-split DNS option pushed to them. So, to be compatible with the previous behavior with --dhcp-option, we act on the flag as wenn when there are no resolve-domains specified. Signed-off-by: Heiko Hund <[email protected]>
1 parent 57d79c2 commit 2da11e9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

openvpn/tun/win/client/tunsetup.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,12 @@ class Setup : public SetupBase
634634
{
635635
domains.push_back("." + dom.domain);
636636
}
637+
if (domains.empty() && allow_local_dns_resolvers)
638+
{
639+
// This empty domain tells the NRPT code that
640+
// no '.' rule should be created
641+
domains.push_back("");
642+
}
637643

638644
const bool dnssec = server.dnssec == DnsServer::Security::Yes;
639645

@@ -744,8 +750,11 @@ class Setup : public SetupBase
744750
}
745751
}
746752
}
747-
if (dsfx.empty() && !allow_local_dns_resolvers)
748-
dsfx.emplace_back(".");
753+
754+
// This empty domain tells the NRPT code that
755+
// no '.' rule should be created
756+
if (dsfx.empty() && allow_local_dns_resolvers)
757+
dsfx.emplace_back("");
749758

750759
// DNS server list
751760
std::vector<std::string> dserv;

openvpn/tun/win/nrpt.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ class Nrpt
424424
*/
425425
void execute(std::ostream &log) override
426426
{
427+
// Don't add anything if there is only one empty domain. This
428+
// is the way to tell us that no '.' rules should be added
429+
if (domains_.size() == 1 && domains_[0] == "")
430+
return;
431+
427432
// Convert domains into a wide MULTI_SZ string
428433
std::wstring domains;
429434
if (domains_.empty())

0 commit comments

Comments
 (0)