forked from I2P_Developers/i2p.i2p
SSU2: Fix retransmission of session confirmed
Was setting packet length to number of packets. Add check and log in UDPSender Add notes where length is checked
This commit is contained in:
@@ -946,8 +946,7 @@ class PacketHandler {
|
||||
// Session Confirmed or retransmitted Session Request or Token Request
|
||||
header = SSU2Header.trialDecryptShortHeader(packet, k1, k2);
|
||||
if (header == null) {
|
||||
// too short, perhaps SSU 1/2 confusion?
|
||||
// Java 0.9.55 short destroy bug?
|
||||
// Java I2P thru 0.9.56 retransmits session confirmed with 1-2 byte packets
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Session Confirmed too short len: " +
|
||||
+ packet.getPacket().getLength() + " on " + state);
|
||||
|
||||
@@ -407,7 +407,9 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
try {
|
||||
SSU2Header.Header header = SSU2Header.trialDecryptShortHeader(packet, _rcvHeaderEncryptKey1, _rcvHeaderEncryptKey2);
|
||||
if (header == null) {
|
||||
if (_log.shouldWarn())
|
||||
// Java I2P thru 0.9.55 would send 35-39 byte ping packets
|
||||
// Java I2P thru 0.9.56 retransmits session confirmed with 1-2 byte packets
|
||||
if (len > 2 && len < 35 && _log.shouldWarn())
|
||||
_log.warn("Inbound packet too short " + len + " on " + this);
|
||||
return;
|
||||
}
|
||||
@@ -1024,7 +1026,7 @@ public class PeerState2 extends PeerState implements SSU2Payload.PayloadCallback
|
||||
byte data[] = pkt.getData();
|
||||
int off = pkt.getOffset();
|
||||
System.arraycopy(_sessConfForReTX[i], 0, data, off, _sessConfForReTX[i].length);
|
||||
pkt.setLength(_sessConfForReTX.length);
|
||||
pkt.setLength(_sessConfForReTX[i].length);
|
||||
pkt.setAddress(addr);
|
||||
pkt.setPort(_remotePort);
|
||||
packet.setMessageType(PacketBuilder2.TYPE_CONF);
|
||||
|
||||
@@ -196,6 +196,8 @@ class UDPSender {
|
||||
_log.error("Dropping large UDP packet " + psz + " bytes: " + packet, new Exception());
|
||||
return;
|
||||
}
|
||||
if (psz > 0 && psz < SSU2Util.MIN_DATA_LEN && _log.shouldWarn())
|
||||
_log.warn("Small UDP packet " + psz + " bytes: " + packet, new Exception());
|
||||
if (_dummy) {
|
||||
// testing
|
||||
// back to the cache
|
||||
|
||||
Reference in New Issue
Block a user