]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Check dst_port only on the client socket
authorJakub Sitnicki <jakub@cloudflare.com>
Thu, 17 Mar 2022 11:39:18 +0000 (12:39 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 18 Mar 2022 14:46:59 +0000 (15:46 +0100)
commit10fd2c996b9e14b9f07adebd2ac7606133b0102a
tree90855f72230890d68ba76e6c2f6813c19d50418c
parentbc4e2e72ea9a5274070628e737d64884098956b0
selftests/bpf: Check dst_port only on the client socket

cgroup_skb/egress programs which sock_fields test installs process packets
flying in both directions, from the client to the server, and in reverse
direction.

Recently added dst_port check relies on the fact that destination
port (remote peer port) of the socket which sends the packet is known ahead
of time. This holds true only for the client socket, which connects to the
known server port.

Filter out any traffic that is not egressing from the client socket in the
BPF program that tests reading the dst_port.

Fixes: eea83c039b64 ("selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads")
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20220317113920.1068535-3-jakub@cloudflare.com
tools/testing/selftests/bpf/progs/test_sock_fields.c