mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Software update fix.
This commit is contained in:
parent
0f3148bda2
commit
d0224b3623
1 changed files with 36 additions and 34 deletions
|
@ -1148,6 +1148,7 @@ public:
|
||||||
settings["portMappingEnabled"] = false; // not supported in build
|
settings["portMappingEnabled"] = false; // not supported in build
|
||||||
#endif
|
#endif
|
||||||
settings["softwareUpdate"] = OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT);
|
settings["softwareUpdate"] = OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT);
|
||||||
|
settings["softwareUpdateChannel"] = OSUtils::jsonString(settings["softwareUpdateChannel"],ZT_SOFTWARE_UPDATE_DEFAULT_CHANNEL);
|
||||||
|
|
||||||
const World planet(_node->planet());
|
const World planet(_node->planet());
|
||||||
res["planetWorldId"] = planet.id();
|
res["planetWorldId"] = planet.id();
|
||||||
|
@ -1420,12 +1421,13 @@ public:
|
||||||
void applyLocalConfig()
|
void applyLocalConfig()
|
||||||
{
|
{
|
||||||
Mutex::Lock _l(_localConfig_m);
|
Mutex::Lock _l(_localConfig_m);
|
||||||
|
json lc(_localConfig);
|
||||||
|
|
||||||
_v4Hints.clear();
|
_v4Hints.clear();
|
||||||
_v6Hints.clear();
|
_v6Hints.clear();
|
||||||
_v4Blacklists.clear();
|
_v4Blacklists.clear();
|
||||||
_v6Blacklists.clear();
|
_v6Blacklists.clear();
|
||||||
json &virt = _localConfig["virtual"];
|
json &virt = lc["virtual"];
|
||||||
if (virt.is_object()) {
|
if (virt.is_object()) {
|
||||||
for(json::iterator v(virt.begin());v!=virt.end();++v) {
|
for(json::iterator v(virt.begin());v!=virt.end();++v) {
|
||||||
const std::string nstr = v.key();
|
const std::string nstr = v.key();
|
||||||
|
@ -1470,7 +1472,7 @@ public:
|
||||||
|
|
||||||
_globalV4Blacklist.clear();
|
_globalV4Blacklist.clear();
|
||||||
_globalV6Blacklist.clear();
|
_globalV6Blacklist.clear();
|
||||||
json &physical = _localConfig["physical"];
|
json &physical = lc["physical"];
|
||||||
if (physical.is_object()) {
|
if (physical.is_object()) {
|
||||||
for(json::iterator phy(physical.begin());phy!=physical.end();++phy) {
|
for(json::iterator phy(physical.begin());phy!=physical.end();++phy) {
|
||||||
const InetAddress net(OSUtils::jsonString(phy.key(),""));
|
const InetAddress net(OSUtils::jsonString(phy.key(),""));
|
||||||
|
@ -1489,41 +1491,41 @@ public:
|
||||||
|
|
||||||
_allowManagementFrom.clear();
|
_allowManagementFrom.clear();
|
||||||
_interfacePrefixBlacklist.clear();
|
_interfacePrefixBlacklist.clear();
|
||||||
json &settings = _localConfig["settings"];
|
|
||||||
if (settings.is_object()) {
|
|
||||||
_primaryPort = (unsigned int)OSUtils::jsonInt(settings["primaryPort"],(uint64_t)_primaryPort) & 0xffff;
|
|
||||||
_portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true);
|
|
||||||
|
|
||||||
const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT));
|
json &settings = lc["settings"];
|
||||||
const bool udist = OSUtils::jsonBool(settings["softwareUpdateDist"],false);
|
|
||||||
if (((up == "apply")||(up == "download"))||(udist)) {
|
_primaryPort = (unsigned int)OSUtils::jsonInt(settings["primaryPort"],(uint64_t)_primaryPort) & 0xffff;
|
||||||
if (!_updater)
|
_portMappingEnabled = OSUtils::jsonBool(settings["portMappingEnabled"],true);
|
||||||
_updater = new SoftwareUpdater(*_node,_homePath);
|
|
||||||
_updateAutoApply = (up == "apply");
|
const std::string up(OSUtils::jsonString(settings["softwareUpdate"],ZT_SOFTWARE_UPDATE_DEFAULT));
|
||||||
_updater->setUpdateDistribution(udist);
|
const bool udist = OSUtils::jsonBool(settings["softwareUpdateDist"],false);
|
||||||
_updater->setChannel(OSUtils::jsonString(settings["softwareUpdateChannel"],ZT_SOFTWARE_UPDATE_DEFAULT_CHANNEL));
|
if (((up == "apply")||(up == "download"))||(udist)) {
|
||||||
} else {
|
if (!_updater)
|
||||||
delete _updater;
|
_updater = new SoftwareUpdater(*_node,_homePath);
|
||||||
_updater = (SoftwareUpdater *)0;
|
_updateAutoApply = (up == "apply");
|
||||||
_updateAutoApply = false;
|
_updater->setUpdateDistribution(udist);
|
||||||
|
_updater->setChannel(OSUtils::jsonString(settings["softwareUpdateChannel"],ZT_SOFTWARE_UPDATE_DEFAULT_CHANNEL));
|
||||||
|
} else {
|
||||||
|
delete _updater;
|
||||||
|
_updater = (SoftwareUpdater *)0;
|
||||||
|
_updateAutoApply = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
json &ignoreIfs = settings["interfacePrefixBlacklist"];
|
||||||
|
if (ignoreIfs.is_array()) {
|
||||||
|
for(unsigned long i=0;i<ignoreIfs.size();++i) {
|
||||||
|
const std::string tmp(OSUtils::jsonString(ignoreIfs[i],""));
|
||||||
|
if (tmp.length() > 0)
|
||||||
|
_interfacePrefixBlacklist.push_back(tmp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
json &ignoreIfs = settings["interfacePrefixBlacklist"];
|
json &amf = settings["allowManagementFrom"];
|
||||||
if (ignoreIfs.is_array()) {
|
if (amf.is_array()) {
|
||||||
for(unsigned long i=0;i<ignoreIfs.size();++i) {
|
for(unsigned long i=0;i<amf.size();++i) {
|
||||||
const std::string tmp(OSUtils::jsonString(ignoreIfs[i],""));
|
const InetAddress nw(OSUtils::jsonString(amf[i],""));
|
||||||
if (tmp.length() > 0)
|
if (nw)
|
||||||
_interfacePrefixBlacklist.push_back(tmp);
|
_allowManagementFrom.push_back(nw);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
json &amf = settings["allowManagementFrom"];
|
|
||||||
if (amf.is_array()) {
|
|
||||||
for(unsigned long i=0;i<amf.size();++i) {
|
|
||||||
const InetAddress nw(OSUtils::jsonString(amf[i],""));
|
|
||||||
if (nw)
|
|
||||||
_allowManagementFrom.push_back(nw);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue