Commit 21f7fb31 authored by Kuniyuki Iwashima's avatar Kuniyuki Iwashima Committed by Jakub Kicinski
Browse files

selftest: packetdrill: Import opt34/*-trigger-rst.pkt.



This imports the non-experimental version of opt34/*-trigger-rst.pkt.

                                     | accept() | SYN data |
  -----------------------------------+----------+----------+
  listener-closed-trigger-rst.pkt    |    no    |  unread  |
  unread-data-closed-trigger-rst.pkt |   yes    |  unread  |

Both files test that close()ing a SYN_RECV socket with unread SYN data
triggers RST.

The files are renamed to have the common prefix, trigger-rst.

Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250927213022.1850048-11-kuniyu@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5920f154
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// Close a listener socket with pending TFO child.
// This will trigger RST pkt to go out.

`./defaults.sh`

    0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0
   +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0

   +0 < S 0:10(10) win 32792 <mss 1460,sackOK,nop,nop,FO TFO_COOKIE,nop,nop>
   +0 > S. 0:0(0) ack 11 <mss 1460,nop,nop,sackOK>

// RST pkt is generated for each not-yet-accepted TFO child.
// inet_csk_listen_stop() -> inet_child_forget() -> tcp_disconnect()
// -> tcp_need_reset() is true for SYN_RECV
   +0 close(3) = 0
   +0 > R. 1:1(0) ack 11
+23 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// Close a TFO socket with unread data.
// This will trigger a RST pkt.

`./defaults.sh`

    0 socket(..., SOCK_STREAM|SOCK_NONBLOCK, IPPROTO_TCP) = 3
   +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
   +0 bind(3, ..., ...) = 0
   +0 listen(3, 1) = 0
   +0 setsockopt(3, SOL_TCP, TCP_FASTOPEN, [1], 4) = 0

   +0 < S 0:10(10) win 32792 <mss 1460,sackOK,nop,nop,FO TFO_COOKIE,nop,nop>
   +0 > S. 0:0(0) ack 11 <mss 1460,nop,nop,sackOK>

   +0 accept(3, ..., ...) = 4
   +0 %{ assert (tcpi_options & TCPI_OPT_SYN_DATA) != 0, tcpi_options }%
   +0 %{ assert tcpi_state == TCP_SYN_RECV, tcpi_state }%

// data_was_unread == true in __tcp_close()
   +0 close(4) = 0
   +0 > R. 1:1(0) ack 11