mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 00:23:58 +00:00
Cleanup and replace trace field names with sane ones because usability > a few bytes.
This commit is contained in:
parent
727ccb1125
commit
ae65eb5105
@ -1087,6 +1087,9 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
|
||||
|
||||
void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
{
|
||||
static volatile unsigned long idCounter = 0;
|
||||
|
||||
char id[128];
|
||||
try {
|
||||
std::vector<uint64_t> nw4m(_db.networksForMember(rt.origin));
|
||||
|
||||
@ -1135,6 +1138,10 @@ void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
}
|
||||
}
|
||||
|
||||
OSUtils::ztsnprintf(id,sizeof(id),"%.10llx-%.10llx-%.16llx-%.8lx",_signingId.address().toInt(),rt.origin,OSUtils::now(),++idCounter);
|
||||
d["id"] = id;
|
||||
d["objtype"] = "trace";
|
||||
|
||||
bool accept = true;
|
||||
/*
|
||||
for(std::vector<uint64_t>::const_iterator nwid(nw4m.begin());nwid!=nw4m.end();++nwid) {
|
||||
@ -1159,7 +1166,7 @@ void EmbeddedNetworkController::handleRemoteTrace(const ZT_RemoteTrace &rt)
|
||||
*/
|
||||
if (accept) {
|
||||
char p[128];
|
||||
OSUtils::ztsnprintf(p,sizeof(p),"trace/%.10llx-%.10llx-%.16llx",_signingId.address().toInt(),rt.origin,OSUtils::now());
|
||||
OSUtils::ztsnprintf(p,sizeof(p),"trace/%s",id);
|
||||
_db.writeRaw(p,OSUtils::jsonDump(d));
|
||||
}
|
||||
} catch ( ... ) {
|
||||
|
@ -334,6 +334,7 @@ void JSONDB::threadMain()
|
||||
rawInputBuf.clear();
|
||||
}
|
||||
}
|
||||
continue; // we only want to do the stuff below this every few dozen ms or so, so pause again
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -258,42 +258,42 @@ extern "C" {
|
||||
#define ZT_RULE_PACKET_CHARACTERISTICS_TCP_FIN 0x0000000000000001ULL
|
||||
|
||||
// Fields in remote trace dictionaries
|
||||
#define ZT_REMOTE_TRACE_FIELD__EVENT "E"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_ID "pid"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_VERB "pv"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_TRUSTED_PATH_ID "ptpid"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_TRUSTED_PATH_APPROVED "ptpok"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_HOPS "phops"
|
||||
#define ZT_REMOTE_TRACE_FIELD__OLD_REMOTE_PHYADDR "oldrphy"
|
||||
#define ZT_REMOTE_TRACE_FIELD__REMOTE_ZTADDR "rzt"
|
||||
#define ZT_REMOTE_TRACE_FIELD__REMOTE_PHYADDR "rphy"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_ZTADDR "lzt"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_PHYADDR "lphy"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_SOCKET "ls"
|
||||
#define ZT_REMOTE_TRACE_FIELD__IP_SCOPE "ipsc"
|
||||
#define ZT_REMOTE_TRACE_FIELD__NETWORK_ID "nwid"
|
||||
#define ZT_REMOTE_TRACE_FIELD__SOURCE_ZTADDR "szt"
|
||||
#define ZT_REMOTE_TRACE_FIELD__DEST_ZTADDR "dzt"
|
||||
#define ZT_REMOTE_TRACE_FIELD__SOURCE_MAC "seth"
|
||||
#define ZT_REMOTE_TRACE_FIELD__DEST_MAC "deth"
|
||||
#define ZT_REMOTE_TRACE_FIELD__ETHERTYPE "et"
|
||||
#define ZT_REMOTE_TRACE_FIELD__VLAN_ID "vlan"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FRAME_LENGTH "fl"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FRAME_DATA "fd"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_FLAG_NOTEE "ffnotee"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_FLAG_INBOUND "ffdir"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_RESULT "fresult"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_BASE_RULE_LOG "frlog"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_CAP_RULE_LOG "fclog"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_CAP_ID "fcid"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_TYPE "crtype"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_ID "crid"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_TIMESTAMP "crts"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_INFO "crinfo"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_ISSUED_TO "criss"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_REVOCATION_TARGET "crrevt"
|
||||
#define ZT_REMOTE_TRACE_FIELD__EVENT "event"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_ID "packetId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_VERB "packetVerb"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_TRUSTED_PATH_ID "packetTrustedPathId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_TRUSTED_PATH_APPROVED "packetTrustedPathApproved"
|
||||
#define ZT_REMOTE_TRACE_FIELD__PACKET_HOPS "packetHops"
|
||||
#define ZT_REMOTE_TRACE_FIELD__OLD_REMOTE_PHYADDR "oldRemotePhyAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__REMOTE_ZTADDR "remoteZtAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__REMOTE_PHYADDR "remotePhyAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_ZTADDR "localZtAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_PHYADDR "localPhyAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__LOCAL_SOCKET "localSocket"
|
||||
#define ZT_REMOTE_TRACE_FIELD__IP_SCOPE "phyAddrIpScope"
|
||||
#define ZT_REMOTE_TRACE_FIELD__NETWORK_ID "networkId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__SOURCE_ZTADDR "sourceZtAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__DEST_ZTADDR "destZtAddr"
|
||||
#define ZT_REMOTE_TRACE_FIELD__SOURCE_MAC "sourceMac"
|
||||
#define ZT_REMOTE_TRACE_FIELD__DEST_MAC "destMac"
|
||||
#define ZT_REMOTE_TRACE_FIELD__ETHERTYPE "etherType"
|
||||
#define ZT_REMOTE_TRACE_FIELD__VLAN_ID "vlanId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FRAME_LENGTH "frameLength"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FRAME_DATA "frameData"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_FLAG_NOTEE "filterNoTee"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_FLAG_INBOUND "filterInbound"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_RESULT "filterResult"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_BASE_RULE_LOG "filterBaseRuleLog"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_CAP_RULE_LOG "filterCapRuleLog"
|
||||
#define ZT_REMOTE_TRACE_FIELD__FILTER_CAP_ID "filterMatchingCapId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_TYPE "credType"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_ID "credId"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_TIMESTAMP "credTs"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_INFO "credInfo"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_ISSUED_TO "credIssuedTo"
|
||||
#define ZT_REMOTE_TRACE_FIELD__CREDENTIAL_REVOCATION_TARGET "credRevocationTarget"
|
||||
#define ZT_REMOTE_TRACE_FIELD__REASON "reason"
|
||||
#define ZT_REMOTE_TRACE_FIELD__NETWORK_CONTROLLER_ID "nwctrl"
|
||||
#define ZT_REMOTE_TRACE_FIELD__NETWORK_CONTROLLER_ID "networkControllerId"
|
||||
|
||||
// Event types in remote traces
|
||||
#define ZT_REMOTE_TRACE_EVENT__RESETTING_PATHS_IN_SCOPE 0x1000
|
||||
|
Loading…
x
Reference in New Issue
Block a user