Account for transmission IDs in MTU and packet diagnostics
This commit is contained in:
1 parent
cc510fc74c
commit
1b3c4552fb
3 files changed
+6
-6
No files matched your search
@@ -1674,7 +1674,7 @@ void etcp_update_mtu(struct ETCP_CONN* etcp) {
|
||||
int max_udp = IP_UDP_OVERHEAD_V4;
|
||||
for (struct ETCP_LINK* l = etcp->links; l; l = l->next)
|
||||
if (l->remote_addr.ss_family == AF_INET6) max_udp = IP_UDP_OVERHEAD_V6;
|
||||
etcp->normalizer->frag_size = etcp->mtu - ACK_REZERV - max_udp - UDP_SC_HDR_SIZE - ETCP_SESSION_HEADER_SIZE;
|
||||
etcp->normalizer->frag_size = etcp->mtu - max_udp - SC_ENCRYPT_OVERHEAD - ETCP_PAYLOAD_HEADER_SIZE - ACK_REZERV;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* link, int
|
||||
((uint32_t)data[offset + 4] << 16) | ((uint32_t)data[offset + 5] << 24);
|
||||
uint16_t ack_rx_dup = data[offset + 6] | (data[offset + 7] << 8);
|
||||
pos += snprintf(buf + pos, sizeof(buf) - pos, " ack=%u/%d dup=%u", ack_last_delivered, ack_count, ack_rx_dup);
|
||||
offset += 8 + ack_count * 8;
|
||||
offset += ETCP_ACK_BASE_SIZE + ack_count * ETCP_ACK_ENTRY_SIZE;
|
||||
break;
|
||||
}
|
||||
case ETCP_SECTION_TIMESTAMP: {
|
||||
@@ -60,10 +60,10 @@ void etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* link, int
|
||||
break;
|
||||
}
|
||||
case ETCP_SECTION_PAYLOAD: {
|
||||
if (offset + 5 > len) { offset = len; break; }
|
||||
if (offset + ETCP_PAYLOAD_HEADER_SIZE > len) { offset = len; break; }
|
||||
payload_seq = (uint32_t)data[offset + 1] | ((uint32_t)data[offset + 2] << 8) |
|
||||
((uint32_t)data[offset + 3] << 16) | ((uint32_t)data[offset + 4] << 24);
|
||||
payload_size = len - offset - 5;
|
||||
payload_size = len - offset - ETCP_PAYLOAD_HEADER_SIZE;
|
||||
has_payload = 1;
|
||||
pos += snprintf(buf + pos, sizeof(buf) - pos, " payload=%u(seq=%u)", payload_size, payload_seq);
|
||||
offset = len;
|
||||
|
||||
@@ -42,8 +42,8 @@ struct PKTNORM* pn_init(struct ETCP_CONN* etcp) {
|
||||
int max_udp = IP_UDP_OVERHEAD_V4;
|
||||
for (struct ETCP_LINK* l = etcp->links; l; l = l->next)
|
||||
if (l->remote_addr.ss_family == AF_INET6) max_udp = IP_UDP_OVERHEAD_V6;
|
||||
pn->frag_size = etcp->mtu - ACK_REZERV - max_udp - UDP_SC_HDR_SIZE - ETCP_SESSION_HEADER_SIZE;
|
||||
int min_frag = max_udp + UDP_SC_HDR_SIZE + ACK_REZERV;
|
||||
pn->frag_size = etcp->mtu - max_udp - SC_ENCRYPT_OVERHEAD - ETCP_PAYLOAD_HEADER_SIZE - ACK_REZERV;
|
||||
int min_frag = max_udp + SC_ENCRYPT_OVERHEAD + ETCP_PAYLOAD_HEADER_SIZE + ACK_REZERV;
|
||||
if (etcp->mtu < min_frag || pn->frag_size > etcp->mtu) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "MTU %d too small (min %d)", etcp->mtu, min_frag);
|
||||
pn->frag_size = etcp->mtu;
|
||||
|
||||
Reference in new issue
Block a user