New BPF helpers to accelerate synproxy
Subsystems (9)
v3 cover New BPF helpers to accelerate synproxy
The first patch of this series is an improvement to the existing syncookie BPF helper. The second patch is a documentation fix.
The third patch allows BPF helpers to accept memory regions of fixed size without doing runtime size checks.
The two last patches add new functionality that allows XDP to accelerate iptables synproxy.
v1 of this series [1] used to include a patch that exposed conntrack lookup to BPF using stable helpers. It was superseded by series [2] by Kumar Kartikeya Dwivedi, which implements this functionality using unstable helpers.
The fourth patch adds new helpers to issue and check SYN cookies without binding to a socket, which is useful in the synproxy scenario.
The fifth patch adds a selftest, which consists of a script, an XDP program and a userspace control application. The XDP program uses socketless SYN cookie helpers and queries conntrack status instead of socket status. The userspace control application allows to tune parameters of the XDP program. This program also serves as a minimal example of usage of the new functionality.
The draft of the new functionality was presented on Netdev 0x15 [3].
v2 changes:
Split into two series, submitted bugfixes to bpf, dropped the conntrack patches, implemented the timestamp cookie in BPF using bpf_loop, dropped the timestamp cookie patch.
v3 changes:
Moved some patches from bpf to bpf-next, dropped the patch that changed error codes, split the new helpers into IPv4/IPv6, added verifier functionality to accept memory regions of fixed size.
[1]: https://lore.kernel.org/bpf/[email protected]/t/
[2]: https://lore.kernel.org/bpf/[email protected]/
[3]: https://netdevconf.info/0x15/session.html?Accelerating-synproxy-with-XDP
Maxim Mikityanskiy (5):
bpf: Use ipv6_only_sock in bpf_tcp_gen_syncookie
bpf: Fix documentation of th_len in bpf_tcp_{gen,check}_syncookie
bpf: Allow helpers to accept pointers with a fixed size
bpf: Add helpers to issue and check SYN cookies in XDP
bpf: Add selftests for raw syncookie helpers
include/linux/bpf.h | 10 + include/net/tcp.h | 1 + include/uapi/linux/bpf.h | 100 ++- kernel/bpf/verifier.c | 26 +- net/core/filter.c | 128 ++- net/ipv4/tcp_input.c | 3 +- scripts/bpf_doc.py | 4 + tools/include/uapi/linux/bpf.h | 100 ++- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile | 5 +- .../selftests/bpf/progs/xdp_synproxy_kern.c | 750 ++++++++++++++++++ .../selftests/bpf/test_xdp_synproxy.sh | 71 ++ tools/testing/selftests/bpf/xdp_synproxy.c | 418 ++++++++++ 13 files changed, 1594 insertions(+), 23 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/xdp_synproxy_kern.c create mode 100755 tools/testing/selftests/bpf/test_xdp_synproxy.sh create mode 100644 tools/testing/selftests/bpf/xdp_synproxy.c
Signature · 1 line
2.30.2
PATCH v3 1/5 bpf: Use ipv6_only_sock in bpf_tcp_gen_syncookie
Instead of querying the sk_ipv6only field directly, use the dedicated ipv6_only_sock helper.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -7090,7 +7090,7 @@ BPF_CALL_5(bpf_tcp_gen_syncookie, struct sock *, sk, void *, iph, u32, iph_len,*/ switch (((struct iphdr *)iph)->version) {case 4 : -if (sk->sk_family ==AF_INET6 && sk->sk_ipv6only) +if (sk->sk_family ==AF_INET6 &&ipv6_only_sock (sk))return -EINVAL ; mss =tcp_v4_get_syncookie (sk, iph, th, &cookie);
Signature · 1 line
2.30.2
PATCH v3 2/5 bpf: Fix documentation of th_len in bpf_tcp_{gen,check}_syncookie
In reply to Maxim Mikityanskiybpf_tcp_gen_syncookie expects the full length of the TCP header (with all options), and bpf_tcp_check_syncookie accepts lengths bigger than sizeof(struct tcphdr). Fix the documentation that says these lengths should be exactly sizeof(struct tcphdr).
While at it, fix a typo in the name of struct ipv6hdr.
--- include/uapi/linux/bpf.h | 10 ++++++---- tools/include/uapi/linux/bpf.h | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-)
include/uapi/linux/bpf.h +6 -4
@@ -3570,10 +3570,11 @@ union bpf_attr {* * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or -* **sizeof**\ (**struct ip6hdr**). +* **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* -* contains **sizeof**\ (**struct tcphdr**). +* contains the length of the TCP header (at least +* **sizeof**\ (**struct tcphdr**)). * Return * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative * error otherwise.
@@ -3756,10 +3757,11 @@ union bpf_attr {* * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or -* **sizeof**\ (**struct ip6hdr**). +* **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* -* contains the length of the TCP header. +* contains the length of the TCP header with options (at least +* **sizeof**\ (**struct tcphdr**)). * Return * On success, lower 32 bits hold the generated SYN cookie in * followed by 16 bits which hold the MSS value for that cookie,
tools/include/uapi/linux/bpf.h +6 -4
@@ -3570,10 +3570,11 @@ union bpf_attr {* * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or -* **sizeof**\ (**struct ip6hdr**). +* **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* -* contains **sizeof**\ (**struct tcphdr**). +* contains the length of the TCP header (at least +* **sizeof**\ (**struct tcphdr**)). * Return * 0 if *iph* and *th* are a valid SYN cookie ACK, or a negative * error otherwise.
@@ -3756,10 +3757,11 @@ union bpf_attr {* * *iph* points to the start of the IPv4 or IPv6 header, while * *iph_len* contains **sizeof**\ (**struct iphdr**) or -* **sizeof**\ (**struct ip6hdr**). +* **sizeof**\ (**struct ipv6hdr**). * * *th* points to the start of the TCP header, while *th_len* -* contains the length of the TCP header. +* contains the length of the TCP header with options (at least +* **sizeof**\ (**struct tcphdr**)). * Return * On success, lower 32 bits hold the generated SYN cookie in * followed by 16 bits which hold the MSS value for that cookie,
Signature · 1 line
2.30.2
PATCH v3 3/5 bpf: Allow helpers to accept pointers with a fixed size
In reply to Maxim MikityanskiyBefore this commit, the BPF verifier required ARG_PTR_TO_MEM arguments to be followed by ARG_CONST_SIZE holding the size of the memory region. The helpers had to check that size in runtime.
There are cases where the size expected by a helper is a compile-time constant. Checking it in runtime is an unnecessary overhead and waste of BPF registers.
This commit allows helpers to accept ARG_PTR_TO_MEM arguments without the corresponding ARG_CONST_SIZE, given that they define the memory region size in struct bpf_func_proto.
--- include/linux/bpf.h | 10 ++++++++++ kernel/bpf/verifier.c | 26 +++++++++++++++----------- 2 files changed, 25 insertions(+), 11 deletions(-)
include/linux/bpf.h +10 -0
@@ -457,6 +457,16 @@ struct bpf_func_proto { };u32 *arg_btf_id[5 ]; }; +union { +struct { +size_t arg1_size; +size_t arg2_size; +size_t arg3_size; +size_t arg4_size; +size_t arg5_size; + }; +size_t arg_size[5 ]; + };int *ret_btf_id;/* return value btf_id */ bool (*allowed)(const struct bpf_prog *prog); };
kernel/bpf/verifier.c +15 -11
@@ -5529,6 +5529,11 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 arg,* next is_mem_size argument below. */ meta->raw_mode = (arg_type ==ARG_PTR_TO_UNINIT_MEM ); +if (fn->arg_size[arg]) { + err =check_helper_mem_access (env, regno, + fn->arg_size[arg], false, + meta); + } }else if (arg_type_is_mem_size (arg_type)) {bool zero_size_allowed = (arg_type ==ARG_CONST_SIZE_OR_ZERO );
@@ -5868,13 +5873,12 @@ static bool check_raw_mode_ok(const struct bpf_func_proto *fn)return count <=1 ; } -static bool check_args_pair_invalid (enum bpf_arg_type arg_curr, -enum bpf_arg_type arg_next) +static bool check_args_pair_invalid (const struct bpf_func_proto *fn,int arg) { -return (arg_type_is_mem_ptr (arg_curr) && - !arg_type_is_mem_size (arg_next)) || - (!arg_type_is_mem_ptr (arg_curr) && -arg_type_is_mem_size (arg_next)); +if (arg_type_is_mem_ptr (fn->arg_type[arg])) +return arg_type_is_mem_size (fn->arg_type[arg +1 ]) == + !!fn->arg_size[arg]; +return arg_type_is_mem_size (fn->arg_type[arg +1 ]) || fn->arg_size[arg]; }static bool check_arg_pair_ok (const struct bpf_func_proto *fn)
@@ -5885,11 +5889,11 @@ static bool check_arg_pair_ok(const struct bpf_func_proto *fn)* helper function specification. */ if (arg_type_is_mem_size (fn->arg1_type) || -arg_type_is_mem_ptr (fn->arg5_type) || -check_args_pair_invalid (fn->arg1_type, fn->arg2_type) || -check_args_pair_invalid (fn->arg2_type, fn->arg3_type) || -check_args_pair_invalid (fn->arg3_type, fn->arg4_type) || -check_args_pair_invalid (fn->arg4_type, fn->arg5_type)) + (arg_type_is_mem_ptr (fn->arg5_type) && !fn->arg5_size) || +check_args_pair_invalid (fn,1 ) || +check_args_pair_invalid (fn,2 ) || +check_args_pair_invalid (fn,3 ) || +check_args_pair_invalid (fn,4 ))return false;return true;
Signature · 1 line
2.30.2
PATCH v3 4/5 bpf: Add helpers to issue and check SYN cookies in XDP
In reply to Maxim MikityanskiyThe new helpers bpf_tcp_raw_{gen,check}_syncookie_ipv{4,6} allow an XDP program to generate SYN cookies in response to TCP SYN packets and to check those cookies upon receiving the first ACK packet (the final packet of the TCP handshake).
Unlike bpf_tcp_{gen,check}_syncookie these new helpers don't need a listening socket on the local machine, which allows to use them together with synproxy to accelerate SYN cookie generation.
--- include/net/tcp.h | 1 + include/uapi/linux/bpf.h | 90 +++++++++++++++++++++++ net/core/filter.c | 126 +++++++++++++++++++++++++++++++++ net/ipv4/tcp_input.c | 3 +- scripts/bpf_doc.py | 4 ++ tools/include/uapi/linux/bpf.h | 90 +++++++++++++++++++++++ 6 files changed, 313 insertions(+), 1 deletion(-)
include/net/tcp.h +1 -0
@@ -432,6 +432,7 @@ u16 tcp_v4_get_syncookie(struct sock *sk, struct iphdr *iph, struct tcphdr *th, u32 *cookie);u16 tcp_v6_get_syncookie (struct sock *sk,struct ipv6hdr *iph,struct tcphdr *th,u32 *cookie); +u16 tcp_parse_mss_option (const struct tcphdr *th,u16 user_mss);u16 tcp_get_syncookie_mss (struct request_sock_ops *rsk_ops,const struct tcp_request_sock_ops *af_ops,struct sock *sk,struct tcphdr *th);
include/uapi/linux/bpf.h +90 -0
102 lines not on this page · raw message
net/core/filter.c +126 -0
138 lines not on this page · raw message
net/ipv4/tcp_input.c +2 -1
@@ -3963,7 +3963,7 @@ static bool smc_parse_options(const struct tcphdr *th,/* Try to parse the MSS option from the TCP header. Return 0 on failure, clamped * value on success. */ -static u16 tcp_parse_mss_option (const struct tcphdr *th,u16 user_mss) +u16 tcp_parse_mss_option (const struct tcphdr *th,u16 user_mss) {const unsigned char *ptr = (const unsigned char *)(th +1 );int length = (th->doff *4 ) -sizeof (struct tcphdr );
@@ -4002,6 +4002,7 @@ static u16 tcp_parse_mss_option(const struct tcphdr *th, u16 user_mss) }return mss; } +EXPORT_SYMBOL_GPL (tcp_parse_mss_option);/* Look for tcp options. Normally only called on SYN and SYNACK packets. * But, this can also be called on packets in the established flow when
scripts/bpf_doc.py +4 -0
@@ -633,6 +633,8 @@ class PrinterHelpers(Printer): 'struct socket', 'struct file', 'struct bpf_timer', + 'struct iphdr', + 'struct ipv6hdr', ] known_types = { '...',
@@ -682,6 +684,8 @@ class PrinterHelpers(Printer): 'struct socket', 'struct file', 'struct bpf_timer', + 'struct iphdr', + 'struct ipv6hdr', } mapped_types = { 'u8': '__u8',
tools/include/uapi/linux/bpf.h +90 -0
102 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH bpf-next v3 4/5] bpf: Add helpers to issue and check SYN cookies in XDP
net/core/filter.c xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · line 7927
Quoted 13 lines · Maxim Mikityanskiy
net/core/filter.c +8
-0@@ -7798,6 +7916,14 @@ xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)return &bpf_tcp_check_syncookie_proto;case BPF_FUNC_tcp_gen_syncookie:return &bpf_tcp_gen_syncookie_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv4: +return &bpf_tcp_raw_gen_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv6: +return &bpf_tcp_raw_gen_syncookie_ipv6_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv4: +return &bpf_tcp_raw_check_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv6: +return &bpf_tcp_raw_check_syncookie_ipv6_proto;#endif
I understand that the main use case for new helpers is XDP specific, but why limit them to XDP?
The feature looks generic and applicable to skb too.
RE: [PATCH bpf-next v3 4/5] bpf: Add helpers to issue and check SYN cookies in XDP
Quoted 7 lines
-----Original Message-----
From: Alexei Starovoitov <[email protected]>
Sent: 27 February, 2022 05:25Review xdp_func_proto(enum bpf_func_id func_id, const
Quoted 1 line · Maxim Mikityanskiy
(quoted diff) +0
-0@@ -7798,6 +7916,14 @@ xdp_func_proto(enum bpf_func_id func_id, conststruct
bpf_prog*prog)
Quoted 16 lines
net/core/filter.c xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · line 7927
Quoted 12 lines
net/core/filter.c +8
-0return &bpf_tcp_check_syncookie_proto;case BPF_FUNC_tcp_gen_syncookie:return &bpf_tcp_gen_syncookie_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv4: +return &bpf_tcp_raw_gen_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv6: +return &bpf_tcp_raw_gen_syncookie_ipv6_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv4: +return &bpf_tcp_raw_check_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv6: +return &bpf_tcp_raw_check_syncookie_ipv6_proto;#endif I understand that the main use case for new helpers is XDP specific, but why limit them to XDP?
The feature looks generic and applicable to skb too.
That sounds like an extra feature, rather than a limitation. That's out of scope of what I planned to do.
Besides, it sounds kind of useless to me, because the intention of the new helpers is to accelerate synproxy, and I doubt BPF over SKBs will accelerate anything. Maybe someone else has another use case for these helpers and SKBs - in that case I leave the opportunity to add this feature up to them.
Re: [PATCH bpf-next v3 4/5] bpf: Add helpers to issue and check SYN cookies in XDP
Quoted 25 lines · Maxim Mikityanskiy
Quoted 21 lines
-----Original Message-----
From: Alexei Starovoitov <[email protected]>
Sent: 27 February, 2022 05:25Review xdp_func_proto(enum bpf_func_id func_id, const
Quoted 1 line · Maxim Mikityanskiy
(quoted diff) +0
-0@@ -7798,6 +7916,14 @@ xdp_func_proto(enum bpf_func_id func_id, conststruct
bpf_prog*prog)net/core/filter.c xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · line 7927
Quoted 12 lines
net/core/filter.c +8
-0return &bpf_tcp_check_syncookie_proto;case BPF_FUNC_tcp_gen_syncookie:return &bpf_tcp_gen_syncookie_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv4: +return &bpf_tcp_raw_gen_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv6: +return &bpf_tcp_raw_gen_syncookie_ipv6_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv4: +return &bpf_tcp_raw_check_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv6: +return &bpf_tcp_raw_check_syncookie_ipv6_proto;#endif Quoted 3 lines
I understand that the main use case for new helpers is XDP specific, but why limit them to XDP?
The feature looks generic and applicable to skb too.
Quoted 8 lines
That sounds like an extra feature, rather than a limitation. That's out of scope of what I planned to do.
Besides, it sounds kind of useless to me, because the intention of the new helpers is to accelerate synproxy, and I doubt BPF over SKBs will accelerate anything. Maybe someone else has another use case for these helpers and SKBs - in that case I leave the opportunity to add this feature up to them.
This patchset will not be accepted until the feature is generalized to both xdp and skb and tested for both.
"I dont have a use case for it" is not an excuse to narrow down the scope.
RE: [PATCH bpf-next v3 4/5] bpf: Add helpers to issue and check SYN cookies in XDP
Quoted 39 lines
-----Original Message-----
From: Alexei Starovoitov <[email protected]>Quoted 25 lines · Maxim Mikityanskiy
Quoted 21 lines
-----Original Message-----
From: Alexei Starovoitov <[email protected]>
Sent: 27 February, 2022 05:25Review xdp_func_proto(enum bpf_func_id func_id, const
Quoted 1 line · Maxim Mikityanskiy
(quoted diff) +0
-0@@ -7798,6 +7916,14 @@ xdp_func_proto(enum bpf_func_id func_id, conststruct
bpf_prog*prog)net/core/filter.c xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · line 7927
Quoted 12 lines
net/core/filter.c +8
-0return &bpf_tcp_check_syncookie_proto;case BPF_FUNC_tcp_gen_syncookie:return &bpf_tcp_gen_syncookie_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv4: +return &bpf_tcp_raw_gen_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_gen_syncookie_ipv6: +return &bpf_tcp_raw_gen_syncookie_ipv6_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv4: +return &bpf_tcp_raw_check_syncookie_ipv4_proto; +case BPF_FUNC_tcp_raw_check_syncookie_ipv6: +return &bpf_tcp_raw_check_syncookie_ipv6_proto;#endif Quoted 3 lines
I understand that the main use case for new helpers is XDP specific, but why limit them to XDP?
The feature looks generic and applicable to skb too.Quoted 8 lines
That sounds like an extra feature, rather than a limitation. That's out of scope of what I planned to do.
Besides, it sounds kind of useless to me, because the intention of the new helpers is to accelerate synproxy, and I doubt BPF over SKBs will accelerate anything. Maybe someone else has another use case for these helpers and SKBs - in that case I leave the opportunity to add this feature up to them.
Quoted 3 lines
This patchset will not be accepted until the feature is generalized to both xdp and skb and tested for both.
"I dont have a use case for it" is not an excuse to narrow down the scope.
I'm not narrowing down the scope. It was defined from the very
beginning: accelerating synproxy with XDP. Asking me to add SKB support is extending the scope and making me develop extra things.
It's a well-known fact that features aren't added to the kernel if there is no user. Sometimes, features without users (or with few users) are even removed. Could you elaborate why you require me to develop a feature that no one is going to use?
In my opinion, the whole review process of this series has many unhealthy points:
1. I'm constantly requested to increase the scope.
1.1. Split the helpers not related to the feature.
1.2. Add new functionality to the verifier to accept memory regions of fixed size.
1.3. Add support for SKB.
2. I'm requested to rewrite the same code multiple times, every time in a new way.
2.1. I had to rewrite the sample into a selftest, then into a different kind of a selftest. It's not obvious that standalone selftests are deprecated (am I blind, or is it not documented anywhere?), there are a lot of such tests already existing. Instead of saying it from the beginning that the test must use the test_progs runner, you waited until I implement a standalone one.
3. I receive comments on old code that passed a few iterations of the review.
3.1. SKB support was never part of the feature, and the series passed two iterations, but not the third.
3.2. Standalone selftest was OK in v2, but suddenly got unacceptable in v3.
PATCH v3 5/5 bpf: Add selftests for raw syncookie helpers
In reply to Maxim MikityanskiyThis commit adds selftests for the new BPF helpers:
bpf_tcp_raw_{gen,check}_syncookie_ipv{4,6}.
xdp_synproxy_kern.c is a BPF program that generates SYN cookies on allowed TCP ports and sends SYNACKs to clients, accelerating synproxy iptables module.
xdp_synproxy.c is a userspace control application that allows to configure the following options in runtime: list of allowed ports, MSS, window scale, TTL.
test_xdp_synproxy.sh is a script that demonstrates the setup of synproxy with XDP acceleration and serves as a selftest for the new feature.
--- tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile | 5 +- .../selftests/bpf/progs/xdp_synproxy_kern.c | 750 ++++++++++++++++++ .../selftests/bpf/test_xdp_synproxy.sh | 71 ++ tools/testing/selftests/bpf/xdp_synproxy.c | 418 ++++++++++ 5 files changed, 1243 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/xdp_synproxy_kern.c create mode 100755 tools/testing/selftests/bpf/test_xdp_synproxy.sh create mode 100644 tools/testing/selftests/bpf/xdp_synproxy.c
tools/testing/selftests/bpf/.gitignore +1 -0
@@ -42,3 +42,4 @@ test_cpp *.tmp xdpxceiver xdp_redirect_multi +xdp_synproxy
tools/testing/selftests/bpf/Makefile +3 -2
@@ -72,7 +72,8 @@ TEST_PROGS := test_kmod.sh \ test_bpftool.sh \ test_bpftool_metadata.sh \ test_doc_build.sh \ - test_xsk.sh + test_xsk.sh \ + test_xdp_synproxy.sh TEST_PROGS_EXTENDED := with_addr.sh \ with_tunnels.sh \
@@ -82,7 +83,7 @@ TEST_PROGS_EXTENDED := with_addr.sh \ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ test_lirc_mode2_user xdping test_cpp runqslower bench bpf_testmod.ko \ - xdpxceiver xdp_redirect_multi + xdpxceiver xdp_redirect_multi xdp_synproxy TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read
tools/testing/selftests/bpf/progs/xdp_synproxy_kern.c new file +750 -0
750 lines not on this page · raw message
tools/testing/selftests/bpf/test_xdp_synproxy.sh new file +71 -0
71 lines not on this page · raw message
tools/testing/selftests/bpf/xdp_synproxy.c new file +418 -0
418 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH bpf-next v3 5/5] bpf: Add selftests for raw syncookie helpers
Quoted 7 lines · Maxim Mikityanskiy
This commit adds selftests for the new BPF helpers:
bpf_tcp_raw_{gen,check}_syncookie_ipv{4,6}.
xdp_synproxy_kern.cis a BPF program that generates SYN cookies on allowed TCP ports and sends SYNACKs to clients, accelerating synproxy iptables module.
Quoted 6 lines
xdp_synproxy.cis a userspace control application that allows to configure the following options in runtime: list of allowed ports, MSS, window scale, TTL.
test_xdp_synproxy.shis a script that demonstrates the setup of synproxy with XDP acceleration and serves as a selftest for the new feature.
Please convert the test into test_progs runner.
We don't accept standalone tests anymore.