mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Circuit tests now report link quality. Also fixed a little thing in revocation propagation.
This commit is contained in:
parent
39f886ad88
commit
d79585d44d
4 changed files with 18 additions and 9 deletions
|
@ -1270,6 +1270,11 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
struct sockaddr_storage receivedFromRemoteAddress;
|
struct sockaddr_storage receivedFromRemoteAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path link quality of physical path over which test was received
|
||||||
|
*/
|
||||||
|
int receivedFromLinkQuality;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Next hops to which packets are being or will be sent by the reporter
|
* Next hops to which packets are being or will be sent by the reporter
|
||||||
*
|
*
|
||||||
|
|
|
@ -1342,7 +1342,7 @@ bool IncomingPacket::_doCIRCUIT_TEST(const RuntimeEnvironment *RR,const SharedPt
|
||||||
outp.append((uint8_t)hops());
|
outp.append((uint8_t)hops());
|
||||||
_path->localAddress().serialize(outp);
|
_path->localAddress().serialize(outp);
|
||||||
_path->address().serialize(outp);
|
_path->address().serialize(outp);
|
||||||
outp.append((uint16_t)0); // no additional fields
|
outp.append((uint16_t)_path->linkQuality());
|
||||||
outp.append((uint8_t)breadth);
|
outp.append((uint8_t)breadth);
|
||||||
for(unsigned int h=0;h<breadth;++h) {
|
for(unsigned int h=0;h<breadth;++h) {
|
||||||
nextHop[h].appendTo(outp);
|
nextHop[h].appendTo(outp);
|
||||||
|
@ -1399,16 +1399,20 @@ bool IncomingPacket::_doCIRCUIT_TEST_REPORT(const RuntimeEnvironment *RR,const S
|
||||||
|
|
||||||
const unsigned int receivedOnLocalAddressLen = reinterpret_cast<InetAddress *>(&(report.receivedOnLocalAddress))->deserialize(*this,ZT_PACKET_IDX_PAYLOAD + 58);
|
const unsigned int receivedOnLocalAddressLen = reinterpret_cast<InetAddress *>(&(report.receivedOnLocalAddress))->deserialize(*this,ZT_PACKET_IDX_PAYLOAD + 58);
|
||||||
const unsigned int receivedFromRemoteAddressLen = reinterpret_cast<InetAddress *>(&(report.receivedFromRemoteAddress))->deserialize(*this,ZT_PACKET_IDX_PAYLOAD + 58 + receivedOnLocalAddressLen);
|
const unsigned int receivedFromRemoteAddressLen = reinterpret_cast<InetAddress *>(&(report.receivedFromRemoteAddress))->deserialize(*this,ZT_PACKET_IDX_PAYLOAD + 58 + receivedOnLocalAddressLen);
|
||||||
|
unsigned int ptr = ZT_PACKET_IDX_PAYLOAD + 58 + receivedOnLocalAddressLen + receivedFromRemoteAddressLen;
|
||||||
|
if (report.protocolVersion >= 9) {
|
||||||
|
report.receivedFromLinkQuality = at<uint16_t>(ptr); ptr += 2;
|
||||||
|
} else {
|
||||||
|
report.receivedFromLinkQuality = ZT_PATH_LINK_QUALITY_MAX;
|
||||||
|
ptr += at<uint16_t>(ptr) + 2; // this field was once an 'extended field length' reserved field, which was always set to 0
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int nhptr = ZT_PACKET_IDX_PAYLOAD + 58 + receivedOnLocalAddressLen + receivedFromRemoteAddressLen;
|
report.nextHopCount = (*this)[ptr++];
|
||||||
nhptr += at<uint16_t>(nhptr) + 2; // add "additional field" length, which right now will be zero
|
|
||||||
|
|
||||||
report.nextHopCount = (*this)[nhptr++];
|
|
||||||
if (report.nextHopCount > ZT_CIRCUIT_TEST_MAX_HOP_BREADTH) // sanity check, shouldn't be possible
|
if (report.nextHopCount > ZT_CIRCUIT_TEST_MAX_HOP_BREADTH) // sanity check, shouldn't be possible
|
||||||
report.nextHopCount = ZT_CIRCUIT_TEST_MAX_HOP_BREADTH;
|
report.nextHopCount = ZT_CIRCUIT_TEST_MAX_HOP_BREADTH;
|
||||||
for(unsigned int h=0;h<report.nextHopCount;++h) {
|
for(unsigned int h=0;h<report.nextHopCount;++h) {
|
||||||
report.nextHops[h].address = Address(field(nhptr,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH).toInt(); nhptr += ZT_ADDRESS_LENGTH;
|
report.nextHops[h].address = Address(field(ptr,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH).toInt(); ptr += ZT_ADDRESS_LENGTH;
|
||||||
nhptr += reinterpret_cast<InetAddress *>(&(report.nextHops[h].physicalAddress))->deserialize(*this,nhptr);
|
ptr += reinterpret_cast<InetAddress *>(&(report.nextHops[h].physicalAddress))->deserialize(*this,ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
RR->node->postCircuitTestReport(&report);
|
RR->node->postCircuitTestReport(&report);
|
||||||
|
|
|
@ -1422,6 +1422,7 @@ Membership::AddCredentialResult Network::addCredential(const Address &sentFrom,c
|
||||||
outp.append((uint16_t)0); // no capabilities
|
outp.append((uint16_t)0); // no capabilities
|
||||||
outp.append((uint16_t)0); // no tags
|
outp.append((uint16_t)0); // no tags
|
||||||
outp.append((uint16_t)1); // one revocation!
|
outp.append((uint16_t)1); // one revocation!
|
||||||
|
outp.append((uint16_t)0); // no certificates of ownership
|
||||||
rev.serialize(outp);
|
rev.serialize(outp);
|
||||||
RR->sw->send(outp,true);
|
RR->sw->send(outp,true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1041,8 +1041,7 @@ public:
|
||||||
* <[1] 8-bit packet hop count of received CIRCUIT_TEST>
|
* <[1] 8-bit packet hop count of received CIRCUIT_TEST>
|
||||||
* <[...] local wire address on which packet was received>
|
* <[...] local wire address on which packet was received>
|
||||||
* <[...] remote wire address from which packet was received>
|
* <[...] remote wire address from which packet was received>
|
||||||
* <[2] 16-bit length of additional fields>
|
* <[2] 16-bit path link quality of path over which packet was received>
|
||||||
* <[...] additional fields>
|
|
||||||
* <[1] 8-bit number of next hops (breadth)>
|
* <[1] 8-bit number of next hops (breadth)>
|
||||||
* <[...] next hop information>
|
* <[...] next hop information>
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue