check version before trying to add to NetDb

This commit is contained in:
orignal
2026-02-08 11:29:35 -05:00
parent f72d22bb27
commit 52dffb81fa
2 changed files with 11 additions and 11 deletions

View File

@@ -1020,6 +1020,12 @@ namespace transport
SendTerminationAndTerminate (eNTCP2Message3Error);
return;
}
if (ri.GetVersion () < i2p::data::NETDB_MIN_ALLOWED_VERSION && !ri.IsHighBandwidth ())
{
LogPrint (eLogInfo, "NTCP2: Router version ", ri.GetVersion (), " is too old in SessionConfirmed");
SendTerminationAndTerminate (eNTCP2Banned);
return;
}
// update RouterInfo in netdb
auto ri1 = i2p::data::netdb.AddRouterInfo (ri.GetBuffer (), ri.GetBufferLen ()); // ri1 points to one from netdb now
if (!ri1)
@@ -1077,12 +1083,6 @@ namespace transport
Terminate ();
return;
}
if (ri1->GetVersion () < i2p::data::NETDB_MIN_ALLOWED_VERSION && !ri1->IsHighBandwidth ())
{
LogPrint (eLogInfo, "NTCP2: Router version ", ri1->GetVersion (), " is too old in SessionConfirmed");
SendTerminationAndTerminate (eNTCP2Banned);
return;
}
// TODO: process options block
// ready to communicate