Skip to content

Commit

Permalink
NetDb: Update the Handling of DSRM in Segmented NetDb.
Browse files Browse the repository at this point in the history
It is safe to pass client DSRM back to the inNetMessagePool, even
though they will lose their client context, as long as the replies
have been stripped.

The DSRM will be matched against it's search, and the handling
then ends up back in the client context.  Or the DSRM is dropped.

TODO: The replies can actually be useful.  If the reply RI could
be handled inside the context of the client netDb, with searches
going out through tunnels, they should be safe.

Signed-off-by: obscuratus <[email protected]>
  • Loading branch information
obscuratus committed Aug 28, 2023
1 parent 171d479 commit aeb35d9
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ public void distribute(I2NPMessage msg, Hash target, TunnelId tunnel) {
}
}
// Don't know what to do with other message types here.
// The most common message here is a DSRM, which would need to
// be matched against its outstanding search.
// But, in testing, it is uncommon to end up here.
if (_log.shouldLog(Log.WARN))
_log.warn("[client: " + _clientNickname + "] Dropping a client message from a tunnel due to lack of delivery handling instructions. Message: " + msg);
return;
Expand Down Expand Up @@ -414,16 +413,15 @@ public void handleClove(DeliveryInstructions instructions, I2NPMessage data) {
newMsg.setSearchKey(orig.getSearchKey());
orig = newMsg;
}
/*
* ToDo: Need to figure out what to do with client DSRM, but dropping
* them back into the inNetMessagePool does no good with
* segmented netDb. The floodfill context will have no idea
* what to do with a client DSRM.
*/
// _context.inNetMessagePool().add(orig, null, null, _msgIDBloomXor);
if (_log.shouldLog(Log.WARN))
_log.warn("Dropping inbound DSRM for client " + _clientNickname
// Client DSRM are safe to pass back to the inNetMessagePool when
// the replies are stripped.
// Even though the inNetMessagePool will lack information to understand
// the client context, DSRM will be matched against their search,
// which will place the handling back in the client context.
if (_log.shouldLog(Log.DEBUG))
_log.debug("Passing inbound garlic DSRM back to inNetMessagePool for client " + _clientNickname
+ "; msg: " + orig);
_context.inNetMessagePool().add(orig, null, null, _msgIDBloomXor);
} else if (type == DataMessage.MESSAGE_TYPE) {
// a data message targetting the local router is how we send load tests (real
// data messages target destinations)
Expand Down

0 comments on commit aeb35d9

Please sign in to comment.