mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Fix for GitHub issue #260 -- fix for (non-exploitable) crash in network preferred relay code
This commit is contained in:
parent
944fdfb65e
commit
ceaef19fb7
2 changed files with 6 additions and 5 deletions
|
@ -263,7 +263,6 @@ public:
|
||||||
return (l * (((unsigned int)tsr / (ZT_PEER_DIRECT_PING_DELAY + 1000)) + 1));
|
return (l * (((unsigned int)tsr / (ZT_PEER_DIRECT_PING_DELAY + 1000)) + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update latency with a new direct measurment
|
* Update latency with a new direct measurment
|
||||||
*
|
*
|
||||||
|
|
|
@ -820,10 +820,12 @@ bool Switch::_trySend(const Packet &packet,bool encrypt,uint64_t nwid)
|
||||||
for(std::vector< std::pair<Address,InetAddress> >::const_iterator r(nconf->relays().begin());r!=nconf->relays().end();++r) {
|
for(std::vector< std::pair<Address,InetAddress> >::const_iterator r(nconf->relays().begin());r!=nconf->relays().end();++r) {
|
||||||
if (r->first != peer->address()) {
|
if (r->first != peer->address()) {
|
||||||
SharedPtr<Peer> rp(RR->topology->getPeer(r->first));
|
SharedPtr<Peer> rp(RR->topology->getPeer(r->first));
|
||||||
const unsigned int q = rp->relayQuality(now);
|
if (rp) {
|
||||||
if ((rp)&&(q < bestq)) { // SUBTILE: < == don't use these if they are nil quality (unsigned int max), instead use a root
|
const unsigned int q = rp->relayQuality(now);
|
||||||
bestq = q;
|
if (q < bestq) { // SUBTILE: < == don't use these if they are nil quality (unsigned int max), instead use a root
|
||||||
rp.swap(relay);
|
bestq = q;
|
||||||
|
rp.swap(relay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue