propagate from branch 'i2p.i2p.zzz.test' (head eaf123d687259d0dee558845508cfeec05f55915)
to branch 'i2p.i2p' (head 16158c16ac8422809a9bf3919831e5700ed74a51)
This commit is contained in:
@ -156,6 +156,12 @@ public class I2PTunnelConnectClient extends I2PTunnelClientBase implements Runna
|
||||
defaultOpts.setProperty(I2PSocketOptions.PROP_READ_TIMEOUT, ""+DEFAULT_READ_TIMEOUT);
|
||||
if (!defaultOpts.contains("i2p.streaming.inactivityTimeout"))
|
||||
defaultOpts.setProperty("i2p.streaming.inactivityTimeout", ""+DEFAULT_READ_TIMEOUT);
|
||||
// delayed start
|
||||
if (sockMgr == null) {
|
||||
synchronized(sockLock) {
|
||||
sockMgr = getSocketManager();
|
||||
}
|
||||
}
|
||||
I2PSocketOptions opts = sockMgr.buildOptions(defaultOpts);
|
||||
if (!defaultOpts.containsKey(I2PSocketOptions.PROP_CONNECT_TIMEOUT))
|
||||
opts.setConnectTimeout(DEFAULT_CONNECT_TIMEOUT);
|
||||
|
@ -23,12 +23,12 @@ jbigi <%=net.i2p.util.NativeBigInteger.loadStatus()%><br />
|
||||
<hr />
|
||||
<jsp:useBean class="net.i2p.router.web.LogsHelper" id="logsHelper" scope="request" />
|
||||
<jsp:setProperty name="logsHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
|
||||
<h4>Router logs:</h4>
|
||||
<jsp:getProperty name="logsHelper" property="logs" />
|
||||
<hr />
|
||||
<h4>Critical logs:</h4><a name="criticallogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="criticalLogs" />
|
||||
<hr />
|
||||
<h4>Router logs:</h4>
|
||||
<jsp:getProperty name="logsHelper" property="logs" />
|
||||
<hr />
|
||||
<h4>Service (Wrapper) logs:</h4><a name="servicelogs"> </a>
|
||||
<jsp:getProperty name="logsHelper" property="serviceLogs" />
|
||||
</div>
|
||||
|
@ -87,7 +87,7 @@ public class RouterContext extends I2PAppContext {
|
||||
return envProps;
|
||||
}
|
||||
private void initAll() {
|
||||
_adminManager = new AdminManager(this);
|
||||
//_adminManager = new AdminManager(this);
|
||||
if ("false".equals(getProperty("i2p.dummyClientFacade", "false")))
|
||||
_clientManagerFacade = new ClientManagerFacadeImpl(this);
|
||||
else
|
||||
|
@ -100,16 +100,10 @@ public class FloodfillVerifyStoreJob extends JobImpl {
|
||||
public boolean isMatch(I2NPMessage message) {
|
||||
if (message instanceof DatabaseStoreMessage) {
|
||||
DatabaseStoreMessage dsm = (DatabaseStoreMessage)message;
|
||||
if (_key.equals(dsm.getKey()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return _key.equals(dsm.getKey());
|
||||
} else if (message instanceof DatabaseSearchReplyMessage) {
|
||||
DatabaseSearchReplyMessage dsrm = (DatabaseSearchReplyMessage)message;
|
||||
if (_key.equals(dsrm.getSearchKey()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
return _key.equals(dsrm.getSearchKey());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
_log = ctx.logManager().getLog(getClass());
|
||||
ctx.statManager().createRateStat("netDb.storeHandled", "How many netDb store messages have we handled?", "NetworkDatabase", new long[] { 5*60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
ctx.statManager().createRateStat("netDb.storeLeaseSetHandled", "How many leaseSet store messages have we handled?", "NetworkDatabase", new long[] { 5*60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
//ctx.statManager().createRateStat("netDb.storeLocalLeaseSetAttempt", "Peer tries to store our leaseset (multihome?)", "NetworkDatabase", new long[] { 60*60*1000l });
|
||||
//ctx.statManager().createRateStat("netDb.storeLocalRouterInfoAttempt", "Peer tries to store our router info", "NetworkDatabase", new long[] { 60*60*1000l });
|
||||
ctx.statManager().createRateStat("netDb.storeRouterInfoHandled", "How many routerInfo store messages have we handled?", "NetworkDatabase", new long[] { 5*60*1000l, 60*60*1000l, 24*60*60*1000l });
|
||||
ctx.statManager().createRateStat("netDb.storeRecvTime", "How long it takes to handle the local store part of a dbStore?", "NetworkDatabase", new long[] { 60*1000l, 10*60*1000l });
|
||||
ctx.statManager().createRateStat("netDb.storeFloodNew", "How long it takes to flood out a newly received entry?", "NetworkDatabase", new long[] { 60*1000l, 10*60*1000l });
|
||||
@ -64,6 +66,18 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
getContext().statManager().addRateData("netDb.storeLeaseSetHandled", 1, 0);
|
||||
|
||||
try {
|
||||
// Never store a leaseSet for a local dest received from somebody else.
|
||||
// This generally happens from a FloodfillVerifyStoreJob.
|
||||
// If it is valid, it shouldn't be newer than what we have - unless
|
||||
// somebody has our keys...
|
||||
// This could happen with multihoming - where it's really important to prevent
|
||||
// storing the other guy's leaseset, it will confuse us badly.
|
||||
if (getContext().clientManager().isLocal(_message.getKey())) {
|
||||
//getContext().statManager().addRateData("netDb.storeLocalLeaseSetAttempt", 1, 0);
|
||||
// throw rather than return, so that we send the ack below (prevent easy attack)
|
||||
throw new IllegalArgumentException("Peer attempted to store local leaseSet: " +
|
||||
_message.getKey().toBase64().substring(0, 4));
|
||||
}
|
||||
LeaseSet ls = _message.getLeaseSet();
|
||||
// mark it as something we received, so we'll answer queries
|
||||
// for it. this flag does NOT get set on entries that we
|
||||
@ -86,6 +100,15 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
_log.info("Handling dbStore of router " + key + " with publishDate of "
|
||||
+ new Date(_message.getRouterInfo().getPublished()));
|
||||
try {
|
||||
// Never store our RouterInfo received from somebody else.
|
||||
// This generally happens from a FloodfillVerifyStoreJob.
|
||||
// If it is valid, it shouldn't be newer than what we have - unless
|
||||
// somebody has our keys...
|
||||
if (getContext().routerHash().equals(key)) {
|
||||
//getContext().statManager().addRateData("netDb.storeLocalRouterInfoAttempt", 1, 0);
|
||||
// throw rather than return, so that we send the ack below (prevent easy attack)
|
||||
throw new IllegalArgumentException("Peer attempted to store our RouterInfo");
|
||||
}
|
||||
prevNetDb = getContext().netDb().store(key, _message.getRouterInfo());
|
||||
wasNew = ((null == prevNetDb) || (prevNetDb.getPublished() < _message.getRouterInfo().getPublished()));
|
||||
// Check new routerinfo address against blocklist
|
||||
@ -146,9 +169,13 @@ public class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
}
|
||||
|
||||
} else {
|
||||
// Should we record in the profile?
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Peer " + _fromHash.toBase64() + " sent bad data: " + invalidMessage);
|
||||
}
|
||||
} else if (invalidMessage != null) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unknown peer sent bad data: " + invalidMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user