Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13f7432b authored by Daniel Borkmann's avatar Daniel Borkmann
Browse files

Merge branch 'bpf-tcp-listen-cb'



Andrey Ignatov says:

====================
This patchset adds TCP-BPF callback for listening sockets.

Patch 0001 provides more details and is the main patch in the set.

Patch 0006 adds selftest for the new callback.

Other patches are bug fixes and improvements in TCP-BPF selftest
to make it easier to extend in 0006.
====================

Acked-by: default avatarLawrence Brakmo <brakmo@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parents 2d3feca8 78d8e26d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2555,6 +2555,9 @@ enum {
					 * Arg1: old_state
					 * Arg2: new_state
					 */
	BPF_SOCK_OPS_TCP_LISTEN_CB,	/* Called on listen(2), right after
					 * socket transition to LISTEN state.
					 */
};

/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect
+1 −0
Original line number Diff line number Diff line
@@ -229,6 +229,7 @@ int inet_listen(struct socket *sock, int backlog)
		err = inet_csk_listen_start(sk, backlog);
		if (err)
			goto out;
		tcp_call_bpf(sk, BPF_SOCK_OPS_TCP_LISTEN_CB, 0, NULL);
	}
	sk->sk_max_ack_backlog = backlog;
	err = 0;
+3 −0
Original line number Diff line number Diff line
@@ -2555,6 +2555,9 @@ enum {
					 * Arg1: old_state
					 * Arg2: new_state
					 */
	BPF_SOCK_OPS_TCP_LISTEN_CB,	/* Called on listen(2), right after
					 * socket transition to LISTEN state.
					 */
};

/* List of TCP states. There is a build check in net/ipv4/tcp.c to detect
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ $(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
$(OUTPUT)/test_sock: cgroup_helpers.c
$(OUTPUT)/test_sock_addr: cgroup_helpers.c
$(OUTPUT)/test_sockmap: cgroup_helpers.c
$(OUTPUT)/test_tcpbpf_user: cgroup_helpers.c
$(OUTPUT)/test_progs: trace_helpers.c
$(OUTPUT)/get_cgroup_id_user: cgroup_helpers.c

+3 −3
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ static int join_cgroup_from_top(char *cgroup_path)
 *
 * On success, it returns 0, otherwise on failure it returns 1.
 */
int join_cgroup(char *path)
int join_cgroup(const char *path)
{
	char cgroup_path[PATH_MAX + 1];

@@ -158,7 +158,7 @@ void cleanup_cgroup_environment(void)
 * On success, it returns the file descriptor. On failure it returns 0.
 * If there is a failure, it prints the error to stderr.
 */
int create_and_get_cgroup(char *path)
int create_and_get_cgroup(const char *path)
{
	char cgroup_path[PATH_MAX + 1];
	int fd;
@@ -186,7 +186,7 @@ int create_and_get_cgroup(char *path)
 * which is an invalid cgroup id.
 * If there is a failure, it prints the error to stderr.
 */
unsigned long long get_cgroup_id(char *path)
unsigned long long get_cgroup_id(const char *path)
{
	int dirfd, err, flags, mount_id, fhsize;
	union {
Loading