[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220301062536.zs6z6q56exu3hgvv@kafai-mbp.dhcp.thefacebook.com>
Date: Mon, 28 Feb 2022 22:25:36 -0800
From: Martin KaFai Lau <kafai@...com>
To: Jakub Sitnicki <jakub@...udflare.com>
CC: <bpf@...r.kernel.org>, <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
<kernel-team@...udflare.com>, Ilya Leoshkevich <iii@...ux.ibm.com>
Subject: Re: [PATCH bpf-next v2 2/3] selftests/bpf: Check dst_port only on
the client socket
On Sun, Feb 27, 2022 at 09:27:56PM +0100, Jakub Sitnicki wrote:
> 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 bound to be egressing from the client
> socket in the test program for reading the dst_port.
>
> Fixes: 8f50f16ff39d ("selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads")
> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
> ---
> .../testing/selftests/bpf/progs/test_sock_fields.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_sock_fields.c b/tools/testing/selftests/bpf/progs/test_sock_fields.c
> index 3e2e3ee51cc9..186fed1deaab 100644
> --- a/tools/testing/selftests/bpf/progs/test_sock_fields.c
> +++ b/tools/testing/selftests/bpf/progs/test_sock_fields.c
> @@ -42,6 +42,11 @@ struct {
> __type(value, struct bpf_spinlock_cnt);
> } sk_pkt_out_cnt10 SEC(".maps");
>
> +enum {
> + TCP_SYN_SENT = 2,
> + TCP_LISTEN = 10,
Thanks for the clean up.
A nit. directly use BPF_TCP_SYN_SENT and BPF_TCP_LISTEN.
Others lgtm.
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists