single dns config per network

This commit is contained in:
Grant Limberg 2020-08-12 13:08:47 -07:00
parent 058d888311
commit c0c215c83c
No known key found for this signature in database
GPG key ID: 2BA62CCABBB4095A
9 changed files with 76 additions and 147 deletions

View file

@ -1711,25 +1711,18 @@ void EmbeddedNetworkController::_request(
}
}
if(dns.is_array()) {
nc->dnsCount = 0;
for(unsigned int p=0; p < dns.size(); ++p) {
json &d = dns[p];
if (d.is_object()) {
std::string domain = OSUtils::jsonString(d["domain"],"");
memcpy(nc->dns[nc->dnsCount].domain, domain.c_str(), domain.size());
json &addrArray = d["servers"];
if (addrArray.is_array()) {
for(unsigned int j = 0; j < addrArray.size() && j < ZT_MAX_DNS_SERVERS; ++j) {
json &addr = addrArray[j];
nc->dns[nc->dnsCount].server_addr[j] = InetAddress(OSUtils::jsonString(addr,"").c_str());
}
}
++nc->dnsCount;
if(dns.is_object()) {
std::string domain = OSUtils::jsonString(dns["domain"],"");
memcpy(nc->dns.domain, domain.c_str(), domain.size());
json &addrArray = dns["servers"];
if (addrArray.is_array()) {
for(unsigned int j = 0; j < addrArray.size() && j < ZT_MAX_DNS_SERVERS; ++j) {
json &addr = addrArray[j];
nc->dns.server_addr[j] = InetAddress(OSUtils::jsonString(addr,"").c_str());
}
}
} else {
dns = json::array();
dns = json::object();
}
// Issue a certificate of ownership for all static IPs