On 5/22/24 2:23 AM, Geliang Tang wrote:
diff --git a/tools/testing/selftests/bpf/prog_tests/sk_assign.c b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
index 0b9bd1d6f7cc..517d1186e386 100644
--- a/tools/testing/selftests/bpf/prog_tests/sk_assign.c
+++ b/tools/testing/selftests/bpf/prog_tests/sk_assign.c
@@ -255,6 +255,9 @@ void test_sk_assign(void)
for (i = 0; i < ARRAY_SIZE(tests) && !READ_ONCE(stop); i++) {
struct test_sk_cfg *test = &tests[i];
+ struct network_helper_opts opts = {
+ .type = test->type,
I think dropping the type arg from the start_server_addr (and other existing
helpers) is wrong.
"type" is the common case that tests usually want to specify here (at least
between SOCK_STREAM and SOCK_DGRAM). It becomes optional (opts) now and have a
more complicated way to pass it to the the start_server_addr, connect_to_addr...etc.
imo, the opts.{type, proto, noconnect} is at least a bit non intuitive or
unnecessary. The only use case now is in test_bpf_ip_check_defrag_ok which ends
up bypassing most (or at least some) of the connect_to_fd_opts() logic. May be
that test should have its own connect_to_fd_opts() instead. However, lets leave
this potential cleanup out for later and not complicate this set further.
Please keep type as the individual arg to the helper functions.
pw-bot: cr
+ };
const struct sockaddr *addr;
const int zero = 0;
int err;
@@ -263,9 +266,8 @@ void test_sk_assign(void)
continue;
prepare_addr(test->addr, test->family, BIND_PORT, false);
addr = (const struct sockaddr *)test->addr;
- server = start_server_addr(test->type,
- (const struct sockaddr_storage *)addr,
- test->len, NULL);
+ server = start_server_addr((const struct sockaddr_storage *)addr,
+ test->len, &opts);