mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 04:57:53 +00:00
Merge branch 'dev' into jh-multipath-improvements
This commit is contained in:
commit
364ac499eb
@ -918,6 +918,7 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
|
|||||||
|
|
||||||
auto meta = json::object();
|
auto meta = json::object();
|
||||||
auto data = json::array();
|
auto data = json::array();
|
||||||
|
uint64_t networkCount = 0;
|
||||||
|
|
||||||
for(std::set<uint64_t>::const_iterator nwid(networkIds.begin()); nwid != networkIds.end(); ++nwid) {
|
for(std::set<uint64_t>::const_iterator nwid(networkIds.begin()); nwid != networkIds.end(); ++nwid) {
|
||||||
json network;
|
json network;
|
||||||
@ -927,8 +928,10 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
|
|||||||
|
|
||||||
std::vector<json> memTmp;
|
std::vector<json> memTmp;
|
||||||
if (_db.get(*nwid, network, memTmp)) {
|
if (_db.get(*nwid, network, memTmp)) {
|
||||||
|
if (!network.is_null()) {
|
||||||
uint64_t authorizedCount = 0;
|
uint64_t authorizedCount = 0;
|
||||||
uint64_t totalCount = memTmp.size();
|
uint64_t totalCount = memTmp.size();
|
||||||
|
networkCount++;
|
||||||
|
|
||||||
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
|
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
|
||||||
bool a = OSUtils::jsonBool((*m)["authorized"], 0);
|
bool a = OSUtils::jsonBool((*m)["authorized"], 0);
|
||||||
@ -939,11 +942,12 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
|
|||||||
nwMeta["totalMemberCount"] = totalCount;
|
nwMeta["totalMemberCount"] = totalCount;
|
||||||
nwMeta["authorizedMemberCount"] = authorizedCount;
|
nwMeta["authorizedMemberCount"] = authorizedCount;
|
||||||
network["meta"] = nwMeta;
|
network["meta"] = nwMeta;
|
||||||
}
|
|
||||||
|
|
||||||
data.push_back(network);
|
data.push_back(network);
|
||||||
}
|
}
|
||||||
meta["networkCount"] = networkIds.size();
|
}
|
||||||
|
}
|
||||||
|
meta["networkCount"] = networkCount;
|
||||||
|
|
||||||
auto out = json::object();
|
auto out = json::object();
|
||||||
out["data"] = data;
|
out["data"] = data;
|
||||||
@ -1090,12 +1094,8 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
|
|||||||
|
|
||||||
auto out = nlohmann::json::object();
|
auto out = nlohmann::json::object();
|
||||||
auto meta = nlohmann::json::object();
|
auto meta = nlohmann::json::object();
|
||||||
auto members = nlohmann::json::array();
|
|
||||||
std::vector<json> memTmp;
|
std::vector<json> memTmp;
|
||||||
if (_db.get(nwid, network, memTmp)) {
|
if (_db.get(nwid, network, memTmp)) {
|
||||||
members.push_back(memTmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t authorizedCount = 0;
|
uint64_t authorizedCount = 0;
|
||||||
uint64_t totalCount = memTmp.size();
|
uint64_t totalCount = memTmp.size();
|
||||||
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
|
for (auto m = memTmp.begin(); m != memTmp.end(); ++m) {
|
||||||
@ -1106,10 +1106,14 @@ void EmbeddedNetworkController::configureHTTPControlPlane(
|
|||||||
meta["totalCount"] = totalCount;
|
meta["totalCount"] = totalCount;
|
||||||
meta["authorizedCount"] = authorizedCount;
|
meta["authorizedCount"] = authorizedCount;
|
||||||
|
|
||||||
out["data"] = members;
|
out["data"] = memTmp;
|
||||||
out["meta"] = meta;
|
out["meta"] = meta;
|
||||||
|
|
||||||
setContent(req, res, out.dump());
|
setContent(req, res, out.dump());
|
||||||
|
} else {
|
||||||
|
res.status = 404;
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
s.Get(memberListPath2, memberListGet2);
|
s.Get(memberListPath2, memberListGet2);
|
||||||
sv6.Get(memberListPath2, memberListGet2);
|
sv6.Get(memberListPath2, memberListGet2);
|
||||||
|
@ -114,14 +114,14 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
// uncomment for easier debugging fprintf
|
// uncomment for easier debugging fprintf
|
||||||
// if (!ztDest) { return DOZTFILTER_ACCEPT; }
|
// if (!ztDest) { return DOZTFILTER_ACCEPT; }
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
char buf[40], buf2[40];
|
//char buf[40], buf2[40];
|
||||||
fprintf(stderr, "\nsrc %s dest %s inbound: %d ethertype %u", ztSource.toString(buf), ztDest.toString(buf2), inbound, etherType);
|
//fprintf(stderr, "\nsrc %s dest %s inbound: %d ethertype %u", ztSource.toString(buf), ztDest.toString(buf2), inbound, etherType);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for(unsigned int rn=0;rn<ruleCount;++rn) {
|
for(unsigned int rn=0;rn<ruleCount;++rn) {
|
||||||
const ZT_VirtualNetworkRuleType rt = (ZT_VirtualNetworkRuleType)(rules[rn].t & 0x3f);
|
const ZT_VirtualNetworkRuleType rt = (ZT_VirtualNetworkRuleType)(rules[rn].t & 0x3f);
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\n%02u %02d", rn, rt);
|
//fprintf(stderr, "\n%02u %02d", rn, rt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// First check if this is an ACTION
|
// First check if this is an ACTION
|
||||||
@ -135,19 +135,19 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
case ZT_NETWORK_RULE_ACTION_DROP: {
|
case ZT_NETWORK_RULE_ACTION_DROP: {
|
||||||
if (!!skipDrop) {
|
if (!!skipDrop) {
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\tskip Drop");
|
//fprintf(stderr, "\tskip Drop");
|
||||||
#endif
|
#endif
|
||||||
skipDrop = 0; continue;
|
skipDrop = 0; continue;
|
||||||
}
|
}
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\tDrop\n");
|
//fprintf(stderr, "\tDrop\n");
|
||||||
#endif
|
#endif
|
||||||
return DOZTFILTER_DROP;
|
return DOZTFILTER_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ZT_NETWORK_RULE_ACTION_ACCEPT: {
|
case ZT_NETWORK_RULE_ACTION_ACCEPT: {
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\tAccept\n");
|
//fprintf(stderr, "\tAccept\n");
|
||||||
#endif
|
#endif
|
||||||
return (superAccept ? DOZTFILTER_SUPER_ACCEPT : DOZTFILTER_ACCEPT); // match, accept packet
|
return (superAccept ? DOZTFILTER_SUPER_ACCEPT : DOZTFILTER_ACCEPT); // match, accept packet
|
||||||
}
|
}
|
||||||
@ -473,12 +473,12 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
if ((localTag != &(nconf.tags[nconf.tagCount]))&&(localTag->id() == rules[rn].v.tag.id)) {
|
if ((localTag != &(nconf.tags[nconf.tagCount]))&&(localTag->id() == rules[rn].v.tag.id)) {
|
||||||
const Tag *const remoteTag = ((membership) ? membership->getTag(nconf,rules[rn].v.tag.id) : (const Tag *)0);
|
const Tag *const remoteTag = ((membership) ? membership->getTag(nconf,rules[rn].v.tag.id) : (const Tag *)0);
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\tlocal tag [%u: %u] remote tag [%u: %u] match [%u]",
|
/*fprintf(stderr, "\tlocal tag [%u: %u] remote tag [%u: %u] match [%u]",
|
||||||
!!localTag ? localTag->id() : 0,
|
!!localTag ? localTag->id() : 0,
|
||||||
!!localTag ? localTag->value() : 0,
|
!!localTag ? localTag->value() : 0,
|
||||||
!!remoteTag ? remoteTag->id() : 0,
|
!!remoteTag ? remoteTag->id() : 0,
|
||||||
!!remoteTag ? remoteTag->value() : 0,
|
!!remoteTag ? remoteTag->value() : 0,
|
||||||
thisRuleMatches);
|
thisRuleMatches);*/
|
||||||
#endif
|
#endif
|
||||||
if (remoteTag) {
|
if (remoteTag) {
|
||||||
const uint32_t ltv = localTag->value();
|
const uint32_t ltv = localTag->value();
|
||||||
@ -501,7 +501,7 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
if ((inbound)&&(!superAccept)) {
|
if ((inbound)&&(!superAccept)) {
|
||||||
thisRuleMatches = hardNo;
|
thisRuleMatches = hardNo;
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\tinbound ");
|
//fprintf(stderr, "\tinbound ");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
// Outbound side is not strict since if we have to match both tags and
|
// Outbound side is not strict since if we have to match both tags and
|
||||||
@ -512,7 +512,7 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
skipDrop = 1;
|
skipDrop = 1;
|
||||||
thisRuleMatches = hardYes;
|
thisRuleMatches = hardYes;
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
fprintf(stderr, "\toutbound ");
|
//fprintf(stderr, "\toutbound ");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -524,13 +524,13 @@ static _doZtFilterResult _doZtFilter(
|
|||||||
case ZT_NETWORK_RULE_MATCH_TAG_RECEIVER: {
|
case ZT_NETWORK_RULE_MATCH_TAG_RECEIVER: {
|
||||||
const Tag *const localTag = std::lower_bound(&(nconf.tags[0]),&(nconf.tags[nconf.tagCount]),rules[rn].v.tag.id,Tag::IdComparePredicate());
|
const Tag *const localTag = std::lower_bound(&(nconf.tags[0]),&(nconf.tags[nconf.tagCount]),rules[rn].v.tag.id,Tag::IdComparePredicate());
|
||||||
#ifdef ZT_TRACE
|
#ifdef ZT_TRACE
|
||||||
const Tag *const remoteTag = ((membership) ? membership->getTag(nconf,rules[rn].v.tag.id) : (const Tag *)0);
|
/*const Tag *const remoteTag = ((membership) ? membership->getTag(nconf,rules[rn].v.tag.id) : (const Tag *)0);
|
||||||
fprintf(stderr, "\tlocal tag [%u: %u] remote tag [%u: %u] match [%u]",
|
fprintf(stderr, "\tlocal tag [%u: %u] remote tag [%u: %u] match [%u]",
|
||||||
!!localTag ? localTag->id() : 0,
|
!!localTag ? localTag->id() : 0,
|
||||||
!!localTag ? localTag->value() : 0,
|
!!localTag ? localTag->value() : 0,
|
||||||
!!remoteTag ? remoteTag->id() : 0,
|
!!remoteTag ? remoteTag->id() : 0,
|
||||||
!!remoteTag ? remoteTag->value() : 0,
|
!!remoteTag ? remoteTag->value() : 0,
|
||||||
thisRuleMatches);
|
thisRuleMatches);*/
|
||||||
#endif
|
#endif
|
||||||
if (superAccept) {
|
if (superAccept) {
|
||||||
skipDrop = 1;
|
skipDrop = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user