Skip to content

Commit

Permalink
Router: comment out all uses of useSubDbs
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Oct 25, 2023
1 parent c538ba6 commit c2b877e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ else if (sencaa.equals("4"))
}
}
}
if (isPrimary && _floodfillNetworkDatabaseFacade == null && _context.netDbSegmentor().useSubDbs()) {
if (isPrimary && _floodfillNetworkDatabaseFacade == null) {
if (_log.shouldDebug())
_log.debug("Initializing subDb for client" + destHash);
_floodfillNetworkDatabaseFacade = new FloodfillNetworkDatabaseFacade(_context, destHash);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ public void runJob() {
// Only send it out if it is in our estimated keyspace.
// For this, we do NOT use their dontInclude list as it can't be trusted
// (i.e. it could mess up the closeness calculation)
LeaseSet possibleMultihomed = null;
/*LeaseSet possibleMultihomed = null;
if (getContext().netDbSegmentor().useSubDbs()) {
possibleMultihomed = getContext().multihomeNetDb().lookupLeaseSetLocally(searchKey);
}
*/
Set<Hash> closestHashes = getContext().netDb().findNearestRouters(searchKey,
CLOSENESS_THRESHOLD, null);
if (weAreClosest(closestHashes)) {
Expand All @@ -165,7 +166,7 @@ public void runJob() {
_log.info("We have local LS " + searchKey + ", answering query, in our keyspace");
getContext().statManager().addRateData("netDb.lookupsMatchedLocalClosest", 1);
sendData(searchKey, ls, fromKey, toTunnel);
} else if (getContext().netDbSegmentor().useSubDbs() && possibleMultihomed != null) {
/*} else if (getContext().netDbSegmentor().useSubDbs() && possibleMultihomed != null) {
// 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.
Expand All @@ -174,7 +175,7 @@ public void runJob() {
_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);
sendData(searchKey, possibleMultihomed, fromKey, toTunnel);
}
}*/
} else {
// Lie, pretend we don't have it
if (_log.shouldLog(Log.INFO))
Expand All @@ -184,7 +185,7 @@ public void runJob() {
sendClosest(searchKey, routerHashSet, fromKey, toTunnel);
}
} else {
LeaseSet possibleMultihomed = null;
/*LeaseSet possibleMultihomed = null;
if (getContext().netDbSegmentor().useSubDbs()) {
possibleMultihomed = getContext().multihomeNetDb().lookupLeaseSetLocally(searchKey);
}
Expand All @@ -195,7 +196,7 @@ public void runJob() {
getContext().statManager().addRateData("netDb.lookupsMatchedLocalMultihome", 1);
sendData(searchKey, possibleMultihomed, fromKey, toTunnel);
}
} else {
} else {*/
// It was not published to us (we looked it up, for example)
// or it's local and we aren't floodfill,
// or it's local and we don't publish it.
Expand All @@ -207,7 +208,7 @@ public void runJob() {
getContext().statManager().addRateData("netDb.lookupsMatchedRemoteNotClosest", 1);
Set<Hash> routerHashSet = getNearestRouters(lookupType);
sendClosest(searchKey, routerHashSet, fromKey, toTunnel);
}
/*}*/
}
} else if (type == DatabaseEntry.KEY_TYPE_ROUTERINFO &&
lookupType != DatabaseLookupMessage.Type.LS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public FloodfillNetworkDatabaseSegmentor(RouterContext context) {
_multihomeDbid = new FloodfillNetworkDatabaseFacade(_context, MULTIHOME_DBID);
}

public boolean useSubDbs() {
return _context.getProperty(PROP_NETDB_ISOLATION, true);
}
//public boolean useSubDbs() {
//return _context.getProperty(PROP_NETDB_ISOLATION, true);
//}

/**
* Retrieves the FloodfillNetworkDatabaseFacade object for the specified ID.
Expand All @@ -87,8 +87,8 @@ public boolean useSubDbs() {
*/
@Override
protected FloodfillNetworkDatabaseFacade getSubNetDB(Hash id) {
if (!useSubDbs())
return _mainDbid;
/*if (!useSubDbs())
return _mainDbid;*/
return _context.clientManager().getClientFloodfillNetworkDatabaseFacade(id);
}

Expand All @@ -103,8 +103,8 @@ public synchronized void shutdown() {
if (_log.shouldLog(Log.DEBUG))
_log.debug("shutdown called from FNDS, shutting down main and multihome db");
_mainDbid.shutdown();
if (useSubDbs())
_multihomeDbid.shutdown();
/*if (!useSubDbs())
_multihomeDbid.shutdown();*/
}

/**
Expand All @@ -117,8 +117,8 @@ public synchronized void startup() {
if (_log.shouldLog(Log.DEBUG))
_log.debug("startup called from FNDS, starting up main and multihome db");
_mainDbid.startup();
if (useSubDbs())
_multihomeDbid.startup();
/*if (useSubDbs())
_multihomeDbid.startup();*/
}

/**
Expand Down Expand Up @@ -280,8 +280,8 @@ public FloodfillNetworkDatabaseFacade multiHomeNetDB() {
public FloodfillNetworkDatabaseFacade clientNetDB(Hash id) {
if (_log.shouldDebug())
_log.debug("looked up clientNetDB: " + id);
if (!useSubDbs())
return _mainDbid;
/*if (!useSubDbs())
return _mainDbid;*/
if (id != null){
FloodfillNetworkDatabaseFacade fndf = getSubNetDB(id);
if (fndf != null)
Expand Down Expand Up @@ -329,10 +329,10 @@ public Set<FloodfillNetworkDatabaseFacade> getSubNetDBs() {
if (!_mainDbid.isInitialized())
return Collections.emptySet();
Set<FloodfillNetworkDatabaseFacade> rv = new HashSet<>();
if (!useSubDbs()) {
/*if (!useSubDbs()) {
rv.add(_mainDbid);
return rv;
}
}*/
rv.add(_mainDbid);
rv.add(multiHomeNetDB());
rv.addAll(_context.clientManager().getClientFloodfillNetworkDatabaseFacades());
Expand All @@ -351,10 +351,10 @@ private Set<FloodfillNetworkDatabaseFacade> getClientSubNetDBs() {
if (!_mainDbid.isInitialized())
return Collections.emptySet();
Set<FloodfillNetworkDatabaseFacade> rv = new HashSet<>();
if (!useSubDbs()) {
/*if (!useSubDbs()) {
rv.add(_mainDbid);
return rv;
}
}*/
rv.addAll(_context.clientManager().getClientFloodfillNetworkDatabaseFacades());
return rv;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ else if (getContext().clientManager().isLocal(key))
blockStore = false;
if (blockStore) {
getContext().statManager().addRateData("netDb.storeLocalLeaseSetAttempt", 1, 0);
// If we're using subdbs, store the leaseSet in the multihome DB.
// If we're not using subdbs, store the leaseSet in the multihome DB. (disabled/commented out below)
// otherwise, throw rather than return, so that we send the ack below (prevent easy attack)
// We should actually never hit this code unless we're using a monolithid netDb, which is now disabled.
dontBlamePeer = true;
if (getContext().netDbSegmentor().useSubDbs())
/*if (getContext().netDbSegmentor().useSubDbs())
getContext().multihomeNetDb().store(key, ls);
else
else*/
throw new IllegalArgumentException("(dbid: " + _facade._dbid
+ ") Peer attempted to store local leaseSet: "
+ key.toBase32());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ public void publish(LeaseSet localLeaseSet) throws IllegalArgumentException {
_log.error("locally published leaseSet is not valid?", iae);
throw iae;
}
if (!_context.netDbSegmentor().useSubDbs()){
//if (!_context.netDbSegmentor().useSubDbs()){
String dbid = "main netDb";
if (isClientDb()) {
dbid = "client netDb: " + _dbid;
Expand All @@ -906,7 +906,7 @@ public void publish(LeaseSet localLeaseSet) throws IllegalArgumentException {
if (_log.shouldLog(Log.INFO))
_log.info("[" + dbid + "]" + "Local client LS key initialized to: " + _localKey);
}
}
//}
if (!_context.clientManager().shouldPublishLeaseSet(h))
return;
// If we're exiting, don't publish.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ public SegmentedNetworkDatabaseFacade(RouterContext context) {
* @return true if using subDbs, false if not
* @since 0.9.60
*/
public boolean useSubDbs() {
return false;
}
//public abstract boolean useSubDbs();

/**
* Get a sub-netDb using a Hash identifier
Expand Down

0 comments on commit c2b877e

Please sign in to comment.