diff options
author | Libor Peltan <libor.peltan@nic.cz> | 2021-10-08 09:30:51 +0200 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2022-03-16 14:58:06 +0100 |
commit | 6d74c78c9988cbc15572d74e59a5e4bbab011864 (patch) | |
tree | 9ce1067979d0678cebe41ffb41ef0d977f6555a6 /tests/libknot | |
parent | modules: enable measuring RTT for xdp-tcp (diff) | |
download | knot-6d74c78c9988cbc15572d74e59a5e4bbab011864.tar.xz knot-6d74c78c9988cbc15572d74e59a5e4bbab011864.zip |
xdp-tcp: response RST shall have seqno according to packet...
...not the connection
Diffstat (limited to 'tests/libknot')
-rw-r--r-- | tests/libknot/test_xdp_tcp.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/libknot/test_xdp_tcp.c b/tests/libknot/test_xdp_tcp.c index cf0df6881..c88df6725 100644 --- a/tests/libknot/test_xdp_tcp.c +++ b/tests/libknot/test_xdp_tcp.c @@ -340,7 +340,21 @@ void test_close(void) be16toh(test_conn->ip_rem.sin6_port), be16toh(test_conn->ip_loc.sin6_port)); prepare_seqack(&msg, 0, 0); - int ret = knot_tcp_recv(&rl, &msg, 1, test_table, NULL); + + // test wrong ackno synack, shall reply with RST with same + knot_xdp_msg_t wrong = msg; + wrong.seqno += INT32_MAX; + wrong.ackno += INT32_MAX; + int ret = knot_tcp_recv(&rl, &wrong, 1, test_table, NULL); + is_int(KNOT_EOK, ret, "close: relay 0 OK"); + is_int(KNOT_XDP_MSG_RST, rl.auto_answer, "close: reset wrong ackno"); + is_int(rl.auto_seqno, wrong.ackno, "close: reset seqno"); + ret = knot_tcp_send(test_sock, &rl, 1, 1); + is_int(KNOT_EOK, ret, "close: send 0 OK"); + check_sent(0, 1, 0, 0); + is_int(sent_seqno, wrong.ackno, "close: reset seqno sent"); + + ret = knot_tcp_recv(&rl, &msg, 1, test_table, NULL); is_int(KNOT_EOK, ret, "close: relay 1 OK"); ret = knot_tcp_send(test_sock, &rl, 1, 1); is_int(KNOT_EOK, ret, "close: send OK"); |