diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-06 17:56:47 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-06 17:56:47 -0700 |
| commit | 876aa0883d66340960381ec6388c55b23e5d2b5e (patch) | |
| tree | 918e1246e2cb98fe74037ff083dcceb475bc6802 /controller | |
| parent | 36db5865e7ab4ed92ede99f10835fba40e9b9fd8 (diff) | |
| parent | 477feee8a3fbc84d00c2939b5fc8a9bbf19af2ca (diff) | |
| download | infinitytier-876aa0883d66340960381ec6388c55b23e5d2b5e.tar.gz infinitytier-876aa0883d66340960381ec6388c55b23e5d2b5e.zip | |
Merge branch 'adamierymenko-dev' into netcon
Diffstat (limited to 'controller')
| -rw-r--r-- | controller/SqliteNetworkController.cpp | 9 | ||||
| -rw-r--r-- | controller/SqliteNetworkController.hpp | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/controller/SqliteNetworkController.cpp b/controller/SqliteNetworkController.cpp index d16c5996..334ccc75 100644 --- a/controller/SqliteNetworkController.cpp +++ b/controller/SqliteNetworkController.cpp @@ -44,12 +44,15 @@ #include "../ext/json-parser/json.h" #include "SqliteNetworkController.hpp" + +#include "../node/Node.hpp" #include "../node/Utils.hpp" #include "../node/CertificateOfMembership.hpp" #include "../node/NetworkConfig.hpp" #include "../node/InetAddress.hpp" #include "../node/MAC.hpp" #include "../node/Address.hpp" + #include "../osdep/OSUtils.hpp" // Include ZT_NETCONF_SCHEMA_SQL constant to init database @@ -117,8 +120,10 @@ struct NetworkRecord { } // anonymous namespace -SqliteNetworkController::SqliteNetworkController(const char *dbPath) : +SqliteNetworkController::SqliteNetworkController(Node *node,const char *dbPath,const char *circuitTestPath) : + _node(node), _dbPath(dbPath), + _circuitTestPath(circuitTestPath), _db((sqlite3 *)0) { if (sqlite3_open_v2(dbPath,&_db,SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE,(const char *)0) != SQLITE_OK) @@ -1742,6 +1747,8 @@ NetworkController::ResultCode SqliteNetworkController::_doNetworkConfigRequest(c for(uint32_t k=ipRangeStart,l=0;(k<=ipRangeEnd)&&(l < 1000000);++k,++l) { uint32_t ip = (ipRangeLen > 0) ? (ipRangeStart + (ipTrialCounter % ipRangeLen)) : ipRangeStart; ++ipTrialCounter; + if ((ip & 0x000000ff) == 0x000000ff) + continue; // don't allow addresses that end in .255 for(std::vector< std::pair<uint32_t,int> >::const_iterator r(routedNetworks.begin());r!=routedNetworks.end();++r) { if ((ip & (0xffffffff << (32 - r->second))) == r->first) { diff --git a/controller/SqliteNetworkController.hpp b/controller/SqliteNetworkController.hpp index f0b61c40..68529e39 100644 --- a/controller/SqliteNetworkController.hpp +++ b/controller/SqliteNetworkController.hpp @@ -45,10 +45,12 @@ namespace ZeroTier { +class Node; + class SqliteNetworkController : public NetworkController { public: - SqliteNetworkController(const char *dbPath); + SqliteNetworkController(Node *node,const char *dbPath,const char *circuitTestPath); virtual ~SqliteNetworkController(); virtual NetworkController::ResultCode doNetworkConfigRequest( @@ -104,7 +106,9 @@ private: const Dictionary &metaData, Dictionary &netconf); + Node *_node; std::string _dbPath; + std::string _circuitTestPath; std::string _instanceId; // A circular buffer last log |
