[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADxym3YKfp5=oyJRyM9AVp8GW7+fLuboeW0gs-LagLDy+hfj_g@mail.gmail.com>
Date: Wed, 5 Jan 2022 22:45:48 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Jakub Kicinski <kuba@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
David Miller <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
David Ahern <dsahern@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Menglong Dong <imagedong@...cent.com>
Subject: Re: [PATCH v3 net-next 2/2] bpf: selftests: add bind retry for
post_bind{4, 6}
On Wed, Jan 5, 2022 at 9:57 PM Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Wed, Jan 5, 2022 at 5:21 AM <menglong8.dong@...il.com> wrote:
> >
> > From: Menglong Dong <imagedong@...cent.com>
> >
> > With previous patch, kernel is able to 'put_port' after sys_bind()
> > fails. Add the test for that case: rebind another port after
> > sys_bind() fails. If the bind success, it means previous bind
> > operation is already undoed.
> >
> > Signed-off-by: Menglong Dong <imagedong@...cent.com>
> > ---
> > tools/testing/selftests/bpf/test_sock.c | 166 +++++++++++++++++++++---
> > 1 file changed, 146 insertions(+), 20 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
> > index e8edd3dd3ec2..68525d68d4e5 100644
> > --- a/tools/testing/selftests/bpf/test_sock.c
> > +++ b/tools/testing/selftests/bpf/test_sock.c
> > @@ -35,12 +35,15 @@ struct sock_test {
> > /* Endpoint to bind() to */
> > const char *ip;
> > unsigned short port;
> > + unsigned short port_retry;
> > /* Expected test result */
> > enum {
> > LOAD_REJECT,
> > ATTACH_REJECT,
> > BIND_REJECT,
> > SUCCESS,
> > + RETRY_SUCCESS,
> > + RETRY_REJECT
> > } result;
> > };
> >
> > @@ -60,6 +63,7 @@ static struct sock_test tests[] = {
> > 0,
> > NULL,
> > 0,
> > + 0,
> > LOAD_REJECT,
> > },
>
>
> I assume we tried C99 initializers here, and this failed for some reason ?
>
Yeah, C99 initializers should be a good choice here, therefore
I don't need to change every entry here after I add a new field to
'struct sock_test'.
I think C99 initializers should work here, I'll give it a try.
Thanks!
Menglong Dong
> diff --git a/tools/testing/selftests/bpf/test_sock.c
> b/tools/testing/selftests/bpf/test_sock.c
> index e8edd3dd3ec2..b57ce9f3eabf 100644
> --- a/tools/testing/selftests/bpf/test_sock.c
> +++ b/tools/testing/selftests/bpf/test_sock.c
> @@ -54,13 +54,13 @@ static struct sock_test tests[] = {
> BPF_MOV64_IMM(BPF_REG_0, 1),
> BPF_EXIT_INSN(),
> },
> - BPF_CGROUP_INET4_POST_BIND,
> - BPF_CGROUP_INET4_POST_BIND,
> - 0,
> - 0,
> - NULL,
> - 0,
> - LOAD_REJECT,
> + .expected_attach_type = BPF_CGROUP_INET4_POST_BIND,
> + .attach_type = BPF_CGROUP_INET4_POST_BIND,
> + .domain = 0,
> + .type = 0,
> + .ip = NULL,
> + .port = 0,
> + .result = LOAD_REJECT,
> },
> {
> "bind4 load with invalid access: mark",
Powered by blists - more mailing lists