test_connection: verify correct seq. number overflow for incoming packets
This commit is contained in:
parent
84d15331c2
commit
d908c16702
1 changed files with 27 additions and 0 deletions
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue