summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-14 19:52:22 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-08-14 19:52:22 -0400
commitc2187c87599c60b9c47dd9d01244ce1ffd105fea (patch)
tree061667e920472a08f073ab2beb89456c05851cc5 /node/Node.cpp
parent56296f96db2ebecc69214de6ef0ca47d7aa77c6e (diff)
downloadinfinitytier-c2187c87599c60b9c47dd9d01244ce1ffd105fea.tar.gz
infinitytier-c2187c87599c60b9c47dd9d01244ce1ffd105fea.zip
(1) distribute default root-topology in new dictionary format, (2) bump peer serialization version to force obsolescence of old supernodes, (3) stop outputting a log message every time we poll for software updates
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 7500e736..e031dbdb 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -466,7 +466,6 @@ Node::ReasonForTermination Node::run()
#endif
}
- // Load or generate config authentication secret
std::string configAuthTokenPath(_r->homePath + ZT_PATH_SEPARATOR_S + "authtoken.secret");
std::string configAuthToken;
if (!Utils::readFile(configAuthTokenPath.c_str(),configAuthToken)) {
@@ -501,8 +500,19 @@ Node::ReasonForTermination Node::run()
}
#endif
- // Set initial supernode list
- _r->topology->setSupernodes(ZT_DEFAULTS.supernodes);
+ std::string rootTopologyPath(_r->homePath + ZT_PATH_SEPARATOR_S + "root-topology");
+ std::string rootTopology;
+ if (!Utils::readFile(rootTopologyPath.c_str(),rootTopology))
+ rootTopology = ZT_DEFAULTS.defaultRootTopology;
+ try {
+ Dictionary rt(rootTopology);
+ if (!Topology::authenticateRootTopology(rt))
+ return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"root-topology failed signature verification check");
+ Dictionary supernodes(rt.get("supernodes"));
+ _r->topology->setSupernodes(supernodes);
+ } catch ( ... ) {
+ return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"invalid root-topology format");
+ }
} catch (std::bad_alloc &exc) {
return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"memory allocation failure");
} catch (std::runtime_error &exc) {