SSU2: Check for missing address block in peer test msg 7

This commit is contained in:
zzz
2022-06-06 16:24:19 -04:00
parent a2ec81eaec
commit 0fe437f649

View File

@@ -1332,6 +1332,7 @@ class PeerTestManager {
state.getAliceIntroKey(), false,
sendId, rcvId, data);
_transport.send(packet);
// for now, ignore address block, we could pass it to externalAddressReceived()
break;
}
@@ -1350,13 +1351,17 @@ class PeerTestManager {
test.setReceiveCharlieTime(now);
// use the IP/port from the address block
test.setAlicePortFromCharlie(addrBlockPort);
try {
InetAddress addr = InetAddress.getByAddress(addrBlockIP);
test.setAliceIPFromCharlie(addr);
} catch (UnknownHostException uhe) {
if (_log.shouldWarn())
_log.warn("Charlie @ " + from + " said we were an invalid IP address: " + uhe.getMessage(), uhe);
_context.statManager().addRateData("udp.testBadIP", 1);
if (addrBlockIP != null) {
try {
InetAddress addr = InetAddress.getByAddress(addrBlockIP);
test.setAliceIPFromCharlie(addr);
} catch (UnknownHostException uhe) {
if (_log.shouldWarn())
_log.warn("Charlie @ " + from + " said we were an invalid IP address: " + uhe.getMessage(), uhe);
_context.statManager().addRateData("udp.testBadIP", 1);
}
} else {
test.setAliceIPFromCharlie(test.getAliceIP());
}
if (test.getReceiveBobTime() > 0)
testComplete();