diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-02-13 09:46:34 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-02-13 09:46:34 -0800 |
| commit | e4b6611201bb2f69c05a4c104c77d6ec51c2c38b (patch) | |
| tree | 5f33f80ebd2437df1e53664a4fe6b9380ed66692 /node/IncomingPacket.cpp | |
| parent | e6840a1863a2ed996d7fe66321d753e003d00375 (diff) | |
| download | infinitytier-e4b6611201bb2f69c05a4c104c77d6ec51c2c38b.tar.gz infinitytier-e4b6611201bb2f69c05a4c104c77d6ec51c2c38b.zip | |
Only accept world updates from upstreams.
Diffstat (limited to 'node/IncomingPacket.cpp')
| -rw-r--r-- | node/IncomingPacket.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 8836df9f..c6cf7f36 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -449,22 +449,26 @@ bool IncomingPacket::_doOK(const RuntimeEnvironment *RR,const SharedPtr<Peer> &p InetAddress externalSurfaceAddress; unsigned int ptr = ZT_PROTO_VERB_HELLO__OK__IDX_REVISION + 2; - // Get reported external surface address if present (was not on old versions) + // Get reported external surface address if present if (ptr < size()) ptr += externalSurfaceAddress.deserialize(*this,ptr); - // Handle planet or moon updates if present (older versions don't send this) + // Handle planet or moon updates if present if ((ptr + 2) <= size()) { const unsigned int worldLen = at<uint16_t>(ptr); ptr += 2; - const unsigned int endOfWorlds = ptr + worldLen; - while (ptr < endOfWorlds) { - World w; - ptr += w.deserialize(*this,ptr); - RR->topology->addWorld(w); + if (RR->topology->isUpstream(peer->identity())) { + const unsigned int endOfWorlds = ptr + worldLen; + while (ptr < endOfWorlds) { + World w; + ptr += w.deserialize(*this,ptr); + RR->topology->addWorld(w); + } + } else { + ptr += worldLen; } } - // Handle COR if present (older versions don't send this) + // Handle certificate of representation if present if ((ptr + 2) <= size()) { if (at<uint16_t>(ptr) > 0) { CertificateOfRepresentation cor; |
