diff --git a/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java b/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java index 681902f8d..c0b4bd134 100644 --- a/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java +++ b/router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java @@ -2825,6 +2825,14 @@ class EstablishmentManager { public void gotTermination(int reason, long count) { throw new IllegalStateException("Bad block in HP"); } + + public void gotPathChallenge(byte[] data) { + throw new IllegalStateException("Bad block in HP"); + } + + public void gotPathResponse(byte[] data) { + throw new IllegalStateException("Bad block in HP"); + } } diff --git a/router/java/src/net/i2p/router/transport/udp/InboundEstablishState2.java b/router/java/src/net/i2p/router/transport/udp/InboundEstablishState2.java index a2c3f0c0c..18c96dc9d 100644 --- a/router/java/src/net/i2p/router/transport/udp/InboundEstablishState2.java +++ b/router/java/src/net/i2p/router/transport/udp/InboundEstablishState2.java @@ -420,6 +420,14 @@ class InboundEstablishState2 extends InboundEstablishState implements SSU2Payloa _transport.getEstablisher().receiveSessionDestroy(_remoteHostId); } + public void gotPathChallenge(byte[] data) { + throw new IllegalStateException("Bad block in handshake"); + } + + public void gotPathResponse(byte[] data) { + throw new IllegalStateException("Bad block in handshake"); + } + ///////////////////////////////////////////////////////// // end payload callbacks ///////////////////////////////////////////////////////// diff --git a/router/java/src/net/i2p/router/transport/udp/OutboundEstablishState2.java b/router/java/src/net/i2p/router/transport/udp/OutboundEstablishState2.java index d77aafe6d..3f6b299a4 100644 --- a/router/java/src/net/i2p/router/transport/udp/OutboundEstablishState2.java +++ b/router/java/src/net/i2p/router/transport/udp/OutboundEstablishState2.java @@ -348,6 +348,14 @@ class OutboundEstablishState2 extends OutboundEstablishState implements SSU2Payl _transport.getEstablisher().receiveSessionDestroy(_remoteHostId, this); } + public void gotPathChallenge(byte[] data) { + // won't be called, SSU2Payload will throw + } + + public void gotPathResponse(byte[] data) { + // won't be called, SSU2Payload will throw + } + ///////////////////////////////////////////////////////// // end payload callbacks ///////////////////////////////////////////////////////// diff --git a/router/java/src/net/i2p/router/transport/udp/PeerState2.java b/router/java/src/net/i2p/router/transport/udp/PeerState2.java index cbd6451ba..d05d859d5 100644 --- a/router/java/src/net/i2p/router/transport/udp/PeerState2.java +++ b/router/java/src/net/i2p/router/transport/udp/PeerState2.java @@ -637,6 +637,14 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback _transport.getEstablisher().receiveSessionDestroy(_remoteHostId, this); } + public void gotPathChallenge(byte[] data) { + // TODO + } + + public void gotPathResponse(byte[] data) { + // TODO + } + ///////////////////////////////////////////////////////// // end payload callbacks ///////////////////////////////////////////////////////// diff --git a/router/java/src/net/i2p/router/transport/udp/PeerTestManager.java b/router/java/src/net/i2p/router/transport/udp/PeerTestManager.java index 8a130adcd..d1bb0f659 100644 --- a/router/java/src/net/i2p/router/transport/udp/PeerTestManager.java +++ b/router/java/src/net/i2p/router/transport/udp/PeerTestManager.java @@ -1837,6 +1837,9 @@ class PeerTestManager { } /** + * This is only for out-of-session messages 5-7, + * where most blocks are not allowed. + * * @since 0.9.54 */ private class PTCallback implements SSU2Payload.PayloadCallback { @@ -1920,5 +1923,13 @@ class PeerTestManager { public void gotTermination(int reason, long count) { throw new IllegalStateException("Bad block in PT"); } + + public void gotPathChallenge(byte[] data) { + throw new IllegalStateException("Bad block in PT"); + } + + public void gotPathResponse(byte[] data) { + throw new IllegalStateException("Bad block in PT"); + } } } diff --git a/router/java/src/net/i2p/router/transport/udp/SSU2Payload.java b/router/java/src/net/i2p/router/transport/udp/SSU2Payload.java index 50348817c..2f5ba0b46 100644 --- a/router/java/src/net/i2p/router/transport/udp/SSU2Payload.java +++ b/router/java/src/net/i2p/router/transport/udp/SSU2Payload.java @@ -124,6 +124,16 @@ class SSU2Payload { * @param lastReceived in theory could wrap around to negative, but very unlikely */ public void gotTermination(int reason, long lastReceived); + + /** + * @since 0.9.55 + */ + public void gotPathChallenge(byte[] data); + + /** + * @since 0.9.55 + */ + public void gotPathResponse(byte[] data); } /** @@ -352,6 +362,22 @@ class SSU2Payload { gotTermination = true; break; + case BLOCK_PATHCHALLENGE: + if (isHandshake) + throw new IOException("Illegal block in handshake: " + type); + byte[] cdata = new byte[len]; + System.arraycopy(payload, i, cdata, 0, len); + cb.gotPathChallenge(cdata); + break; + + case BLOCK_PATHRESP: + if (isHandshake) + throw new IOException("Illegal block in handshake: " + type); + byte[] rdata = new byte[len]; + System.arraycopy(payload, i, rdata, 0, len); + cb.gotPathResponse(rdata); + break; + case BLOCK_PADDING: gotPadding = true; break;