mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Little fixes.
This commit is contained in:
parent
4729fec2eb
commit
1cadbfb4d1
1 changed files with 6 additions and 5 deletions
|
@ -60,6 +60,7 @@ using json = nlohmann::json;
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
// Get JSON values as unsigned integers, strings, or booleans, doing type conversion if possible
|
||||||
static uint64_t _jI(const json &jv,const uint64_t dfl)
|
static uint64_t _jI(const json &jv,const uint64_t dfl)
|
||||||
{
|
{
|
||||||
if (jv.is_number()) {
|
if (jv.is_number()) {
|
||||||
|
@ -97,7 +98,9 @@ static std::string _jS(const json &jv,const char *dfl)
|
||||||
if (jv.is_string()) {
|
if (jv.is_string()) {
|
||||||
return jv;
|
return jv;
|
||||||
} else if (jv.is_number()) {
|
} else if (jv.is_number()) {
|
||||||
return jv;
|
char tmp[64];
|
||||||
|
Utils::snprintf(tmp,sizeof(tmp),"%llu",(uint64_t)jv);
|
||||||
|
return tmp;
|
||||||
} else if (jv.is_boolean()) {
|
} else if (jv.is_boolean()) {
|
||||||
return ((bool)jv ? std::string("1") : std::string("0"));
|
return ((bool)jv ? std::string("1") : std::string("0"));
|
||||||
}
|
}
|
||||||
|
@ -603,6 +606,7 @@ NetworkController::ResultCode EmbeddedNetworkController::doNetworkConfigRequest(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ipAssignments = json::array();
|
ipAssignments = json::array();
|
||||||
|
member["ipAssignments"] = ipAssignments;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (ipAssignmentPools.is_array()) && ((v6AssignMode.is_object())&&(_jB(v6AssignMode["zt"],false))) && (!haveManagedIpv6AutoAssignment) && (!_jB(member["activeBridge"],false)) ) {
|
if ( (ipAssignmentPools.is_array()) && ((v6AssignMode.is_object())&&(_jB(v6AssignMode["zt"],false))) && (!haveManagedIpv6AutoAssignment) && (!_jB(member["activeBridge"],false)) ) {
|
||||||
|
@ -785,10 +789,7 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpGET(
|
||||||
responseBody.append((responseBody.length() == 1) ? "\"" : ",\"");
|
responseBody.append((responseBody.length() == 1) ? "\"" : ",\"");
|
||||||
responseBody.append(*i);
|
responseBody.append(*i);
|
||||||
responseBody.append("\":");
|
responseBody.append("\":");
|
||||||
auto rev = member["revision"];
|
responseBody.append(_jS(member["revision"],"0"));
|
||||||
if (rev.is_number())
|
|
||||||
responseBody.append(rev);
|
|
||||||
else responseBody.push_back('0');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue