-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing out the suggestions in `https://github.com/OpenVPN/openvpn3-linux/issues/208`
- Loading branch information
Showing
5 changed files
with
164 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
diff --git a/openvpn/tun/client/tunprop.hpp b/openvpn/tun/client/tunprop.hpp | ||
index e830d9cd..0eeb7c1b 100644 | ||
--- a/openvpn/tun/client/tunprop.hpp | ||
+++ b/openvpn/tun/client/tunprop.hpp | ||
@@ -546,9 +546,8 @@ class TunProp | ||
DnsOptions dns_options(opt); | ||
for (const auto &domain : dns_options.search_domains) | ||
{ | ||
- if (!tb->tun_builder_set_adapter_domain_suffix(domain)) | ||
- throw tun_prop_dhcp_option_error("tun_builder_set_adapter_domain_suffix"); | ||
- break; // use only the first domain for now | ||
+ if (!tb->tun_builder_add_search_domain(domain)) | ||
+ throw tun_prop_dhcp_option_error("tun_builder_add_search_domain failed"); | ||
} | ||
for (const auto &keyval : dns_options.servers) | ||
{ | ||
@@ -565,11 +564,6 @@ class TunProp | ||
throw tun_prop_dhcp_option_error("tun_builder_add_dns_server failed"); | ||
flags |= F_ADD_DNS; | ||
} | ||
- for (const auto &domain : server.domains) | ||
- { | ||
- if (!tb->tun_builder_add_search_domain(domain)) | ||
- throw tun_prop_dhcp_option_error("tun_builder_add_search_domain failed"); | ||
- } | ||
} | ||
|
||
OptionList::IndexMap::const_iterator dopt = opt.map().find("dhcp-option"); // DIRECTIVE | ||
@@ -595,7 +589,7 @@ class TunProp | ||
throw tun_prop_dhcp_option_error("tun_builder_add_dns_server failed"); | ||
flags |= F_ADD_DNS; | ||
} | ||
- else if ((type == "DOMAIN" || type == "DOMAIN-SEARCH") && dns_options.servers.empty()) | ||
+ else if ((type == "DOMAIN" || type == "DOMAIN-SEARCH") && dns_options.search_domains.empty()) | ||
{ | ||
o.min_args(3); | ||
for (size_t j = 2; j < o.size(); ++j) | ||
@@ -609,7 +603,7 @@ class TunProp | ||
} | ||
} | ||
} | ||
- else if (type == "ADAPTER_DOMAIN_SUFFIX" && dns_options.search_domains.empty()) | ||
+ else if (type == "ADAPTER_DOMAIN_SUFFIX") | ||
{ | ||
o.exact_args(3); | ||
const std::string &adapter_domain_suffix = o.get(2, 256); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
diff --git a/src/netcfg/dns/resolver-settings.cpp b/src/netcfg/dns/resolver-settings.cpp | ||
index 4c1ee9c..26b784f 100644 | ||
--- a/src/netcfg/dns/resolver-settings.cpp | ||
+++ b/src/netcfg/dns/resolver-settings.cpp | ||
@@ -231,7 +231,7 @@ const std::string ResolverSettings::AddNameServers(GVariant *params) | ||
} | ||
|
||
|
||
-void ResolverSettings::AddSearchDomains(GVariant *params) | ||
+const std::string ResolverSettings::AddSearchDomains(GVariant *params) | ||
{ | ||
std::string params_type(g_variant_get_type_string(params)); | ||
if ("(as)" != params_type) | ||
@@ -247,6 +247,7 @@ void ResolverSettings::AddSearchDomains(GVariant *params) | ||
} | ||
|
||
GVariant *srchdom = nullptr; | ||
+ std::string ret; | ||
while ((srchdom = g_variant_iter_next_value(srchlist))) | ||
{ | ||
gsize len; | ||
@@ -260,10 +261,13 @@ void ResolverSettings::AddSearchDomains(GVariant *params) | ||
{ | ||
search_domains.push_back(v); | ||
} | ||
+ ret += (!ret.empty() ? ", " : "") + v; | ||
|
||
g_variant_unref(srchdom); | ||
} | ||
g_variant_iter_free(srchlist); | ||
+ | ||
+ return ret; | ||
} | ||
} // namespace DNS | ||
} // namespace NetCfg | ||
diff --git a/src/netcfg/dns/resolver-settings.hpp b/src/netcfg/dns/resolver-settings.hpp | ||
index 9fe76cc..d3910ea 100644 | ||
--- a/src/netcfg/dns/resolver-settings.hpp | ||
+++ b/src/netcfg/dns/resolver-settings.hpp | ||
@@ -302,8 +302,11 @@ class ResolverSettings | ||
* | ||
* @param params GVariant object containing an (as) based string | ||
* array of elements to process | ||
+ * | ||
+ * @returns Returns a std::string list of added DNS search domains, | ||
+ * comma separated | ||
*/ | ||
- void AddSearchDomains(GVariant *params); | ||
+ const std::string AddSearchDomains(GVariant *params); | ||
#endif | ||
|
||
|
||
diff --git a/src/netcfg/dns/systemd-resolved.cpp b/src/netcfg/dns/systemd-resolved.cpp | ||
index aeb2139..86982f9 100644 | ||
--- a/src/netcfg/dns/systemd-resolved.cpp | ||
+++ b/src/netcfg/dns/systemd-resolved.cpp | ||
@@ -116,6 +116,13 @@ void SystemdResolved::Commit(NetCfgSignals *signal) | ||
upd.link->SetDNSServers(upd.resolver); | ||
signal->LogVerb2("systemd-resolved: [" + upd.link->GetPath() | ||
+ "] Committing DNS search domains"); | ||
+ | ||
+ //<<< | ||
+ for (const auto &dom : upd.search) | ||
+ { | ||
+ signal->LogVerb2("systemd-resolved: dom.search: [" + dom.search + "]"); | ||
+ } | ||
+ //<<< | ||
upd.link->SetDomains(upd.search); | ||
upd.link->SetDefaultRoute(upd.default_routing); | ||
} | ||
diff --git a/src/netcfg/netcfg-device.hpp b/src/netcfg/netcfg-device.hpp | ||
index c119128..f31ed6a 100644 | ||
--- a/src/netcfg/netcfg-device.hpp | ||
+++ b/src/netcfg/netcfg-device.hpp | ||
@@ -411,7 +411,8 @@ class NetCfgDevice : public DBusObject, | ||
} | ||
|
||
// Adds DNS search domains | ||
- dnsconfig->AddSearchDomains(params); | ||
+ std::string added = dnsconfig->AddSearchDomains(params); | ||
+ signal.Debug(device_name, "Added DNS Search Domains: " + added); | ||
modified = true; | ||
} | ||
#ifdef ENABLE_OVPNDCO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters