aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-10-05 19:52:24 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-10-05 21:22:59 +0200
commitccbf13ed1b74e643b0129a0cafff600d296ffe90 (patch)
treebef50011841954ca1e046b7f287db97699590b7a
parenta909fd5e7a155e55570b12f75544e22440ac03a2 (diff)
downloadpasst-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar.gz
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar.bz2
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar.lz
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar.xz
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.tar.zst
passt-ccbf13ed1b74e643b0129a0cafff600d296ffe90.zip
tcp: Drop EPOLLOUT for connections being established earlier
That's the first thing we have to do, before sending SYN, ACK: if tcp_send_to_tap() fails, we'll get a lot of useless events otherwise. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tcp.c b/tcp.c
index bf7c610..9bb2efe 100644
--- a/tcp.c
+++ b/tcp.c
@@ -2656,6 +2656,9 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn,
socklen_t sl;
int so;
+ /* Drop EPOLLOUT, only used to wait for connect() to complete */
+ tcp_tap_epoll_mask(c, conn, EPOLLIN | EPOLLRDHUP);
+
sl = sizeof(so);
if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, &so, &sl) || so) {
tcp_rst(c, conn);
@@ -2665,9 +2668,6 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn,
if (tcp_send_to_tap(c, conn, SYN | ACK, now))
return;
- /* Drop EPOLLOUT, only used to wait for connect() to complete */
- tcp_tap_epoll_mask(c, conn, EPOLLIN | EPOLLRDHUP);
-
tcp_tap_state(conn, TAP_SYN_RCVD);
}