From: Eduard Zingerman <eddyz87@gmail.com>
To: Geliang Tang <geliang@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Mykola Lysenko <mykolal@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>
Cc: Geliang Tang <tanggeliang@kylinos.cn>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH bpf-next 5/6] selftests/bpf: Use connect_to_fd in sk_lookup
Date: Fri, 21 Jun 2024 13:44:48 -0700 [thread overview]
Message-ID: <1f76e30b4a298dd8403e661cece6735b398f5b1e.camel@gmail.com> (raw)
In-Reply-To: <588b96d36b36f88095802d28a6b236842e30cb96.1718965270.git.tanggeliang@kylinos.cn>
On Fri, 2024-06-21 at 18:35 +0800, Geliang Tang wrote:
[...]
> @@ -883,12 +881,10 @@ static void drop_on_lookup(const struct test *t)
> if (server_fd < 0)
> goto detach;
>
> - client_fd = make_socket(t->sotype, t->connect_to.ip,
> - t->connect_to.port, &dst, &len);
> + client_fd = connect_to_fd(server_fd, 0);
Nit: make_socket() used timeout { .tv_sec = IO_TIMEOUT_SEC },
while here commect_to_fd is called with timeout disabled.
Same applies to other replacements below.
> if (client_fd < 0)
> goto close_srv;
>
> - err = connect(client_fd, (void *)&dst, len);
> if (t->sotype == SOCK_DGRAM) {
> err = send_byte(client_fd);
> if (err)
[...]
> @@ -1257,17 +1247,13 @@ static void run_multi_prog_lookup(const struct test_multi_prog *t)
> if (err)
> goto out_close_server;
>
> - client_fd = make_socket(SOCK_STREAM, EXT_IP4, EXT_PORT, &dst, &len);
> - if (client_fd < 0)
> - goto out_close_server;
> -
> - err = connect(client_fd, (void *)&dst, len);
> - if (CHECK(err && !t->expect_errno, "connect",
> + client_fd = connect_to_fd(server_fd, 0);
I'm not sure this is correct.
The original test uses EXT_IP4, EXT_PORT here,
while t->listen_at could be both { EXT_IP4, EXT_PORT } and { INT_IP4, INT_PORT }.
See test_multi_prog_lookup().
> + if (CHECK(client_fd < 0 && !t->expect_errno, "connect",
> "unexpected error %d\n", errno))
> - goto out_close_client;
> - if (CHECK(err && t->expect_errno && errno != t->expect_errno,
> + goto out_close_server;
> + if (CHECK(client_fd < 0 && t->expect_errno && errno != t->expect_errno,
> "connect", "unexpected error %d\n", errno))
> - goto out_close_client;
> + goto out_close_server;
>
> done = 0;
> prog_idx = PROG1;
[...]
next prev parent reply other threads:[~2024-06-21 20:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 10:35 [PATCH bpf-next 0/6] use network helpers, part 8 Geliang Tang
2024-06-21 10:35 ` [PATCH bpf-next 1/6] selftests/bpf: Use start_server in sockmap_ktls Geliang Tang
2024-06-21 20:44 ` Eduard Zingerman
2024-06-21 10:35 ` [PATCH bpf-next 2/6] selftests/bpf: Use connect_to_fd " Geliang Tang
2024-06-21 20:44 ` Eduard Zingerman
2024-06-21 10:35 ` [PATCH bpf-next 3/6] selftests/bpf: Use start_server_str in sk_lookup Geliang Tang
2024-06-21 20:44 ` Eduard Zingerman
2024-06-21 10:35 ` [PATCH bpf-next 4/6] selftests/bpf: Drop inetaddr_len " Geliang Tang
2024-06-21 10:35 ` [PATCH bpf-next 5/6] selftests/bpf: Use connect_to_fd " Geliang Tang
2024-06-21 20:44 ` Eduard Zingerman [this message]
2024-06-21 10:35 ` [PATCH bpf-next 6/6] selftests/bpf: Drop make_socket " Geliang Tang
2024-06-21 20:45 ` Eduard Zingerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f76e30b4a298dd8403e661cece6735b398f5b1e.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=geliang@kernel.org \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mykolal@fb.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=tanggeliang@kylinos.cn \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox