mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-05 20:41:44 -07:00
Pass 1 at adding DNS to controller
This commit is contained in:
parent
8eb453e042
commit
387039456d
5 changed files with 164 additions and 1 deletions
|
@ -176,6 +176,15 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
delete tmp;
|
||||
} catch ( ... ) {
|
||||
delete tmp;
|
||||
|
@ -354,6 +363,13 @@ bool NetworkConfig::fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACI
|
|||
unsigned int p = 0;
|
||||
Capability::deserializeRules(*tmp,p,this->rules,this->ruleCount,ZT_MAX_NETWORK_RULES);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//printf("~~~\n%s\n~~~\n",d.data());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue