Router: Fix decryption of blinded leasesets

Reverse cache wasn't regenerated at midnight,
so decryption would fail after the first routing key change.
We had the rollover() method but it wasn't called.
This commit is contained in:
zzz
2021-03-27 08:15:01 -04:00
parent 0fbcd6ddf7
commit e21a3a366b
5 changed files with 31 additions and 3 deletions

View File

@@ -1,5 +1,10 @@
2021-03-27 zzz
* Router: Fix decryption of blinded leasesets
2021-03-25 zzz
* i2ptunnel: Force non-SSL socket to local target for SSL ports
* SSU: Implement IPv6 introductions (proposal 158)
* Transports: Don't open UPnP ports for disabled IPv4/v6
2021-03-23 zzz
* NetDB: Sort published addresses for consistency

View File

@@ -207,4 +207,11 @@ public abstract class NetworkDatabaseFacade implements Service {
public boolean removeBlindData(SigningPublicKey spk) {
return false;
}
/**
* Notify the netDB that the routing key changed at midnight UTC
*
* @since 0.9.50
*/
public void routingKeyChanged() {}
}

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 9;
public final static long BUILD = 10;
/** for example "-test" */
public final static String EXTRA = "";

View File

@@ -498,6 +498,7 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
* For console ConfigKeyringHelper
* @since 0.9.41
*/
@Override
public List<BlindData> getBlindData() {
return _blindCache.getData();
}
@@ -508,9 +509,22 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
* @return true if removed
* @since 0.9.41
*/
@Override
public boolean removeBlindData(SigningPublicKey spk) {
return _blindCache.removeBlindData(spk);
}
/**
* Notify the netDB that the routing key changed at midnight UTC
*
* @since 0.9.50
*/
@Override
public void routingKeyChanged() {
_blindCache.rollover();
if (_log.shouldInfo())
_log.info("UTC rollover, blind cache updated");
}
/**
* @return RouterInfo, LeaseSet, or null, validated

View File

@@ -36,8 +36,10 @@ public class UpdateRoutingKeyModifierJob extends JobImpl {
RouterKeyGenerator gen = getContext().routerKeyGenerator();
// make sure we requeue quickly if just before midnight
long delay = Math.max(5, Math.min(MAX_DELAY_FAILSAFE, gen.getTimeTillMidnight()));
// TODO tell netdb if mod data changed?
gen.generateDateBasedModData();
// tell netdb if mod data changed
boolean changed = gen.generateDateBasedModData();
if (changed)
getContext().netDb().routingKeyChanged();
requeue(delay);
}
}