mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-13 02:36:54 +02:00
A few more uint64_t -> int64_t changes for timestamps
This commit is contained in:
parent
4177a11522
commit
099bedd2e9
6 changed files with 17 additions and 17 deletions
|
@ -85,7 +85,7 @@ public:
|
|||
* @param rules Network flow rules for this capability
|
||||
* @param ruleCount Number of flow rules
|
||||
*/
|
||||
Capability(uint32_t id,uint64_t nwid,uint64_t ts,unsigned int mccl,const ZT_VirtualNetworkRule *rules,unsigned int ruleCount)
|
||||
Capability(uint32_t id,uint64_t nwid,int64_t ts,unsigned int mccl,const ZT_VirtualNetworkRule *rules,unsigned int ruleCount)
|
||||
{
|
||||
memset(this,0,sizeof(Capability));
|
||||
_nwid = nwid;
|
||||
|
@ -120,7 +120,7 @@ public:
|
|||
/**
|
||||
* @return Timestamp
|
||||
*/
|
||||
inline uint64_t timestamp() const { return _ts; }
|
||||
inline int64_t timestamp() const { return _ts; }
|
||||
|
||||
/**
|
||||
* @return Last 'to' address in chain of custody
|
||||
|
@ -460,7 +460,7 @@ public:
|
|||
|
||||
private:
|
||||
uint64_t _nwid;
|
||||
uint64_t _ts;
|
||||
int64_t _ts;
|
||||
uint32_t _id;
|
||||
|
||||
unsigned int _maxCustodyChainLength;
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
memset(this,0,sizeof(CertificateOfOwnership));
|
||||
}
|
||||
|
||||
CertificateOfOwnership(const uint64_t nwid,const uint64_t ts,const Address &issuedTo,const uint32_t id) :
|
||||
CertificateOfOwnership(const uint64_t nwid,const int64_t ts,const Address &issuedTo,const uint32_t id) :
|
||||
_networkId(nwid),
|
||||
_ts(ts),
|
||||
_flags(0),
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
}
|
||||
|
||||
inline uint64_t networkId() const { return _networkId; }
|
||||
inline uint64_t timestamp() const { return _ts; }
|
||||
inline int64_t timestamp() const { return _ts; }
|
||||
inline uint32_t id() const { return _id; }
|
||||
inline unsigned int thingCount() const { return (unsigned int)_thingCount; }
|
||||
|
||||
|
@ -231,7 +231,7 @@ private:
|
|||
bool _owns(const Thing &t,const void *v,unsigned int l) const;
|
||||
|
||||
uint64_t _networkId;
|
||||
uint64_t _ts;
|
||||
int64_t _ts;
|
||||
uint64_t _flags;
|
||||
uint32_t _id;
|
||||
uint16_t _thingCount;
|
||||
|
|
|
@ -155,7 +155,7 @@ Membership::AddCredentialResult Membership::addCredential(const RuntimeEnvironme
|
|||
|
||||
// Template out addCredential() for many cred types to avoid copypasta
|
||||
template<typename C>
|
||||
static Membership::AddCredentialResult _addCredImpl(Hashtable<uint32_t,C> &remoteCreds,const Hashtable<uint64_t,uint64_t> &revocations,const RuntimeEnvironment *RR,void *tPtr,const NetworkConfig &nconf,const C &cred)
|
||||
static Membership::AddCredentialResult _addCredImpl(Hashtable<uint32_t,C> &remoteCreds,const Hashtable<uint64_t,int64_t> &revocations,const RuntimeEnvironment *RR,void *tPtr,const NetworkConfig &nconf,const C &cred)
|
||||
{
|
||||
C *rc = remoteCreds.get(cred.id());
|
||||
if (rc) {
|
||||
|
@ -167,7 +167,7 @@ static Membership::AddCredentialResult _addCredImpl(Hashtable<uint32_t,C> &remot
|
|||
return Membership::ADD_ACCEPTED_REDUNDANT;
|
||||
}
|
||||
|
||||
const uint64_t *const rt = revocations.get(Membership::credentialKey(C::credentialType(),cred.id()));
|
||||
const int64_t *const rt = revocations.get(Membership::credentialKey(C::credentialType(),cred.id()));
|
||||
if ((rt)&&(*rt >= cred.timestamp())) {
|
||||
RR->t->credentialRejected(tPtr,cred,"revoked");
|
||||
return Membership::ADD_REJECTED;
|
||||
|
@ -193,7 +193,7 @@ Membership::AddCredentialResult Membership::addCredential(const RuntimeEnvironme
|
|||
|
||||
Membership::AddCredentialResult Membership::addCredential(const RuntimeEnvironment *RR,void *tPtr,const NetworkConfig &nconf,const Revocation &rev)
|
||||
{
|
||||
uint64_t *rt;
|
||||
int64_t *rt;
|
||||
switch(rev.verify(RR,tPtr)) {
|
||||
default:
|
||||
RR->t->credentialRejected(tPtr,rev,"invalid");
|
||||
|
|
|
@ -202,9 +202,9 @@ private:
|
|||
template<typename C>
|
||||
inline bool _isCredentialTimestampValid(const NetworkConfig &nconf,const C &remoteCredential) const
|
||||
{
|
||||
const uint64_t ts = remoteCredential.timestamp();
|
||||
const int64_t ts = remoteCredential.timestamp();
|
||||
if (((ts >= nconf.timestamp) ? (ts - nconf.timestamp) : (nconf.timestamp - ts)) <= nconf.credentialTimeMaxDelta) {
|
||||
const uint64_t *threshold = _revocations.get(credentialKey(C::credentialType(),remoteCredential.id()));
|
||||
const int64_t *threshold = _revocations.get(credentialKey(C::credentialType(),remoteCredential.id()));
|
||||
return ((!threshold)||(ts > *threshold));
|
||||
}
|
||||
return false;
|
||||
|
@ -235,7 +235,7 @@ private:
|
|||
CertificateOfMembership _com;
|
||||
|
||||
// Revocations by credentialKey()
|
||||
Hashtable< uint64_t,uint64_t > _revocations;
|
||||
Hashtable< uint64_t,int64_t > _revocations;
|
||||
|
||||
// Remote credentials that we have received from this member (and that are valid)
|
||||
Hashtable< uint32_t,Tag > _remoteTags;
|
||||
|
|
|
@ -418,12 +418,12 @@ public:
|
|||
/**
|
||||
* Controller-side time of config generation/issue
|
||||
*/
|
||||
uint64_t timestamp;
|
||||
int64_t timestamp;
|
||||
|
||||
/**
|
||||
* Max difference between timestamp and tag/capability timestamp
|
||||
*/
|
||||
uint64_t credentialTimeMaxDelta;
|
||||
int64_t credentialTimeMaxDelta;
|
||||
|
||||
/**
|
||||
* Controller-side revision counter for this configuration
|
||||
|
|
|
@ -77,7 +77,7 @@ public:
|
|||
* @param id Tag ID
|
||||
* @param value Tag value
|
||||
*/
|
||||
Tag(const uint64_t nwid,const uint64_t ts,const Address &issuedTo,const uint32_t id,const uint32_t value) :
|
||||
Tag(const uint64_t nwid,const int64_t ts,const Address &issuedTo,const uint32_t id,const uint32_t value) :
|
||||
_id(id),
|
||||
_value(value),
|
||||
_networkId(nwid),
|
||||
|
@ -90,7 +90,7 @@ public:
|
|||
inline uint32_t id() const { return _id; }
|
||||
inline const uint32_t &value() const { return _value; }
|
||||
inline uint64_t networkId() const { return _networkId; }
|
||||
inline uint64_t timestamp() const { return _ts; }
|
||||
inline int64_t timestamp() const { return _ts; }
|
||||
inline const Address &issuedTo() const { return _issuedTo; }
|
||||
inline const Address &signedBy() const { return _signedBy; }
|
||||
|
||||
|
@ -199,7 +199,7 @@ private:
|
|||
uint32_t _id;
|
||||
uint32_t _value;
|
||||
uint64_t _networkId;
|
||||
uint64_t _ts;
|
||||
int64_t _ts;
|
||||
Address _issuedTo;
|
||||
Address _signedBy;
|
||||
C25519::Signature _signature;
|
||||
|
|
Loading…
Add table
Reference in a new issue