forked from I2P_Developers/i2p.i2p
SSU2: Relay WIP part 12
Don't send SSU1 relay request to SSU2-connected introducers and vice versa Log tweaks
This commit is contained in:
16
history.txt
16
history.txt
@@ -1,5 +1,21 @@
|
||||
2022-06-11 zzz
|
||||
* SSU: Don't send SSU1 relay request to SSU2 peer
|
||||
|
||||
2022-06-10 zzz
|
||||
* SSU: Fix for HMAC NPE take 2
|
||||
* SSU2: Continue work on relay
|
||||
|
||||
2022-06-08 zzz
|
||||
* NetDb: Bypass checks on lookups of our router hash
|
||||
* SSU: Request RI from introducers if missing
|
||||
* SSU2: Set timer to remove peer test state
|
||||
|
||||
2022-06-07 zzz
|
||||
* SSU: Ban IP on bad handshake signature
|
||||
* SSU2: Peer test fixes
|
||||
* Transport:
|
||||
- Don't requeue message after multiple failures
|
||||
- Don't remove from netdb after a failure
|
||||
|
||||
2022-06-06 zzz
|
||||
* Console: Add deadlock detector
|
||||
|
||||
@@ -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 = 4;
|
||||
public final static long BUILD = 5;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
||||
@@ -1330,6 +1330,7 @@ class EstablishmentManager {
|
||||
long exp = addr.getIntroducerExpiration(i);
|
||||
if (h != null && (exp > now || exp == 0)) {
|
||||
PeerState bob = _transport.getPeerState(h);
|
||||
// TODO cross-version relaying, maybe
|
||||
if (bob != null && bob.getVersion() == 2) {
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Found connected introducer " + bob + " for " + state);
|
||||
@@ -1348,6 +1349,13 @@ class EstablishmentManager {
|
||||
if (h != null && (exp > now || exp == 0)) {
|
||||
if (_context.banlist().isBanlisted(h))
|
||||
continue;
|
||||
PeerState bobState = _transport.getPeerState(h);
|
||||
if (bobState != null) {
|
||||
// presumably SSU1 or we would have used it above
|
||||
if (_log.shouldDebug())
|
||||
_log.debug("Skipping SSU1-connected introducer " + bobState + " for " + state);
|
||||
continue;
|
||||
}
|
||||
RouterInfo bob = _context.netDb().lookupRouterInfoLocally(h);
|
||||
if (bob != null) {
|
||||
List<RouterAddress> addrs = _transport.getTargetAddresses(bob);
|
||||
|
||||
@@ -642,7 +642,7 @@ class OutboundEstablishState {
|
||||
_requestSentCount++;
|
||||
_nextSend = _lastSend + delay;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Send a request packet, nextSend in " + delay);
|
||||
_log.debug("Send a request packet, nextSend in " + delay + " on " + this);
|
||||
if (_currentState == OutboundState.OB_STATE_UNKNOWN ||
|
||||
_currentState == OutboundState.OB_STATE_INTRODUCED)
|
||||
_currentState = OutboundState.OB_STATE_REQUEST_SENT;
|
||||
|
||||
@@ -1296,6 +1296,13 @@ class PacketBuilder {
|
||||
bobState = transport.getPeerState(rhid);
|
||||
}
|
||||
if (bobState != null) {
|
||||
if (bobState.getVersion() > 1) {
|
||||
// TODO cross-version relaying, maybe
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Cannot build SSU1 relay request for " + state.getRemoteIdentity().calculateHash()
|
||||
+ " through SSU2-connected introducer " + bobState);
|
||||
continue;
|
||||
}
|
||||
// established session (since 0.9.12)
|
||||
cipherKey = bobState.getCurrentCipherKey();
|
||||
macKey = bobState.getCurrentMACKey();
|
||||
|
||||
@@ -471,8 +471,8 @@ class PacketBuilder2 {
|
||||
if (numFragments > 1 || info.length > 1000) {
|
||||
byte[] gzipped = DataHelper.compress(info, 0, info.length, DataHelper.MAX_COMPRESSION);
|
||||
if (gzipped.length < info.length) {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Gzipping RI, max is " + max + " size was " + info.length + " size now " + gzipped.length);
|
||||
if (_log.shouldInfo())
|
||||
_log.info("Gzipping RI, max is " + max + " size was " + info.length + " size now " + gzipped.length);
|
||||
gzip = true;
|
||||
info = gzipped;
|
||||
numFragments = info.length / max;
|
||||
@@ -485,8 +485,8 @@ class PacketBuilder2 {
|
||||
if (numFragments > 1) {
|
||||
if (numFragments > 15)
|
||||
throw new IllegalArgumentException();
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("RI size " + info.length + " requires " + numFragments + " packets");
|
||||
if (_log.shouldInfo())
|
||||
_log.info("RI size " + info.length + " requires " + numFragments + " packets");
|
||||
len = max;
|
||||
} else {
|
||||
len = info.length;
|
||||
@@ -570,8 +570,8 @@ class PacketBuilder2 {
|
||||
encryptSessionConfirmed(packet0, state.getHandshakeState(), state.getMTU(), count, addPadding, isIPv6,
|
||||
hdrKey1, hdrKey2, block, state.getNextToken());
|
||||
int total = pkt.getLength();
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Building " + count + " fragmented session confirmed packets" +
|
||||
if (_log.shouldInfo())
|
||||
_log.info("Building " + count + " fragmented session confirmed packets" +
|
||||
" max data: " + max +
|
||||
" RI block size: " + blockSize +
|
||||
" total data size: " + total);
|
||||
|
||||
@@ -307,7 +307,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
}
|
||||
if (header.getDestConnID() != _rcvConnID) {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("bad Dest Conn id " + header.getDestConnID() + " size " + len + " on " + this);
|
||||
_log.warn("bad Dest Conn id " + header + " size " + len + " on " + this);
|
||||
return;
|
||||
}
|
||||
if (header.getType() != DATA_FLAG_BYTE) {
|
||||
|
||||
@@ -198,7 +198,8 @@ final class SSU2Header {
|
||||
" version " + getVersion() + " netID " + getNetID() +
|
||||
" srcID " + getSrcConnID() + " token " + getToken();
|
||||
}
|
||||
return "Short header destID " + getDestConnID() + " pkt num " + getPacketNumber() + " type " + getType();
|
||||
return "Short header destID " + getDestConnID() + " pkt num " + getPacketNumber() + " type " + getType() +
|
||||
" flags " + getShortHeaderFlags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user