소스 검색

Default to built-in root topology if signature check fails (instead of exiting)

Adam Ierymenko 11 년 전
부모
커밋
715afc0314
1개의 변경된 파일7개의 추가작업 그리고 3개의 파일을 삭제
  1. 7 3
      node/Node.cpp

+ 7 - 3
node/Node.cpp

@@ -552,9 +552,13 @@ Node::ReasonForTermination Node::run()
 			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");
-			_r->topology->setSupernodes(Dictionary(rt.get("supernodes")));
+			if (Topology::authenticateRootTopology(rt)) {
+				_r->topology->setSupernodes(Dictionary(rt.get("supernodes")));
+			} else {
+				LOG("%s failed signature check, using built-in defaults instead",rootTopologyPath.c_str());
+				Utils::rm(rootTopologyPath.c_str());
+				_r->topology->setSupernodes(Dictionary(Dictionary(ZT_DEFAULTS.defaultRootTopology).get("supernodes")));
+			}
 		} catch ( ... ) {
 			return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"invalid root-topology format");
 		}