|
|
@@ -143,7 +143,7 @@ void Switch::onRemotePacket(void* tPtr, const int64_t localSocket, const InetAdd
|
|
|
rq->frag0.append(rq->frags[f - 1].payload(), rq->frags[f - 1].payloadLength());
|
|
|
}
|
|
|
|
|
|
- if (rq->frag0.tryDecode(RR,tPtr,flowId)) {
|
|
|
+ if (rq->frag0.tryDecode(RR, tPtr, flowId)) {
|
|
|
rq->timestamp = 0; // packet decoded, free entry
|
|
|
} else {
|
|
|
rq->complete = true; // set complete flag but leave entry since it probably needs WHOIS or something
|
|
|
@@ -278,9 +278,7 @@ void Switch::onLocalEthernet(void* tPtr, const SharedPtr<Network>& network, cons
|
|
|
}
|
|
|
|
|
|
// VL2 fragmentation metric: oversized frame from TAP device (TX)
|
|
|
- unsigned int tap_mtu = network->config().mtu;
|
|
|
- bool was_fragmented_at_vl2 = (len > tap_mtu);
|
|
|
- if (was_fragmented_at_vl2) {
|
|
|
+ if (len > network->config().mtu) {
|
|
|
Metrics::vl2_oversized_frame_tx++;
|
|
|
// Just measure, do not drop or return
|
|
|
return;
|
|
|
@@ -974,8 +972,8 @@ void Switch::doAnythingWaitingForPeer(void* tPtr, const SharedPtr<Peer>& peer)
|
|
|
for (unsigned int ptr = 0; ptr < ZT_RX_QUEUE_SIZE; ++ptr) {
|
|
|
RXQueueEntry* const rq = &(_rxQueue[ptr]);
|
|
|
Mutex::Lock rql(rq->lock);
|
|
|
- if ((rq->timestamp)&&(rq->complete)) {
|
|
|
- if ((rq->frag0.tryDecode(RR, tPtr, rq->flowId))||((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT)) {
|
|
|
+ if ((rq->timestamp) && (rq->complete)) {
|
|
|
+ if ((rq->frag0.tryDecode(RR, tPtr, rq->flowId)) || ((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT)) {
|
|
|
rq->timestamp = 0;
|
|
|
if ((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT) {
|
|
|
Metrics::vl1_incomplete_reassembly_rx++;
|
|
|
@@ -1041,8 +1039,8 @@ unsigned long Switch::doTimerTasks(void* tPtr, int64_t now)
|
|
|
for (unsigned int ptr = 0; ptr < ZT_RX_QUEUE_SIZE; ++ptr) {
|
|
|
RXQueueEntry* const rq = &(_rxQueue[ptr]);
|
|
|
Mutex::Lock rql(rq->lock);
|
|
|
- if ((rq->timestamp)&&(rq->complete)) {
|
|
|
- if ((rq->frag0.tryDecode(RR, tPtr, rq->flowId))||((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT)) {
|
|
|
+ if ((rq->timestamp) && (rq->complete)) {
|
|
|
+ if ((rq->frag0.tryDecode(RR, tPtr, rq->flowId)) || ((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT)) {
|
|
|
rq->timestamp = 0;
|
|
|
if ((now - rq->timestamp) > ZT_RECEIVE_QUEUE_TIMEOUT) {
|
|
|
Metrics::vl1_incomplete_reassembly_rx++;
|
|
|
@@ -1135,7 +1133,7 @@ bool Switch::_trySend(void* tPtr, Packet& packet, bool encrypt, int32_t flowId)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-void Switch::_sendViaSpecificPath(void* tPtr, SharedPtr<Peer> peer, SharedPtr<Path> viaPath, uint16_t userSpecifiedMtu, int64_t now, Packet& packet, bool encrypt, int32_t flowId, bool was_fragmented_at_vl2)
|
|
|
+void Switch::_sendViaSpecificPath(void* tPtr, SharedPtr<Peer> peer, SharedPtr<Path> viaPath, uint16_t userSpecifiedMtu, int64_t now, Packet& packet, bool encrypt, int32_t flowId, bool fragmentedAtVl2)
|
|
|
{
|
|
|
unsigned int mtu = ZT_DEFAULT_PHYSMTU;
|
|
|
uint64_t trustedPathId = 0;
|
|
|
@@ -1163,7 +1161,7 @@ void Switch::_sendViaSpecificPath(void* tPtr, SharedPtr<Peer> peer, SharedPtr<Pa
|
|
|
if (chunkSize < packet.size()) {
|
|
|
// Too big for one packet, fragment the rest
|
|
|
Metrics::vl1_fragments_per_packet_hist.Observe(2);
|
|
|
- if (was_fragmented_at_vl2) {
|
|
|
+ if (fragmentedAtVl2) {
|
|
|
Metrics::vl1_vl2_double_fragmentation_tx++;
|
|
|
}
|
|
|
|