Commit 48b25f1c authored by bitcoffee's avatar bitcoffee
Browse files

net, bpf: Introduces a new ebpf delay connect flag

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I71USM



---------------------------------------------------

The bpf_defer_connect bit is added for inet_sock to indicate
whether the current socket is changed to the bpf program to
delay link establishment.

Signed-off-by: default avatarbitcoffee <liuxin350@huawei.com>
parent aca06275
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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