Skip to content

Commit ba0dcb8

Browse files
mmhalKernel Patches Daemon
authored andcommitted
selftests/bpf: sockmap_redir: Rename functions
Preparatory patch before adding SK_PASS/SK_DROP support: test_redir() => test_sockets() test_socket() => test_redir() test_send_redir_recv() => test_send_recv() After the change (and the following patch) the call stack will be: serial_test_sockmap_redir test_map test_sockets test_redir test_send_recv (test_verdict) (test_send_recv) Signed-off-by: Michal Luczaj <[email protected]>
1 parent 36fffbb commit ba0dcb8

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

tools/testing/selftests/bpf/prog_tests/sockmap_redir.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ static void handle_unsupported(int sd_send, int sd_peer, int sd_in, int sd_out,
210210
fail_recv("recv(sd_out, OOB)", sd_out, MSG_OOB);
211211
}
212212

213-
static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,
214-
int sd_in, int sd_out, int sd_recv,
215-
struct maps *maps, int status)
213+
static void test_send_recv(int sd_send, int send_flags, int sd_peer, int sd_in,
214+
int sd_out, int sd_recv, struct maps *maps, int status)
216215
{
217216
unsigned int drop, pass;
218217
char *send_buf = "ab";
@@ -335,9 +334,9 @@ static int get_support_status(enum prog_type type, const char *in,
335334
return status;
336335
}
337336

338-
static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
339-
struct maps *maps, struct socket_spec *s_in,
340-
struct socket_spec *s_out)
337+
static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
338+
struct maps *maps, struct socket_spec *s_in,
339+
struct socket_spec *s_out)
341340
{
342341
int fd_in, fd_out, fd_send, fd_peer, fd_recv, flags, status;
343342
const char *in_str, *out_str;
@@ -367,12 +366,12 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir,
367366
if (!test__start_subtest(s))
368367
return;
369368

370-
test_send_redir_recv(fd_send, flags, fd_peer, fd_in, fd_out, fd_recv,
371-
maps, status);
369+
test_send_recv(fd_send, flags, fd_peer, fd_in, fd_out, fd_recv, maps,
370+
status);
372371
}
373372

374-
static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
375-
struct maps *maps)
373+
static void test_sockets(enum bpf_map_type type, struct redir_spec *redir,
374+
struct maps *maps)
376375
{
377376
struct socket_spec *s, sockets[] = {
378377
{ AF_INET, SOCK_STREAM },
@@ -395,7 +394,7 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
395394

396395
/* Intra-proto */
397396
for (s = sockets; s < sockets + ARRAY_SIZE(sockets); s++)
398-
test_socket(type, redir, maps, s, s);
397+
test_redir(type, redir, maps, s, s);
399398

400399
/* Cross-proto */
401400
for (int i = 0; i < ARRAY_SIZE(sockets); i++) {
@@ -409,7 +408,7 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,
409408
in->sotype == out->sotype))
410409
continue;
411410

412-
test_socket(type, redir, maps, in, out);
411+
test_redir(type, redir, maps, in, out);
413412
}
414413
}
415414
out:
@@ -460,7 +459,7 @@ static void test_map(enum bpf_map_type type)
460459
if (xbpf_prog_attach(prog_fd, maps.in, attach_type, 0))
461460
return;
462461

463-
test_redir(type, r, &maps);
462+
test_sockets(type, r, &maps);
464463

465464
if (xbpf_prog_detach2(prog_fd, maps.in, attach_type))
466465
return;

0 commit comments

Comments
 (0)