]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: bpf: Add test for sk_assign
authorLorenz Bauer <lmb@cloudflare.com>
Sun, 29 Mar 2020 22:53:41 +0000 (15:53 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 30 Mar 2020 20:45:05 +0000 (13:45 -0700)
commita77c3be4d11f93178631ab93af0eda739ff7ab18
treeb4174abd7a7e99a44e12942bb6027fd1b206b8fd
parent173d1d78d72ac81ea48a5d51451cbd169405f40c
selftests: bpf: Add test for sk_assign

Attach a tc direct-action classifier to lo in a fresh network
namespace, and rewrite all connection attempts to localhost:4321
to localhost:1234 (for port tests) and connections to unreachable
IPv4/IPv6 IPs to the local socket (for address tests). Includes
implementations for both TCP and UDP.

Keep in mind that both client to server and server to client traffic
passes the classifier.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200329225342.16317-5-joe@wand.net.nz
Co-authored-by: Joe Stringer <joe@wand.net.nz>
tools/testing/selftests/bpf/prog_tests/sk_assign.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_sk_assign.c [new file with mode: 0644]