test_connection: verify correct seq. number overflow for incoming packets
All checks were successful
/ build-hamnet70 (push) Successful in 38s
/ build-doc (push) Successful in 18s
/ deploy-doc (push) Has been skipped

This commit is contained in:
Thomas Kolb 2025-02-22 21:31:12 +01:00
commit d908c16702

View file

@ -285,5 +285,32 @@ int main(void)
ASSERT_STATE(expected_state, conn);
LOG(LVL_INFO, "Generating 15 packets starting from the expected sequence number (4).");
LOG(LVL_INFO, "Reception must resume correctly and all packets must be accepted.");
for(size_t i = 0; i < 15; i++) {
// build connection parameters packet
header.dst_addr = dut_address;
header.src_addr = peer_address;
header.msg_type = L2_MSG_TYPE_DATA;
header.rx_seq_nr = 0;
header.tx_seq_nr = (4+i) % 16; // sequence numbers are valid from 0 to 15
header.tx_request = i == 14;
static_payload[0] = L2_PAYLOAD_TYPE_IPV4;
static_payload[1] = i;
payload_len = 2;
packet_len = layer2_encode_packet(&header, static_payload, payload_len, packet_buf, sizeof(packet_buf));
result_t result = connection_handle_packet(&conn, packet_buf, packet_len, &data_packet, &tx_req_rcvd);
ASSERT_RESULT(OK, result);
}
expected_state.next_expected_seq = 3;
ASSERT_STATE(expected_state, conn);
LOG(LVL_INFO, ">>> All assertions successful.");
}