diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 91668b1cd3d1745b87bdec68870a4a4660ee2b0f..7f500a230757d2b8af34f138ca9e745f2d2dc86e 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -240,10 +240,11 @@ struct inet_sock { nodefrag:1; __u8 bind_address_no_port:1, recverr_rfc4884:1, - defer_connect:1; /* Indicates that fastopen_connect is set + defer_connect:1, /* Indicates that fastopen_connect is set * and cookie exists so we defer connect * until first data frame is written */ + bpf_defer_connect:1; __u8 rcv_tos; __u8 convert_csum; int uc_index; diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index e7ac3555d7982faaf35bab29040da1eb07d9f3b4..c687995f64b6aceaa14280f060e0f50138c0f567 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -590,7 +590,8 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait) if (tp->urg_data & TCP_URG_VALID) mask |= EPOLLPRI; - } else if (state == TCP_SYN_SENT && inet_sk(sk)->defer_connect) { + } else if (state == TCP_SYN_SENT && + (inet_sk(sk)->defer_connect || inet_sk(sk)->bpf_defer_connect)) { /* Active TCP fastopen socket with defer_connect * Return EPOLLOUT so application can call write() * in order for kernel to generate SYN+data