mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
selftests/bpf: Fix tx_prog_fd values in test_sockmap
The values of tx_prog_fd in run_options() should not be 0, so set it as -1 in else branch, and test it using "if (tx_prog_fd > 0)" condition, not "if (tx_prog_fd)" or "if (tx_prog_fd >= 0)". Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Tested-by: Jakub Sitnicki <jakub@cloudflare.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Link: https://lore.kernel.org/bpf/08b20ffc544324d40939efeae93800772a91a58e.1716446893.git.tanggeliang@kylinos.cn
This commit is contained in:
parent
ec1249d327
commit
d95ba15b97
|
|
@ -1027,9 +1027,9 @@ static int run_options(struct sockmap_options *options, int cg_fd, int test)
|
|||
else if (txmsg_drop)
|
||||
tx_prog_fd = prog_fd[8];
|
||||
else
|
||||
tx_prog_fd = 0;
|
||||
tx_prog_fd = -1;
|
||||
|
||||
if (tx_prog_fd) {
|
||||
if (tx_prog_fd > 0) {
|
||||
int redir_fd, i = 0;
|
||||
|
||||
err = bpf_prog_attach(tx_prog_fd,
|
||||
|
|
@ -1285,7 +1285,7 @@ static int run_options(struct sockmap_options *options, int cg_fd, int test)
|
|||
bpf_prog_detach2(prog_fd[0], map_fd[8], BPF_SK_SKB_STREAM_PARSER);
|
||||
bpf_prog_detach2(prog_fd[2], map_fd[8], BPF_SK_SKB_STREAM_VERDICT);
|
||||
|
||||
if (tx_prog_fd >= 0)
|
||||
if (tx_prog_fd > 0)
|
||||
bpf_prog_detach2(tx_prog_fd, map_fd[1], BPF_SK_MSG_VERDICT);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user