I2CP: More BlindingInfo serialization fixes

Shorten lookup timeout on router side so the client gets the reply before timeout
This commit is contained in:
zzz
2019-09-18 12:37:26 +00:00
parent f9a2193e2f
commit 2b6cb2099a
4 changed files with 29 additions and 6 deletions

View File

@ -167,6 +167,8 @@ public class BlindingInfoMessage extends I2CPMessageImpl {
throw new IllegalArgumentException("no key required"); throw new IllegalArgumentException("no key required");
if (authType != BlindData.AUTH_NONE && privKey == null) if (authType != BlindData.AUTH_NONE && privKey == null)
throw new IllegalArgumentException("key required"); throw new IllegalArgumentException("key required");
if (privKey != null && privKey.getType() != EncType.ECIES_X25519)
throw new IllegalArgumentException("Bad privkey type");
_sessionId = id; _sessionId = id;
_authType = authType; _authType = authType;
_blindType = blindType; _blindType = blindType;
@ -336,9 +338,7 @@ public class BlindingInfoMessage extends I2CPMessageImpl {
ByteArrayOutputStream os = new ByteArrayOutputStream(512); ByteArrayOutputStream os = new ByteArrayOutputStream(512);
try { try {
_sessionId.writeBytes(os); _sessionId.writeBytes(os);
byte flags = (byte) _authType; byte flags = (byte) (_authType & FLAG_AUTH);
if (_privkey != null)
flags |= FLAG_AUTH;
if (_secret != null) if (_secret != null)
flags |= FLAG_SECRET; flags |= FLAG_SECRET;
os.write(flags); os.write(flags);
@ -356,7 +356,6 @@ public class BlindingInfoMessage extends I2CPMessageImpl {
os.write(_pubkey.getData()); os.write(_pubkey.getData());
} }
if (_privkey != null) { if (_privkey != null) {
DataHelper.writeLong(os, 2, _privkey.getType().getCode());
os.write(_privkey.getData()); os.write(_privkey.getData());
} }
if (_secret != null) if (_secret != null)
@ -377,6 +376,7 @@ public class BlindingInfoMessage extends I2CPMessageImpl {
buf.append("[BlindingInfoMessage: "); buf.append("[BlindingInfoMessage: ");
buf.append("\n\tSession: ").append(_sessionId); buf.append("\n\tSession: ").append(_sessionId);
buf.append("\n\tTimeout: ").append(_expiration); buf.append("\n\tTimeout: ").append(_expiration);
buf.append("\n\tAuthTyp: ").append(_authType);
if (_endpointType == TYPE_HASH) if (_endpointType == TYPE_HASH)
buf.append("\n\tHash: ").append(_hash.toBase32()); buf.append("\n\tHash: ").append(_hash.toBase32());
else if (_endpointType == TYPE_HOST) else if (_endpointType == TYPE_HOST)

View File

@ -1,3 +1,22 @@
2019-09-18 zzz
* I2CP:
- More BlindingInfo serialization fixes
- Shorten lookup timeout on router side
2019-09-17 zzz
* I2CP: Fix BlindingInfo serialization
* i2ptunnel:
- Remove streamr, connect, and httpbidir from wizard
- B32 auth form improvements
- Improve query parsing in local HTTP server
- New CLI BlindingInfo test
* Router: Implement expiration for BlindData entries
2019-09-14 zzz
* i2ptunnel: Fix SSL wizard for split config (ticket #2610)
* Reseed: Fix adding netid param (ticket #2621)
* Util: Don't attempt to load hidden cert files (ticket #2622)
2019-09-12 zzz 2019-09-12 zzz
* I2CP: BlindingInfo fixes * I2CP: BlindingInfo fixes
* i2ptunnel: New form for blinding info * i2ptunnel: New form for blinding info

View File

@ -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 = 7; public final static long BUILD = 8;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@ -179,8 +179,12 @@ class LookupDestJob extends JobImpl {
} }
} else if (_hash != null) { } else if (_hash != null) {
DoneJob done = new DoneJob(getContext()); DoneJob done = new DoneJob(getContext());
// shorten timeout so we can respond before the client side times out
long timeout = _timeout;
if (timeout > 1500)
timeout -= 500;
// TODO tell router this is an encrypted lookup, skip 38 or earlier ffs? // TODO tell router this is an encrypted lookup, skip 38 or earlier ffs?
getContext().netDb().lookupDestination(_hash, done, _timeout, _fromLocalDest); getContext().netDb().lookupDestination(_hash, done, timeout, _fromLocalDest);
} else { } else {
// blinding decode fail // blinding decode fail
returnFail(HostReplyMessage.RESULT_DECRYPTION_FAILURE); returnFail(HostReplyMessage.RESULT_DECRYPTION_FAILURE);