forked from I2P_Developers/i2p.i2p
account for RAP vs RAR in multihomeCache
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 6.4 KiB |
@@ -163,10 +163,7 @@ public class HandleDatabaseLookupMessageJob extends JobImpl {
|
||||
getContext().statManager().addRateData("netDb.lookupsMatchedLocalClosest", 1);
|
||||
sendData(searchKey, ls, fromKey, toTunnel);
|
||||
} else if (possibleMultihomed != null) {
|
||||
if (possibleMultihomed.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4)) {
|
||||
// If it's in the possibleMultihomed cache, then it was definitely stored to us meaning it is effectively
|
||||
// always recievedAsPublished. No need to decide whether or not to answer the request like above, just
|
||||
// answer it so it doesn't look different from other stores.
|
||||
if (possibleMultihomed.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4) && possibleMultihomed.getReceivedAsPublished()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("We have local LS, possibly from a multihomed router " + searchKey + ", and somebody requested it back from us. Answering query, as if in our keyspace, to avoid attack.");
|
||||
getContext().statManager().addRateData("netDb.lookupsMatchedLocalMultihome", 1);
|
||||
@@ -192,10 +189,7 @@ public class HandleDatabaseLookupMessageJob extends JobImpl {
|
||||
} else {
|
||||
LeaseSet possibleMultihomed = getContext().clientMessagePool().getCache().multihomedCache.get(searchKey);
|
||||
if (possibleMultihomed != null) {
|
||||
if (possibleMultihomed.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4)) {
|
||||
// If it's in the possibleMultihomed cache, then it was definitely stored to us meaning it is effectively
|
||||
// always recievedAsPublished. No need to decide whether or not to answer the request like above, just
|
||||
// answer it so it doesn't look different from other stores.
|
||||
if (possibleMultihomed.isCurrent(Router.CLOCK_FUDGE_FACTOR / 4) && possibleMultihomed.getReceivedAsPublished()) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("We have local LS, possibly from a multihomed router " + searchKey + ", and somebody requested it back from us. Answering query, as if in our keyspace, to avoid attack.");
|
||||
getContext().statManager().addRateData("netDb.lookupsMatchedLocalMultihome", 1);
|
||||
|
@@ -92,6 +92,16 @@ class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
// This could happen with multihoming - where it's really important to prevent
|
||||
// storing the other guy's leaseset, it will confuse us badly.
|
||||
LeaseSet ls = (LeaseSet) entry;
|
||||
// If this was received as a response to a query,
|
||||
// FloodOnlyLookupMatchJob called setReceivedAsReply(),
|
||||
// and we are seeing this only as a duplicate,
|
||||
// so we don't set the receivedAsPublished() flag.
|
||||
// Otherwise, mark it as something we received unsolicited, so we'll answer queries
|
||||
// for it. This flag must NOT get set on entries that we
|
||||
// receive in response to our own lookups.
|
||||
// See ../HDLMJ for more info
|
||||
if (!ls.getReceivedAsReply())
|
||||
ls.setReceivedAsPublished();
|
||||
if (getContext().clientManager().isLocal(key)) {
|
||||
getContext().statManager().addRateData("netDb.storeLocalLeaseSetAttempt", 1, 0);
|
||||
// throw rather than return, so that we send the ack below (prevent easy attack)
|
||||
@@ -111,16 +121,7 @@ class HandleFloodfillDatabaseStoreMessageJob extends JobImpl {
|
||||
}
|
||||
//boolean oldrar = ls.getReceivedAsReply();
|
||||
//boolean oldrap = ls.getReceivedAsPublished();
|
||||
// If this was received as a response to a query,
|
||||
// FloodOnlyLookupMatchJob called setReceivedAsReply(),
|
||||
// and we are seeing this only as a duplicate,
|
||||
// so we don't set the receivedAsPublished() flag.
|
||||
// Otherwise, mark it as something we received unsolicited, so we'll answer queries
|
||||
// for it. This flag must NOT get set on entries that we
|
||||
// receive in response to our own lookups.
|
||||
// See ../HDLMJ for more info
|
||||
if (!ls.getReceivedAsReply())
|
||||
ls.setReceivedAsPublished();
|
||||
|
||||
//boolean rap = ls.getReceivedAsPublished();
|
||||
//if (_log.shouldLog(Log.INFO))
|
||||
// _log.info("oldrap? " + oldrap + " oldrar? " + oldrar + " newrap? " + rap);
|
||||
|
Reference in New Issue
Block a user