This commit is contained in:
Adam Ierymenko 2016-08-18 18:18:50 -07:00
parent 212a5af9a5
commit 4dce71879f

View File

@ -50,7 +50,7 @@ using json = nlohmann::json;
#define ZT_NETCONF_CONTROLLER_API_VERSION 3
// Number of requests to remember in member history
#define ZT_NETCONF_DB_MEMBER_HISTORY_LENGTH 64
#define ZT_NETCONF_DB_MEMBER_HISTORY_LENGTH 16
// Min duration between requests for an address/nwid combo to prevent floods
#define ZT_NETCONF_MIN_REQUEST_PERIOD 1000
@ -540,6 +540,9 @@ NetworkController::ResultCode EmbeddedNetworkController::doNetworkConfigRequest(
auto ipAssignmentPools = network["ipAssignmentPools"];
auto routes = network["routes"];
auto rules = network["rules"];
auto capabilities = network["capabilities"];
auto memberCapabilities = member["capabilities"];
auto memberTags = member["tags"];
if (rules.is_array()) {
for(unsigned long i=0;i<rules.size();++i) {
@ -551,6 +554,25 @@ NetworkController::ResultCode EmbeddedNetworkController::doNetworkConfigRequest(
}
}
if ((memberCapabilities.is_array())&&(memberCapabilities.size() > 0)&&(capabilities.is_array())) {
std::map< uint64_t,json > capsById;
for(unsigned long i=0;i<capabilities.size();++i) {
auto cap = capabilities[i];
if (cap.is_object())
capsById[_jI(cap["id"],0ULL)] = cap;
}
for(unsigned long i=0;i<memberCapabilities.size();++i) {
const uint64_t capId = _jI(memberCapabilities[i],0ULL);
json &cap = capsById[capId];
if ((cap.is_object())&&(cap.size() > 0)) {
}
}
}
if (memberTags.is_array()) {
}
if (routes.is_array()) {
for(unsigned long i=0;i<routes.size();++i) {
if (nc.routeCount >= ZT_MAX_NETWORK_ROUTES)