1
0
mirror of https://passt.top/passt synced 2024-10-01 03:25:48 +00:00

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>
This commit is contained in:
Stefano Brivio 2021-10-05 19:52:24 +02:00
parent a909fd5e7a
commit ccbf13ed1b

6
tcp.c
View File

@ -2656,6 +2656,9 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn,
socklen_t sl; socklen_t sl;
int so; int so;
/* Drop EPOLLOUT, only used to wait for connect() to complete */
tcp_tap_epoll_mask(c, conn, EPOLLIN | EPOLLRDHUP);
sl = sizeof(so); sl = sizeof(so);
if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, &so, &sl) || so) { if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, &so, &sl) || so) {
tcp_rst(c, conn); 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)) if (tcp_send_to_tap(c, conn, SYN | ACK, now))
return; 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); tcp_tap_state(conn, TAP_SYN_RCVD);
} }