Message ID | bf1035738532f5c21ae42f05d14fc00e334079ef.1721771340.git.tanggeliang@kylinos.cn (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | use network helpers, part 11 | expand |
diff --git a/tools/testing/selftests/bpf/network_helpers.c b/tools/testing/selftests/bpf/network_helpers.c index 8f39adbc2c16..f140a76d3d7f 100644 --- a/tools/testing/selftests/bpf/network_helpers.c +++ b/tools/testing/selftests/bpf/network_helpers.c @@ -109,11 +109,14 @@ int start_server_addr(int type, const struct sockaddr_storage *addr, socklen_t a goto error_close; } - if (type == SOCK_STREAM) { + if (!opts->nolisten && type == SOCK_STREAM) { if (listen(fd, opts->backlog ? MAX(opts->backlog, 0) : 1) < 0) { log_err("Failed to listed on socket"); goto error_close; } + } else if (opts->backlog) { + log_err("Useless network helper opts: backlog %d", + opts->backlog); } return fd; diff --git a/tools/testing/selftests/bpf/network_helpers.h b/tools/testing/selftests/bpf/network_helpers.h index ebed1fb1bd49..16f266c53b61 100644 --- a/tools/testing/selftests/bpf/network_helpers.h +++ b/tools/testing/selftests/bpf/network_helpers.h @@ -34,6 +34,7 @@ struct network_helper_opts { * changing the "tcp_syncookies" sysctl from 1 to 2. */ int backlog; + bool nolisten; int (*post_socket_cb)(int fd, void *opts); void *cb_opts; };