Commit aca06275 authored by bitcoffee's avatar bitcoffee
Browse files

net, bpf: Add a writeable_tracepoint to inet_stream_connect

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



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

A trace point is added to the connection process. Theebpf program
can be mounted to modify the return value of the function. This is
mandatory for delaying the establishment of an ebpf link. After
the connection is complete, a message is returned immediately and
no unnecessary operation is performed.

Signed-off-by: default avatarbitcoffee <liuxin350@huawei.com>
parent d8fcd2f3
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -203,6 +203,20 @@ TRACE_EVENT(inet_sock_set_state,
			show_tcp_state_name(__entry->newstate))
);

#undef NET_DECLARE_TRACE
#ifdef DECLARE_TRACE_WRITABLE
#define NET_DECLARE_TRACE(call, proto, args, size) \
	DECLARE_TRACE_WRITABLE(call, PARAMS(proto), PARAMS(args), size)
#else
#define NET_DECLARE_TRACE(call, proto, args, size) \
	DECLARE_TRACE(call, PARAMS(proto), PARAMS(args))
#endif

NET_DECLARE_TRACE(connect_ret,
	TP_PROTO(int *err),
	TP_ARGS(err),
	sizeof(int));

#endif /* _TRACE_SOCK_H */

/* This part must be outside protection */
+1 −0
Original line number Diff line number Diff line
@@ -729,6 +729,7 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
	lock_sock(sock->sk);
	err = __inet_stream_connect(sock, uaddr, addr_len, flags, 0);
	release_sock(sock->sk);
	trace_connect_ret(&err);
	return err;
}
EXPORT_SYMBOL(inet_stream_connect);