forked from I2P_Developers/i2p.i2p
minor refactor
This commit is contained in:
@@ -63,11 +63,15 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int type = msg.getType();
|
int type = msg.getType();
|
||||||
|
|
||||||
|
// if the message came down a client tunnel:
|
||||||
|
if (_client != null) {
|
||||||
|
switch (type) {
|
||||||
|
case DatabaseSearchReplyMessage.MESSAGE_TYPE:
|
||||||
// FVSJ or client lookups could also result in a DSRM.
|
// FVSJ or client lookups could also result in a DSRM.
|
||||||
// Since there's some code that replies directly to this to gather new ff RouterInfos,
|
// Since there's some code that replies directly to this to gather new ff RouterInfos,
|
||||||
// sanitize it
|
// sanitize it
|
||||||
if ( (_client != null) &&
|
|
||||||
(type == DatabaseSearchReplyMessage.MESSAGE_TYPE)) {
|
|
||||||
// TODO: Strip in IterativeLookupJob etc. instead, depending on
|
// TODO: Strip in IterativeLookupJob etc. instead, depending on
|
||||||
// LS or RI and client or expl., so that we can safely follow references
|
// LS or RI and client or expl., so that we can safely follow references
|
||||||
// in a reply to a LS lookup over client tunnels.
|
// in a reply to a LS lookup over client tunnels.
|
||||||
@@ -83,8 +87,9 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
|||||||
msg = newMsg;
|
msg = newMsg;
|
||||||
}
|
}
|
||||||
****/
|
****/
|
||||||
} else if ( (_client != null) &&
|
break;
|
||||||
(type == DatabaseStoreMessage.MESSAGE_TYPE)) {
|
|
||||||
|
case DatabaseStoreMessage.MESSAGE_TYPE:
|
||||||
DatabaseStoreMessage dsm = (DatabaseStoreMessage) msg;
|
DatabaseStoreMessage dsm = (DatabaseStoreMessage) msg;
|
||||||
if (dsm.getEntry().getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO) {
|
if (dsm.getEntry().getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO) {
|
||||||
// FVSJ may result in an unsolicited RI store if the peer went non-ff.
|
// FVSJ may result in an unsolicited RI store if the peer went non-ff.
|
||||||
@@ -121,17 +126,24 @@ class InboundMessageDistributor implements GarlicMessageReceiver.CloveReceiver {
|
|||||||
// as long as there's no reply token (we will never set a reply token but an attacker might)
|
// as long as there's no reply token (we will never set a reply token but an attacker might)
|
||||||
((LeaseSet)dsm.getEntry()).setReceivedAsReply();
|
((LeaseSet)dsm.getEntry()).setReceivedAsReply();
|
||||||
}
|
}
|
||||||
} else if ( (_client != null) &&
|
break;
|
||||||
(type != DeliveryStatusMessage.MESSAGE_TYPE) &&
|
|
||||||
(type != GarlicMessage.MESSAGE_TYPE) &&
|
case DeliveryStatusMessage.MESSAGE_TYPE:
|
||||||
(type != TunnelBuildReplyMessage.MESSAGE_TYPE) &&
|
case GarlicMessage.MESSAGE_TYPE:
|
||||||
(type != VariableTunnelBuildReplyMessage.MESSAGE_TYPE)) {
|
case TunnelBuildReplyMessage.MESSAGE_TYPE:
|
||||||
// drop it, since we should only get tunnel test messages and garlic messages down
|
case VariableTunnelBuildReplyMessage.MESSAGE_TYPE:
|
||||||
|
// these are safe, handled below
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// drop it, since we should only get the above message types down
|
||||||
// client tunnels
|
// client tunnels
|
||||||
_context.statManager().addRateData("tunnel.dropDangerousClientTunnelMessage", 1, type);
|
_context.statManager().addRateData("tunnel.dropDangerousClientTunnelMessage", 1, type);
|
||||||
_log.error("Dropped dangerous message down a tunnel for " + _client + ": " + msg, new Exception("cause"));
|
_log.error("Dropped dangerous message down a tunnel for " + _client + ": " + msg, new Exception("cause"));
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
} // switch
|
||||||
|
} // client != null
|
||||||
|
|
||||||
if ( (target == null) || ( (tunnel == null) && (_context.routerHash().equals(target) ) ) ) {
|
if ( (target == null) || ( (tunnel == null) && (_context.routerHash().equals(target) ) ) ) {
|
||||||
// targetting us either implicitly (no target) or explicitly (no tunnel)
|
// targetting us either implicitly (no target) or explicitly (no tunnel)
|
||||||
|
Reference in New Issue
Block a user