Adam Ierymenko 5 years ago
parent
commit
fbd3e10488
2 changed files with 13 additions and 7 deletions
  1. 7 1
      node/Fingerprint.hpp
  2. 6 6
      node/Trace.cpp

+ 7 - 1
node/Fingerprint.hpp

@@ -46,7 +46,13 @@ public:
 
 	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 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 unsigned long hashCode() const noexcept { return _fp.address; }

+ 6 - 6
node/Trace.cpp

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