Browse Source

specify and check netId

pull/323/head
orignal 9 years ago
parent
commit
0ca3fb5af0
  1. 19
      NetDb.cpp
  2. 2
      RouterContext.cpp
  3. 7
      RouterInfo.cpp
  4. 1
      version.h

19
NetDb.cpp

@ -168,16 +168,19 @@ namespace data @@ -168,16 +168,19 @@ namespace data
}
else
{
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase32());
r = std::make_shared<RouterInfo> (buf, len);
if (!r->IsUnreachable ())
{
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
m_RouterInfos[r->GetIdentHash ()] = r;
}
if (r->IsFloodfill ())
{
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
m_Floodfills.push_back (r);
LogPrint (eLogInfo, "NetDb: RouterInfo added: ", ident.ToBase32());
{
std::unique_lock<std::mutex> l(m_RouterInfosMutex);
m_RouterInfos[r->GetIdentHash ()] = r;
}
if (r->IsFloodfill ())
{
std::unique_lock<std::mutex> l(m_FloodfillsMutex);
m_Floodfills.push_back (r);
}
}
}
// take care about requested destination

2
RouterContext.cpp

@ -51,7 +51,7 @@ namespace i2p @@ -51,7 +51,7 @@ namespace i2p
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
routerInfo.SetProperty ("coreVersion", I2P_VERSION);
routerInfo.SetProperty ("netId", "2");
routerInfo.SetProperty ("netId", std::to_string (I2PD_NET_ID));
routerInfo.SetProperty ("router.version", I2P_VERSION);
routerInfo.SetProperty ("stat_uptime", "90m");
routerInfo.CreateBuffer (m_Keys);

7
RouterInfo.cpp

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
#include "I2PEndian.h"
#include <fstream>
#include <boost/lexical_cast.hpp>
#include "version.h"
#include "Crypto.h"
#include "Base.h"
#include "Timestamp.h"
@ -243,6 +244,12 @@ namespace data @@ -243,6 +244,12 @@ namespace data
// extract caps
if (!strcmp (key, "caps"))
ExtractCaps (value);
// check netId
if (!strcmp (key, "netId") && atoi (value) != I2PD_NET_ID)
{
LogPrint (eLogError, "Unexpected netid=", value);
m_IsUnreachable = true;
}
}
if (!m_SupportedTransports || !m_Addresses.size() || (UsesIntroducer () && !introducers))

1
version.h

@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
#define I2PD_VERSION_PATCH 0
#define I2PD_VERSION MAKE_VERSION(I2PD_VERSION_MAJOR, I2PD_VERSION_MINOR, I2PD_VERSION_MICRO)
#define VERSION I2PD_VERSION
#define I2PD_NET_ID 2
#define I2P_VERSION_MAJOR 0
#define I2P_VERSION_MINOR 9

Loading…
Cancel
Save