Browse Source

specify and check netId

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

5
NetDb.cpp

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

2
RouterContext.cpp

@ -51,7 +51,7 @@ namespace i2p
routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | routerInfo.SetCaps (i2p::data::RouterInfo::eReachable |
i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC
routerInfo.SetProperty ("coreVersion", I2P_VERSION); 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 ("router.version", I2P_VERSION);
routerInfo.SetProperty ("stat_uptime", "90m"); routerInfo.SetProperty ("stat_uptime", "90m");
routerInfo.CreateBuffer (m_Keys); routerInfo.CreateBuffer (m_Keys);

7
RouterInfo.cpp

@ -3,6 +3,7 @@
#include "I2PEndian.h" #include "I2PEndian.h"
#include <fstream> #include <fstream>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include "version.h"
#include "Crypto.h" #include "Crypto.h"
#include "Base.h" #include "Base.h"
#include "Timestamp.h" #include "Timestamp.h"
@ -243,6 +244,12 @@ namespace data
// extract caps // extract caps
if (!strcmp (key, "caps")) if (!strcmp (key, "caps"))
ExtractCaps (value); 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)) if (!m_SupportedTransports || !m_Addresses.size() || (UsesIntroducer () && !introducers))

1
version.h

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

Loading…
Cancel
Save