Tunnels: Avoid buggy routers

SSU: Don't bid on connection to buggy routers
This commit is contained in:
zzz
2022-02-03 10:36:03 -05:00
parent 73d90ed5c4
commit 568b5e303f
4 changed files with 28 additions and 4 deletions

View File

@@ -1,3 +1,7 @@
2022-02-03 zzz
* SSU: Don't bid on connection to buggy routers
* Tunnels: Avoid buggy routers
2022-01-30 zzz
* Reseed, DoH: Fixes for IPv6-only

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 10;
public final static long BUILD = 11;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -2039,13 +2039,20 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
}
// c++ bug thru 2.36.0/0.9.49, will disconnect inbound session after 5 seconds
if (addr.getCost() == 10) {
int cost = addr.getCost();
if (cost == 10) {
if (VersionComparator.comp(toAddress.getVersion(), "0.9.49") <= 0) {
//if (_log.shouldDebug())
// _log.debug("Not bidding to: " + toAddress);
markUnreachable(to);
return null;
}
} else if (cost == 9) {
// c++ bug in 2.40.0/0.9.52, drops SSU messages
if (toAddress.getVersion().equals("0.9.52")) {
markUnreachable(to);
return null;
}
}
// Check for supported sig type
@@ -2106,12 +2113,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
} else if (preferUDP()) {
return _cachedBid[SLOW_BID];
} else if (haveCapacity()) {
if (addr.getCost() > DEFAULT_COST)
if (cost > DEFAULT_COST)
return _cachedBid[SLOWEST_COST_BID];
else
return _cachedBid[SLOWEST_BID];
} else {
if (addr.getCost() > DEFAULT_COST)
if (cost > DEFAULT_COST)
return _cachedBid[NEAR_CAPACITY_COST_BID];
else
return _cachedBid[NEAR_CAPACITY_BID];

View File

@@ -11,6 +11,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
import net.i2p.CoreVersion;
import net.i2p.crypto.EncType;
import net.i2p.crypto.SHA256Generator;
import net.i2p.crypto.SigType;
@@ -19,6 +20,7 @@ import net.i2p.data.DataFormatException;
import net.i2p.data.DataHelper;
import net.i2p.data.Hash;
import net.i2p.data.SessionKey;
import net.i2p.data.router.RouterAddress;
import net.i2p.data.router.RouterIdentity;
import net.i2p.data.router.RouterInfo;
import net.i2p.router.LeaseSetKeys;
@@ -498,6 +500,17 @@ public abstract class TunnelPeerSelector extends ConnectChecker {
// minimum version check
String v = peer.getVersion();
if (v.equals("0.9.52")) {
// c++ bug in 2.40.0/0.9.52, drops SSU messages
for (RouterAddress addr : peer.getAddresses()) {
if (addr.getCost() == 9 && addr.getTransportStyle().equals("SSU"))
return true;
}
return false;
}
// quick check to skip the comparator
if (v.equals(CoreVersion.PUBLISHED_VERSION))
return false;
if (VersionComparator.comp(v, MIN_VERSION) < 0)
return true;