aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools/testing/selftests/bpf/test_sockmap.c
diff options
context:
space:
mode:
authorPengcheng Yang <yangpc@wangsu.com>2022-11-29 18:40:41 +0800
committerDaniel Borkmann <daniel@iogearbox.net>2022-12-01 01:07:41 +0100
commit89903dcb3c2e134fb101de7921a19dd9f8418b4c (patch)
tree9f1914c3d63699fc022a048b23b54ebefe9b9324 /tools/testing/selftests/bpf/test_sockmap.c
parentbpf, sockmap: Fix data loss caused by using apply_bytes on ingress redirect (diff)
downloadwireguard-linux-89903dcb3c2e134fb101de7921a19dd9f8418b4c.tar.xz
wireguard-linux-89903dcb3c2e134fb101de7921a19dd9f8418b4c.zip
selftests/bpf: Add ingress tests for txmsg with apply_bytes
Currently, the ingress redirect is not covered in "txmsg test apply". Signed-off-by: Pengcheng Yang <yangpc@wangsu.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Jakub Sitnicki <jakub@cloudflare.com> Link: https://lore.kernel.org/bpf/1669718441-2654-5-git-send-email-yangpc@wangsu.com
Diffstat (limited to 'tools/testing/selftests/bpf/test_sockmap.c')
-rw-r--r--tools/testing/selftests/bpf/test_sockmap.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index e768181a1bd7..024a0faafb3b 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -1690,24 +1690,42 @@ static void test_txmsg_apply(int cgrp, struct sockmap_options *opt)
{
txmsg_pass = 1;
txmsg_redir = 0;
+ txmsg_ingress = 0;
txmsg_apply = 1;
txmsg_cork = 0;
test_send_one(opt, cgrp);
txmsg_pass = 0;
txmsg_redir = 1;
+ txmsg_ingress = 0;
+ txmsg_apply = 1;
+ txmsg_cork = 0;
+ test_send_one(opt, cgrp);
+
+ txmsg_pass = 0;
+ txmsg_redir = 1;
+ txmsg_ingress = 1;
txmsg_apply = 1;
txmsg_cork = 0;
test_send_one(opt, cgrp);
txmsg_pass = 1;
txmsg_redir = 0;
+ txmsg_ingress = 0;
+ txmsg_apply = 1024;
+ txmsg_cork = 0;
+ test_send_large(opt, cgrp);
+
+ txmsg_pass = 0;
+ txmsg_redir = 1;
+ txmsg_ingress = 0;
txmsg_apply = 1024;
txmsg_cork = 0;
test_send_large(opt, cgrp);
txmsg_pass = 0;
txmsg_redir = 1;
+ txmsg_ingress = 1;
txmsg_apply = 1024;
txmsg_cork = 0;
test_send_large(opt, cgrp);