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.
This commit is contained in:
parent
16df2c3363
commit
0d4109a9f1
13 changed files with 170 additions and 83 deletions
|
@ -734,13 +734,12 @@ unsigned long Switch::doTimerTasks(uint64_t now)
|
|||
|
||||
Address Switch::_sendWhoisRequest(const Address &addr,const Address *peersAlreadyConsulted,unsigned int numPeersAlreadyConsulted)
|
||||
{
|
||||
SharedPtr<Peer> root(RR->topology->getBestRoot(peersAlreadyConsulted,numPeersAlreadyConsulted,false));
|
||||
if (root) {
|
||||
Packet outp(root->address(),RR->identity.address(),Packet::VERB_WHOIS);
|
||||
SharedPtr<Peer> upstream(RR->topology->getBestRoot(peersAlreadyConsulted,numPeersAlreadyConsulted,false));
|
||||
if (upstream) {
|
||||
Packet outp(upstream->address(),RR->identity.address(),Packet::VERB_WHOIS);
|
||||
addr.appendTo(outp);
|
||||
outp.armor(root->key(),true);
|
||||
if (root->sendDirect(outp.data(),outp.size(),RR->node->now(),true))
|
||||
return root->address();
|
||||
RR->node->expectReplyTo(outp.packetId());
|
||||
send(outp,true);
|
||||
}
|
||||
return Address();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue