This commit is contained in:
Adam Ierymenko 2020-03-02 14:41:15 -08:00
parent 51f0882849
commit fbd3e10488
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
2 changed files with 13 additions and 7 deletions

View file

@ -46,7 +46,13 @@ public:
ZT_ALWAYS_INLINE Address address() const noexcept { return Address(_fp.address); } ZT_ALWAYS_INLINE Address address() const noexcept { return Address(_fp.address); }
ZT_ALWAYS_INLINE const uint8_t *hash() const noexcept { return _fp.hash; } ZT_ALWAYS_INLINE const uint8_t *hash() const noexcept { return _fp.hash; }
ZT_ALWAYS_INLINE void setZTFingerprint(ZT_Fingerprint *fp) const noexcept { memcpy(fp,&_fp,sizeof(ZT_Fingerprint)); }
/**
* Copy into ZT_Fingerprint struct as used in API and trace messages
*
* @param fp ZT_Fingerprint
*/
ZT_ALWAYS_INLINE void getAPIFingerprint(ZT_Fingerprint *fp) const noexcept { memcpy(fp,&_fp,sizeof(ZT_Fingerprint)); }
ZT_ALWAYS_INLINE void zero() noexcept { memoryZero(this); } ZT_ALWAYS_INLINE void zero() noexcept { memoryZero(this); }
ZT_ALWAYS_INLINE unsigned long hashCode() const noexcept { return _fp.address; } ZT_ALWAYS_INLINE unsigned long hashCode() const noexcept { return _fp.address; }

View file

@ -116,12 +116,12 @@ void Trace::_tryingNewPath(
ev.evSize = ZT_CONST_TO_BE_UINT16(sizeof(ev)); ev.evSize = ZT_CONST_TO_BE_UINT16(sizeof(ev));
ev.evType = ZT_CONST_TO_BE_UINT16(ZT_TRACE_VL1_TRYING_NEW_PATH); ev.evType = ZT_CONST_TO_BE_UINT16(ZT_TRACE_VL1_TRYING_NEW_PATH);
ev.codeLocation = Utils::hton(codeLocation); ev.codeLocation = Utils::hton(codeLocation);
trying.fingerprint().setZTFingerprint(&ev.peer); trying.fingerprint().getAPIFingerprint(&ev.peer);
physicalAddress.forTrace(ev.physicalAddress); physicalAddress.forTrace(ev.physicalAddress);
triggerAddress.forTrace(ev.triggerAddress); triggerAddress.forTrace(ev.triggerAddress);
ev.triggeringPacketId = triggeringPacketId; ev.triggeringPacketId = triggeringPacketId;
ev.triggeringPacketVerb = triggeringPacketVerb; ev.triggeringPacketVerb = triggeringPacketVerb;
triggeringPeer.fingerprint().setZTFingerprint(&ev.triggeringPeer); triggeringPeer.fingerprint().getAPIFingerprint(&ev.triggeringPeer);
ev.reason = (uint8_t)reason; ev.reason = (uint8_t)reason;
RR->node->postEvent(tPtr,ZT_EVENT_TRACE,&ev); RR->node->postEvent(tPtr,ZT_EVENT_TRACE,&ev);
} }
@ -139,7 +139,7 @@ void Trace::_learnedNewPath(
ev.evType = ZT_CONST_TO_BE_UINT16(ZT_TRACE_VL1_LEARNED_NEW_PATH); ev.evType = ZT_CONST_TO_BE_UINT16(ZT_TRACE_VL1_LEARNED_NEW_PATH);
ev.codeLocation = Utils::hton(codeLocation); ev.codeLocation = Utils::hton(codeLocation);
ev.packetId = packetId; // packet IDs are kept in big-endian ev.packetId = packetId; // packet IDs are kept in big-endian
peerIdentity.fingerprint().setZTFingerprint(&ev.peer); peerIdentity.fingerprint().getAPIFingerprint(&ev.peer);
physicalAddress.forTrace(ev.physicalAddress); physicalAddress.forTrace(ev.physicalAddress);
replaced.forTrace(ev.replaced); replaced.forTrace(ev.replaced);
@ -163,7 +163,7 @@ void Trace::_incomingPacketDropped(
ev.codeLocation = Utils::hton(codeLocation); ev.codeLocation = Utils::hton(codeLocation);
ev.packetId = packetId; // packet IDs are kept in big-endian ev.packetId = packetId; // packet IDs are kept in big-endian
ev.networkId = Utils::hton(networkId); ev.networkId = Utils::hton(networkId);
peerIdentity.fingerprint().setZTFingerprint(&ev.peer); peerIdentity.fingerprint().getAPIFingerprint(&ev.peer);
physicalAddress.forTrace(ev.physicalAddress); physicalAddress.forTrace(ev.physicalAddress);
ev.hops = hops; ev.hops = hops;
ev.verb = verb; ev.verb = verb;
@ -226,7 +226,7 @@ void Trace::_incomingNetworkFrameDropped(
ev.networkId = Utils::hton(networkId); ev.networkId = Utils::hton(networkId);
ev.sourceMac = Utils::hton(sourceMac.toInt()); ev.sourceMac = Utils::hton(sourceMac.toInt());
ev.destMac = Utils::hton(destMac.toInt()); ev.destMac = Utils::hton(destMac.toInt());
peerIdentity.fingerprint().setZTFingerprint(&ev.sender); peerIdentity.fingerprint().getAPIFingerprint(&ev.sender);
physicalAddress.forTrace(ev.physicalAddress); physicalAddress.forTrace(ev.physicalAddress);
ev.hops = hops; ev.hops = hops;
ev.frameLength = Utils::hton(frameLength); ev.frameLength = Utils::hton(frameLength);
@ -325,7 +325,7 @@ void Trace::_credentialRejected(
ev.codeLocation = Utils::hton(codeLocation); ev.codeLocation = Utils::hton(codeLocation);
ev.networkId = Utils::hton(networkId); ev.networkId = Utils::hton(networkId);
if (identity) { if (identity) {
identity.fingerprint().setZTFingerprint(&ev.peer); identity.fingerprint().getAPIFingerprint(&ev.peer);
} else { } else {
ev.peer.address = address.toInt(); ev.peer.address = address.toInt();
memset(ev.peer.hash,0,sizeof(ev.peer.hash)); memset(ev.peer.hash,0,sizeof(ev.peer.hash));