diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-09 08:43:58 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-09 08:43:58 -0700 |
| commit | 0d4109a9f1f119e336d73039251ad17c0e2a56f4 (patch) | |
| tree | 7dbed18275342042878db41b7b7484bfb9afa5a1 /node/Peer.cpp | |
| parent | 16df2c33631eeb3e123fefa4febf20f202fd476b (diff) | |
| download | infinitytier-0d4109a9f1f119e336d73039251ad17c0e2a56f4.tar.gz infinitytier-0d4109a9f1f119e336d73039251ad17c0e2a56f4.zip | |
More refactoring to clean up code, and add a gate function to make sure we do not handle OK packets we did not expect. This hardens up a few potential edge cases around security, since such messages might be used to e.g. pollute a cache and DOS under certain conditions.
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index 58faab3b..a7a9fcc3 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -266,6 +266,7 @@ void Peer::sendHELLO(const InetAddress &localAddr,const InetAddress &atAddress,u atAddress.serialize(outp); outp.append((uint64_t)RR->topology->worldId()); outp.append((uint64_t)RR->topology->worldTimestamp()); + RR->node->expectReplyTo(outp.packetId()); outp.armor(_key,false); // HELLO is sent in the clear RR->node->putPacket(localAddr,atAddress,outp.data(),outp.size()); } @@ -274,6 +275,7 @@ void Peer::attemptToContactAt(const InetAddress &localAddr,const InetAddress &at { if ( (_vProto >= 5) && ( !((_vMajor == 1)&&(_vMinor == 1)&&(_vRevision == 0)) ) ) { Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO); + RR->node->expectReplyTo(outp.packetId()); outp.armor(_key,true); RR->node->putPacket(localAddr,atAddress,outp.data(),outp.size()); } else { |
