[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84d1ab6f-339f-c3f1-4dc3-69043a889b65@linux.dev>
Date: Mon, 16 Oct 2023 22:50:44 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: Kuniyuki Iwashima <kuni1840@...il.com>, bpf@...r.kernel.org,
netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, David Ahern <dsahern@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>
Subject: Re: [PATCH v1 bpf-next 11/11] selftest: bpf: Test
BPF_SOCK_OPS_(GEN|CHECK)_SYNCOOKIE_CB.
On 10/13/23 3:04 PM, Kuniyuki Iwashima wrote:
> This patch adds a test for BPF_SOCK_OPS_(GEN|CHECK)_SYNCOOKIE_CB hooks.
>
> BPF_SOCK_OPS_GEN_SYNCOOKIE_CB hook generates a hash using SipHash from
> based on 4-tuple. The hash is split into ISN and TS. MSS, ECN, SACK,
> and WScale are encoded into the lower 8-bits of ISN.
>
> ISN:
> MSB LSB
> | 31 ... 8 | 7 6 | 5 | 4 | 3 2 1 0 |
> | Hash_1 | MSS | ECN | SACK | WScale |
>
> TS:
> MSB LSB
> | 31 ... 8 | 7 ... 0 |
> | Random | Hash_2 |
>
> BPF_SOCK_OPS_CHECK_SYNCOOKIE_CB hook re-calculates the hash and validates
> the cookie.
>
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
> Currently, the validator is incomplete...
>
> If this line is changed
>
> skops->replylong[0] = msstab[3];
>
> to
> skops->replylong[0] = msstab[mssind];
>
> , we will get the error below during make:
>
> GEN-SKEL [test_progs] test_tcp_syncookie.skel.h
> ...
> Error: failed to open BPF object file: No such file or directory
I cannot reprod. Does it have error earlier than this? GEN-SKEL is probably
running this (make V=1 can tell):
tools/testing/selftests/bpf/tools/sbin/bpftool gen skeleton
tools/testing/selftests/bpf/test_tcp_syncookie.bpf.linked3.o name
test_tcp_syncookie > tools/testing/selftests/bpf/test_tcp_syncookie.skel.h
Add a "-d" to bpftool for more debug output: bpftool -d gen skeleton....
I cannot compile the patch in my environment as-is also:
In file included from progs/test_tcp_syncookie.c:6:
In file included from
/data/users/kafai/fb-kernel/linux/tools/include/uapi/linux/tcp.h:22:
In file included from /usr/include/asm/byteorder.h:5:
In file included from /usr/include/linux/byteorder/little_endian.h:13:
/usr/include/linux/swab.h:136:8: error: unknown type name '__always_inline'
136 | static __always_inline unsigned long __swab(const unsigned long y)
I have to add a "#include <linux/stddef.h>".
> GEN-SKEL [test_progs-no_alu32] test_tcp_syncookie.skel.h
> make: *** [Makefile:603: /home/ec2-user/kernel/bpf_syncookie/tools/testing/selftests/bpf/test_tcp_syncookie.skel.h] Error 254
> make: *** Deleting file '/home/ec2-user/kernel/bpf_syncookie/tools/testing/selftests/bpf/test_tcp_syncookie.skel.h'
> make: *** Waiting for unfinished jobs....
Powered by blists - more mailing lists