aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-03-26 16:42:23 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-03-26 09:51:58 +0100
commit5894a245b93f3c848c3a42d1c625eef3656b2eec (patch)
tree7aa9fb019533b65602e813b5463602eb6bf26568
parent16c2d8da0d309e7e6cecc877acfd0f7fb6758d64 (diff)
downloadpasst-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar.gz
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar.bz2
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar.lz
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar.xz
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.tar.zst
passt-5894a245b93f3c848c3a42d1c625eef3656b2eec.zip
tcp: Never automatically add the ACK flag to RST packets
tcp_send_flag() will sometimes force on the ACK flag for all !SYN packets. This doesn't make sense for RST packets, where plain RST and RST+ACK have somewhat different meanings. AIUI, RST+ACK indicates an abrupt end to a connection, but acknowledges data already sent. Plain RST indicates an abort, when one end receives a packet that doesn't seem to make sense in the context of what it knows about the connection. All of the cases where we send RSTs are the second, so we don't want an ACK flag, but we currently could add one anyway. Change that, so we won't add an ACK to an RST unless the caller explicitly requests it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index 47954d1..b65ddeb 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1674,7 +1674,7 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
*data++ = OPT_WS;
*data++ = OPT_WS_LEN;
*data++ = conn->ws_to_tap;
- } else {
+ } else if (!(flags & RST)) {
if (conn->seq_ack_to_tap != prev_ack_to_tap ||
!prev_wnd_to_tap)
flags |= ACK;