From: Jon Maloy <jmaloy@redhat.com>
To: passt-dev@passt.top, sbrivio@redhat.com, lvivier@redhat.com,
dgibson@redhat.com, jmaloy@redhat.com
Subject: pasta: set correct flags in reset message when outgoing connection setup fails
Date: Sat, 25 Jan 2025 15:16:47 -0500 [thread overview]
Message-ID: <20250125201647.902478-1-jmaloy@redhat.com> (raw)
Bug #93 states that a connect() will hang if the remote port of a
connection setup doesn't exist. The remote host will respond with
the (RST | SYN | ACK) flags set, but we only relay the RST flag back
to the local user. This causes the situation described above.
We now add a check if the reset happens in the connection state
TAP_SYN_RCVD, in which case we add the missing (SYN | ACK) flags.
This solves the problem.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
tcp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tcp.c b/tcp.c
index c89f323..46df6bd 100644
--- a/tcp.c
+++ b/tcp.c
@@ -1199,9 +1199,14 @@ static int tcp_send_flag(const struct ctx *c, struct tcp_tap_conn *conn,
*/
void tcp_rst_do(const struct ctx *c, struct tcp_tap_conn *conn)
{
+ int flags = RST;
+
if (conn->events == CLOSED)
return;
+ if (conn->events == TAP_SYN_RCVD)
+ flags |= SYN | ACK;
+
if (!tcp_send_flag(c, conn, RST))
conn_event(c, conn, CLOSED);
}
--
@@ -1199,9 +1199,14 @@ static int tcp_send_flag(const struct ctx *c, struct tcp_tap_conn *conn,
*/
void tcp_rst_do(const struct ctx *c, struct tcp_tap_conn *conn)
{
+ int flags = RST;
+
if (conn->events == CLOSED)
return;
+ if (conn->events == TAP_SYN_RCVD)
+ flags |= SYN | ACK;
+
if (!tcp_send_flag(c, conn, RST))
conn_event(c, conn, CLOSED);
}
--
2.48.0
next reply other threads:[~2025-01-25 20:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-25 20:16 Jon Maloy [this message]
2025-01-25 22:24 ` pasta: set correct flags in reset message when outgoing connection setup fails Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250125201647.902478-1-jmaloy@redhat.com \
--to=jmaloy@redhat.com \
--cc=dgibson@redhat.com \
--cc=lvivier@redhat.com \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).