diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-23 13:46:36 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-08-23 13:46:36 -0700 |
| commit | 0a7a33ef8fb8cd3cdf25c48bd221298279e690c2 (patch) | |
| tree | 7ddf73a9efffa65aae8d72272326bc05a6c99352 /node/IncomingPacket.cpp | |
| parent | 32fa0617004e80c99b341eb1b4753705b515b53a (diff) | |
| download | infinitytier-0a7a33ef8fb8cd3cdf25c48bd221298279e690c2.tar.gz infinitytier-0a7a33ef8fb8cd3cdf25c48bd221298279e690c2.zip | |
Instantaneous blacklisting and credential revocation.
Diffstat (limited to 'node/IncomingPacket.cpp')
| -rw-r--r-- | node/IncomingPacket.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 139661db..0ecc68be 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -829,13 +829,22 @@ bool IncomingPacket::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *RR,cons bool IncomingPacket::_doNETWORK_CONFIG_REFRESH(const RuntimeEnvironment *RR,const SharedPtr<Peer> &peer) { try { - unsigned int p = ZT_PACKET_IDX_PAYLOAD; - while ((p + 8) <= size()) { - const uint64_t nwid = at<uint64_t>(p); p += 8; - if (Network::controllerFor(nwid) == peer->address()) { - SharedPtr<Network> network(RR->node->network(nwid)); - if (network) - network->requestConfiguration(); + const uint64_t nwid = at<uint64_t>(ZT_PACKET_IDX_PAYLOAD); + + if (Network::controllerFor(nwid) == peer->address()) { + SharedPtr<Network> network(RR->node->network(nwid)); + if (network) { + network->requestConfiguration(); + } else { + TRACE("dropped NETWORK_CONFIG_REFRESH from %s(%s): not a member of %.16llx",source().toString().c_str(),_remoteAddress.toString().c_str(),nwid); + return true; + } + + const unsigned int blacklistCount = at<uint16_t>(ZT_PACKET_IDX_PAYLOAD + 8); + unsigned int ptr = ZT_PACKET_IDX_PAYLOAD + 10; + for(unsigned int i=0;i<blacklistCount;++i) { + network->blacklistBefore(Address(field(ptr,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH),at<uint64_t>(ptr + 5)); + ptr += 13; } } } catch ( ... ) { |
