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/Network.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/Network.cpp')
| -rw-r--r-- | node/Network.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/node/Network.cpp b/node/Network.cpp index 2a5f213c..710e70dd 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -1054,6 +1054,7 @@ void Network::requestConfiguration() } else { outp.append((unsigned char)0,16); } + RR->node->expectReplyTo(outp.packetId()); outp.compress(); RR->sw->send(outp,true); @@ -1092,6 +1093,15 @@ bool Network::gate(const SharedPtr<Peer> &peer,const Packet::Verb verb,const uin return false; } +bool Network::recentlyAllowedOnNetwork(const SharedPtr<Peer> &peer) const +{ + Mutex::Lock _l(_lock); + const Membership *m = _memberships.get(peer->address()); + if (m) + return m->recentlyAllowedOnNetwork(_config); + return false; +} + void Network::clean() { const uint64_t now = RR->node->now(); |
