forked from I2P_Developers/i2p.i2p
NTCP2: Catch bad IV exception
This commit is contained in:
@ -1,3 +1,6 @@
|
|||||||
|
2018-08-19 zzz
|
||||||
|
* NTCP2: Catch bad IV exception
|
||||||
|
|
||||||
2018-08-16 zzz
|
2018-08-16 zzz
|
||||||
* i2ptunnel: Change read timeout defaults now that streaming timeout works
|
* i2ptunnel: Change read timeout defaults now that streaming timeout works
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 24;
|
public final static long BUILD = 25;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "-rc";
|
public final static String EXTRA = "-rc";
|
||||||
|
@ -242,16 +242,22 @@ public class NTCPConnection implements Closeable {
|
|||||||
* Caller MUST call transport.establishing(this) after construction.
|
* Caller MUST call transport.establishing(this) after construction.
|
||||||
*
|
*
|
||||||
* @param version must be 1 or 2
|
* @param version must be 1 or 2
|
||||||
|
* @throws DataFormatException if there's a problem with the address
|
||||||
*/
|
*/
|
||||||
public NTCPConnection(RouterContext ctx, NTCPTransport transport, RouterIdentity remotePeer,
|
public NTCPConnection(RouterContext ctx, NTCPTransport transport, RouterIdentity remotePeer,
|
||||||
RouterAddress remAddr, int version) {
|
RouterAddress remAddr, int version) throws DataFormatException {
|
||||||
this(ctx, transport, remAddr, false);
|
this(ctx, transport, remAddr, false);
|
||||||
_remotePeer = remotePeer;
|
_remotePeer = remotePeer;
|
||||||
_version = version;
|
_version = version;
|
||||||
if (version == 1)
|
if (version == 1) {
|
||||||
_establishState = new OutboundEstablishState(ctx, transport, this);
|
_establishState = new OutboundEstablishState(ctx, transport, this);
|
||||||
else
|
} else {
|
||||||
_establishState = new OutboundNTCP2State(ctx, transport, this);
|
try {
|
||||||
|
_establishState = new OutboundNTCP2State(ctx, transport, this);
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
throw new DataFormatException("bad address? " + remAddr, iae);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
import net.i2p.crypto.SigType;
|
import net.i2p.crypto.SigType;
|
||||||
import net.i2p.data.Base64;
|
import net.i2p.data.Base64;
|
||||||
|
import net.i2p.data.DataFormatException;
|
||||||
import net.i2p.data.DataHelper;
|
import net.i2p.data.DataHelper;
|
||||||
import net.i2p.data.Hash;
|
import net.i2p.data.Hash;
|
||||||
import net.i2p.data.router.RouterAddress;
|
import net.i2p.data.router.RouterAddress;
|
||||||
@ -334,12 +335,18 @@ public class NTCPTransport extends TransportImpl {
|
|||||||
if (addr != null) {
|
if (addr != null) {
|
||||||
newVersion = getNTCPVersion(addr);
|
newVersion = getNTCPVersion(addr);
|
||||||
if (newVersion != 0) {
|
if (newVersion != 0) {
|
||||||
con = new NTCPConnection(_context, this, ident, addr, newVersion);
|
try {
|
||||||
establishing(con);
|
con = new NTCPConnection(_context, this, ident, addr, newVersion);
|
||||||
//if (_log.shouldLog(Log.DEBUG))
|
establishing(con);
|
||||||
// _log.debug("Send on a new con: " + con + " at " + addr + " for " + ih);
|
//if (_log.shouldLog(Log.DEBUG))
|
||||||
// Note that outbound conns go in the map BEFORE establishment
|
// _log.debug("Send on a new con: " + con + " at " + addr + " for " + ih);
|
||||||
_conByIdent.put(ih, con);
|
// Note that outbound conns go in the map BEFORE establishment
|
||||||
|
_conByIdent.put(ih, con);
|
||||||
|
} catch (DataFormatException dfe) {
|
||||||
|
if (_log.shouldWarn())
|
||||||
|
_log.warn("bad address? " + target, dfe);
|
||||||
|
fail = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
|
@ -94,6 +94,9 @@ class OutboundNTCP2State implements EstablishState {
|
|||||||
CORRUPT
|
CORRUPT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws IllegalArgumentException on bad address in the con
|
||||||
|
*/
|
||||||
public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con) {
|
public OutboundNTCP2State(RouterContext ctx, NTCPTransport transport, NTCPConnection con) {
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
_log = ctx.logManager().getLog(getClass());
|
_log = ctx.logManager().getLog(getClass());
|
||||||
|
Reference in New Issue
Block a user