Update encrypted session fixtures and multipath observation for attempt IDs
This commit is contained in:
1 parent
75485bf7bf
commit
34a31f63be
2 files changed
+18
-11
No files matched your search
@@ -91,13 +91,14 @@ void __wrap_etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* lin
|
||||
const uint8_t* data = pkt->data + offset;
|
||||
unsigned remaining = pkt->data_len - offset, len;
|
||||
switch (data[0]) {
|
||||
case ETCP_SECTION_ACK: CHECK(remaining >= 8); len = 8 + 8 * data[1]; break;
|
||||
case ETCP_SECTION_ACK: CHECK(remaining >= ETCP_ACK_BASE_SIZE); len = ETCP_ACK_BASE_SIZE + ETCP_ACK_ENTRY_SIZE * data[1]; break;
|
||||
case ETCP_SECTION_ACK_REQUEST: len = 1; break;
|
||||
case ETCP_SECTION_TIMESTAMP: len = 5; break;
|
||||
case ETCP_SECTION_MEAS_TS: len = 9; break;
|
||||
case ETCP_SECTION_MEAS_RESP: len = 13; break;
|
||||
case ETCP_SECTION_FILLER: CHECK(remaining >= 3); len = 3 + data[1] + (data[2] << 8); break;
|
||||
case ETCP_SECTION_PAYLOAD: {
|
||||
CHECK(remaining >= 5);
|
||||
CHECK(remaining >= ETCP_PAYLOAD_HEADER_SIZE);
|
||||
uint32_t seq = (uint32_t)data[1] | ((uint32_t)data[2] << 8) | ((uint32_t)data[3] << 16) | ((uint32_t)data[4] << 24);
|
||||
CHECK(seq < TRACE_COUNT);
|
||||
struct trace* trace = &traces[sending ? side : 1-side][seq];
|
||||
@@ -105,10 +106,10 @@ void __wrap_etcp_dump_pkt_sections(struct ETCP_DGRAM* pkt, struct ETCP_LINK* lin
|
||||
if (sending) {
|
||||
if (trace->attempts++ && measuring) traffic[side][path].retries++;
|
||||
if (!trace->first_tx) { trace->first_tx = now; trace->first_path = path; }
|
||||
if (measuring) traffic[side][path].data += remaining - 5;
|
||||
if (measuring) traffic[side][path].data += remaining - ETCP_PAYLOAD_HEADER_SIZE;
|
||||
} else if (!trace->first_rx) {
|
||||
trace->first_rx = now;
|
||||
if (measuring) traffic[1-side][path].rx_unique += remaining - 5;
|
||||
if (measuring) traffic[1-side][path].rx_unique += remaining - ETCP_PAYLOAD_HEADER_SIZE;
|
||||
}
|
||||
if (fault_start && (seq == fault_seq || (sending && trace->attempts > 1 && fault_trace_count++ < 32)))
|
||||
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "FAULT trace dir=%d seq=%u path=%d tx=%d attempts=%u elapsed_us=%llu", side,
|
||||
|
||||
@@ -36,7 +36,7 @@ static void capture_dump(int level, const char* category, const char* message) {
|
||||
// ACK/payload должны корректно декодировать все 32 бита, включая границу знакового int.
|
||||
static void debug_sequence_boundaries(void) {
|
||||
const uint32_t values[] = {0, 1, 0x7f000000, 0x7fffffff, 0x80000000, 0xff000000, UINT32_MAX};
|
||||
struct ETCP_DGRAM* pkt = u_calloc(1, sizeof(*pkt) + ETCP_ACK_BASE_SIZE); CHECK(pkt);
|
||||
struct ETCP_DGRAM* pkt = u_calloc(1, sizeof(*pkt) + ETCP_PAYLOAD_HEADER_SIZE); CHECK(pkt);
|
||||
debug_level_t saved = g_debug_config.category_levels[DEBUG_CATEGORY_DUMP];
|
||||
int console = g_debug_config.console_enabled;
|
||||
debug_set_category_level(DEBUG_CATEGORY_DUMP, DEBUG_LEVEL_DEBUG);
|
||||
@@ -44,9 +44,9 @@ static void debug_sequence_boundaries(void) {
|
||||
debug_set_log_hook(capture_dump);
|
||||
for (unsigned i = 0; i < sizeof(values) / sizeof(values[0]); i++) {
|
||||
for (int ack = 0; ack < 2; ack++) {
|
||||
memset(pkt->data, 0, ETCP_ACK_BASE_SIZE);
|
||||
memset(pkt->data, 0, ETCP_PAYLOAD_HEADER_SIZE);
|
||||
pkt->data[0] = ack ? ETCP_SECTION_ACK : ETCP_SECTION_PAYLOAD;
|
||||
pkt->data_len = ack ? ETCP_ACK_BASE_SIZE : 5;
|
||||
pkt->data_len = ack ? ETCP_ACK_BASE_SIZE : ETCP_PAYLOAD_HEADER_SIZE;
|
||||
for (int j = 0; j < 4; j++) pkt->data[1 + ack + j] = (uint8_t)(values[i] >> (8 * j));
|
||||
if (ack) pkt->data[6] = pkt->data[7] = 255;
|
||||
dump_count = 0; dump_message[0] = 0;
|
||||
@@ -60,7 +60,7 @@ static void debug_sequence_boundaries(void) {
|
||||
// Укороченная секция не должна читать отсутствующие байты или печатать выдуманный seq.
|
||||
for (int ack = 0; ack < 2; ack++) {
|
||||
pkt->data[0] = ack ? ETCP_SECTION_ACK : ETCP_SECTION_PAYLOAD;
|
||||
for (unsigned len = 0; len < (ack ? ETCP_ACK_BASE_SIZE : 5); len++) {
|
||||
for (unsigned len = 0; len < (ack ? ETCP_ACK_BASE_SIZE : ETCP_PAYLOAD_HEADER_SIZE); len++) {
|
||||
pkt->data_len = len; dump_count = 0; dump_message[0] = 0;
|
||||
etcp_dump_pkt_sections(pkt, NULL, 1);
|
||||
CHECK(dump_count == 1 && !strstr(dump_message, ack ? " ack=" : " payload="));
|
||||
@@ -146,6 +146,7 @@ static void setup(int multi) {
|
||||
ep[i].inst.ua=ua; ep[i].inst.node_id=i+1; ep[i].inst.config=&ep[i].cfg;
|
||||
ep[i].inst.connections=queue_new(ua,16,0,8,"session_test");
|
||||
ep[i].inst.pkt_pool=memory_pool_init(sizeof(struct ETCP_DGRAM)+PACKET_DATA_SIZE,"session_packets");
|
||||
ep[i].inst.ack_pool=memory_pool_init(sizeof(struct ACK_PACKET),"session_acks"); CHECK(ep[i].inst.ack_pool);
|
||||
CHECK(sc_generate_keypair(&ep[i].inst.my_keys) == SC_OK);
|
||||
ep[i].c=etcp_connection_create(&ep[i].inst,"session_test"); CHECK(ep[i].c);
|
||||
ep[i].c->peer_node_id=2-i; ep[i].c->links_up=1;
|
||||
@@ -159,6 +160,7 @@ static void setup(int multi) {
|
||||
l->initialized=l->link_status=l->recv_keepalive=l->remote_keepalive=1;
|
||||
l->link_state=LINK_STATE_CONNECTED; l->mtu=1280; l->remote_addr.ss_family=AF_INET;
|
||||
l->send_hook=capture; l->send_hook_ctx=(void*)(intptr_t)i;
|
||||
CHECK(etcp_tx_link_init(l) == 0);
|
||||
}
|
||||
if (multi) ep[i].links[0].next=&ep[i].links[1];
|
||||
ep[i].c->links=&ep[i].links[0];
|
||||
@@ -171,6 +173,7 @@ static void setup(int multi) {
|
||||
static void teardown(void) {
|
||||
for (int i=0;i<2;i++) {
|
||||
for (int j=0;j<2;j++) {
|
||||
if (ep[i].links[j].attempts) etcp_tx_link_destroy(&ep[i].links[j]);
|
||||
if (ep[i].links[j].rx_timeout_timer) uasync_cancel_timeout(ua, ep[i].links[j].rx_timeout_timer);
|
||||
if (ep[i].links[j].keepalive_timer) uasync_cancel_timeout(ua, ep[i].links[j].keepalive_timer);
|
||||
}
|
||||
@@ -178,7 +181,9 @@ static void teardown(void) {
|
||||
etcp_connection_close(ep[i].c);
|
||||
}
|
||||
uasync_poll(ua,0);
|
||||
for (int i=0;i<2;i++) { queue_free(ep[i].inst.connections); memory_pool_destroy(ep[i].inst.pkt_pool); }
|
||||
for (int i=0;i<2;i++) {
|
||||
queue_free(ep[i].inst.connections); memory_pool_destroy(ep[i].inst.pkt_pool); memory_pool_destroy(ep[i].inst.ack_pool);
|
||||
}
|
||||
uasync_poll(ua,0); CHECK(ua->timer_alloc_count == ua->timer_free_count); uasync_destroy(ua,0);
|
||||
}
|
||||
|
||||
@@ -186,6 +191,7 @@ static void teardown(void) {
|
||||
static void fresh_endpoint(int i) {
|
||||
for (int j = 0; j < 2; j++) {
|
||||
struct ETCP_LINK* link = &ep[i].links[j];
|
||||
if (link->attempts) etcp_tx_link_destroy(link);
|
||||
if (link->keepalive_timer) { uasync_cancel_timeout(ua, link->keepalive_timer); link->keepalive_timer = NULL; }
|
||||
if (link->rx_timeout_timer) { uasync_cancel_timeout(ua, link->rx_timeout_timer); link->rx_timeout_timer = NULL; }
|
||||
}
|
||||
@@ -200,7 +206,7 @@ static void fresh_endpoint(int i) {
|
||||
((struct conn_queue_entry*)entry->data)->peer_node_id = ep[i].c->peer_node_id;
|
||||
CHECK(queue_data_put_with_index(ep[i].c->conn_queue, entry) == 0);
|
||||
ep[i].c->links = &ep[i].links[0];
|
||||
for (int j = 0; j < 2; j++) ep[i].links[j].etcp = ep[i].c;
|
||||
for (int j = 0; j < 2; j++) { ep[i].links[j].etcp = ep[i].c; CHECK(etcp_tx_link_init(&ep[i].links[j]) == 0); }
|
||||
etcp_conn_add_cbk(ep[i].c, event, (void*)(intptr_t)i, ETCP_CBK_EVENT_REINIT | ETCP_CBK_EVENT_DOWN);
|
||||
reinit[i] = down[i] = 0;
|
||||
}
|
||||
@@ -343,7 +349,7 @@ static void receive_window_case(int wrap) {
|
||||
CHECK(c->input_queue->count == 1 && c->next_tx_id == next);
|
||||
for (int cumulative = 0; cumulative < 2; cumulative++) {
|
||||
struct ETCP_DGRAM* p = memory_pool_alloc(ep[0].inst.pkt_pool); CHECK(p);
|
||||
p->link = &ep[0].links[0]; p->data_len = cumulative ? 8 : 16;
|
||||
p->link = &ep[0].links[0]; p->data_len = ETCP_ACK_BASE_SIZE + (cumulative ? 0 : ETCP_ACK_ENTRY_SIZE);
|
||||
memset(p->data, 0, p->data_len); p->data[0] = ETCP_SECTION_ACK; p->data[1] = !cumulative;
|
||||
uint32_t ack = till + cumulative, selective = next - 1;
|
||||
for (int i = 0; i < 4; i++) { p->data[2+i] = ack >> (8*i); p->data[8+i] = selective >> (8*i); }
|
||||
|
||||
Reference in new issue
Block a user