From: John Fastabend <john.fastabend@gmail.com>
To: Y Song <ys114321@gmail.com>
Cc: edumazet@google.com, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
netdev <netdev@vger.kernel.org>
Subject: Re: [bpf PATCH 3/3] bpf: test_maps, only support ESTABLISHED socks
Date: Mon, 17 Sep 2018 21:38:05 -0700 [thread overview]
Message-ID: <ee1a66e1-5edd-c49e-d62b-8d1a7546a7de@gmail.com> (raw)
In-Reply-To: <CAH3MdRUrTBB=bDW6T3Nh9-3QaGm7ciyoEwB2G3SMw_QnJvr_MA@mail.gmail.com>
On 09/17/2018 02:21 PM, Y Song wrote:
> On Mon, Sep 17, 2018 at 10:33 AM John Fastabend
> <john.fastabend@gmail.com> wrote:
>>
>> Ensure that sockets added to a sock{map|hash} that is not in the
>> ESTABLISHED state is rejected.
>>
>> Fixes: 1aa12bdf1bfb ("bpf: sockmap, add sock close() hook to remove socks")
>> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
>> ---
>> tools/testing/selftests/bpf/test_maps.c | 10 +++++++---
>> 1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
>> index 6f54f84..0f2090f 100644
>> --- a/tools/testing/selftests/bpf/test_maps.c
>> +++ b/tools/testing/selftests/bpf/test_maps.c
>> @@ -580,7 +580,11 @@ static void test_sockmap(int tasks, void *data)
>> /* Test update without programs */
>> for (i = 0; i < 6; i++) {
>> err = bpf_map_update_elem(fd, &i, &sfd[i], BPF_ANY);
>> - if (err) {
>> + if (i < 2 && !err) {
>> + printf("Allowed update sockmap '%i:%i' not in ESTABLISHED\n",
>> + i, sfd[i]);
>> + goto out_sockmap;
>> + } else if (i > 1 && err) {
>
> Just a nit. Maybe "i >= 2" since it will be more clear since it is
> opposite of "i < 2"?
>
Seems reasonable changed in v3 to 'i >= 2'. Thanks.
prev parent reply other threads:[~2018-09-18 10:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-17 17:31 [bpf PATCH 0/3] bpf, sockmap ESTABLISHED state only John Fastabend
2018-09-17 17:31 ` [bpf PATCH 1/3] bpf: sockmap only allow ESTABLISHED sock state John Fastabend
2018-09-17 20:49 ` Y Song
2018-09-17 17:31 ` [bpf PATCH 2/3] bpf: sockmap, fix transition through disconnect without close John Fastabend
2018-09-17 21:09 ` Y Song
2018-09-18 4:40 ` John Fastabend
2018-09-17 17:32 ` [bpf PATCH 3/3] bpf: test_maps, only support ESTABLISHED socks John Fastabend
2018-09-17 21:21 ` Y Song
2018-09-18 4:38 ` John Fastabend [this message]
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=ee1a66e1-5edd-c49e-d62b-8d1a7546a7de@gmail.com \
--to=john.fastabend@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=netdev@vger.kernel.org \
--cc=ys114321@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).