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

@ -177,12 +177,9 @@ bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,b
}
tmp->clear();
if (dnsCount > 0) {
tmp->append(dnsCount);
DNS::serializeDNS(*tmp, dns, dnsCount);
if (tmp->size()) {
if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_DNS,*tmp)) return false;
}
DNS::serializeDNS(*tmp, &dns);
if (tmp->size()) {
if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_DNS,*tmp)) return false;
}
delete tmp;
@ -366,9 +363,7 @@ bool NetworkConfig::fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACI
if (d.get(ZT_NETWORKCONFIG_DICT_KEY_DNS, *tmp)) {
unsigned int p = 0;
this->dnsCount = tmp->at<unsigned int>(p);
p += sizeof(unsigned int);
DNS::deserializeDNS(*tmp, p, dns, (this->dnsCount <= ZT_MAX_NETWORK_DNS) ? this->dnsCount : ZT_MAX_NETWORK_DNS);
DNS::deserializeDNS(*tmp, p, &dns);
}
}