Skip to content

Commit

Permalink
Pipe member capabilites to network json
Browse files Browse the repository at this point in the history
  • Loading branch information
laduke committed Sep 15, 2023
1 parent 8ffd482 commit a0982c6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/ZeroTierOne.h
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,9 @@ typedef struct
uint32_t tags[ZT_MAX_NETWORK_TAGS][2];
unsigned int tagsCount;

uint32_t capabilities[ZT_MAX_NETWORK_CAPABILITIES];
unsigned int capabilitiesCount;


} ZT_VirtualNetworkConfig;

Expand Down
9 changes: 9 additions & 0 deletions node/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,15 @@ void Network::_externalConfig(ZT_VirtualNetworkConfig *ec) const
}
}

for (unsigned int i = 0; i<ZT_MAX_NETWORK_CAPABILITIES; i++) {
if (_config.capabilities[i].id()) {
ec->capabilities[i] = _config.capabilities[i].id();
} else {
ec->capabilitiesCount = i;
break;
}
}

ec->assignedAddressCount = 0;
for(unsigned int i=0;i<ZT_MAX_ZT_ASSIGNED_ADDRESSES;++i) {
if (i < _config.staticIpCount) {
Expand Down
10 changes: 10 additions & 0 deletions service/OneService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,16 @@ static void _networkToJson(nlohmann::json &nj,NetworkState &ns)
}
nj["tags"] = tags;

nlohmann::json caps = nlohmann::json::array();
for(unsigned int i=0;i<ns.config().capabilitiesCount;++i) {
if (ns.config().capabilities[i]) {
caps[i] = ns.config().capabilities[i];
} else {
break;
}
}
nj["capabilities"] = caps;


nlohmann::json aa = nlohmann::json::array();
for(unsigned int i=0;i<ns.config().assignedAddressCount;++i) {
Expand Down

0 comments on commit a0982c6

Please sign in to comment.