mirror of
https://github.com/torvalds/linux
synced 2024-10-15 15:59:15 +00:00
Merge branch 'Use start_server and connect_fd_to_fd'
Geliang Tang says: ==================== Simplify bpf_tcp_ca test by using connect_fd_to_fd and start_server helpers. v4: - Matt reminded me that I shouldn't send a square-to patch to BPF (thanks), so I update them into two patches in v4. v3: - split v2 as two patches as Daniel suggested. - The patch "selftests/bpf: Use start_server in bpf_tcp_ca" is merged by Daniel (thanks), but I forgot to drop 'settimeo(lfd, 0)' in it, so I send a squash-to patch to fix this. ==================== Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
commit
201874fc06
|
@ -79,11 +79,9 @@ static void *server(void *arg)
|
||||||
|
|
||||||
static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
|
static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 sa6 = {};
|
|
||||||
ssize_t nr_recv = 0, bytes = 0;
|
ssize_t nr_recv = 0, bytes = 0;
|
||||||
int lfd = -1, fd = -1;
|
int lfd = -1, fd = -1;
|
||||||
pthread_t srv_thread;
|
pthread_t srv_thread;
|
||||||
socklen_t addrlen = sizeof(sa6);
|
|
||||||
void *thread_ret;
|
void *thread_ret;
|
||||||
char batch[1500];
|
char batch[1500];
|
||||||
int err;
|
int err;
|
||||||
|
@ -100,12 +98,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca) ||
|
if (settcpca(lfd, tcp_ca) || settcpca(fd, tcp_ca))
|
||||||
settimeo(lfd, 0) || settimeo(fd, 0))
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
err = getsockname(lfd, (struct sockaddr *)&sa6, &addrlen);
|
|
||||||
if (!ASSERT_NEQ(err, -1, "getsockname"))
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
if (sk_stg_map) {
|
if (sk_stg_map) {
|
||||||
|
@ -116,7 +109,7 @@ static void do_test(const char *tcp_ca, const struct bpf_map *sk_stg_map)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* connect to server */
|
/* connect to server */
|
||||||
err = connect(fd, (struct sockaddr *)&sa6, addrlen);
|
err = connect_fd_to_fd(fd, lfd, 0);
|
||||||
if (!ASSERT_NEQ(err, -1, "connect"))
|
if (!ASSERT_NEQ(err, -1, "connect"))
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue