3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-01-31 15:22:18 +00:00
Brooklyn/tools/testing/selftests/bpf/prog_tests/skb_helpers.c
Scare Crowe d2ebfd0519 QortalOS Titan 5.60.12
Screw the description like that inbred T3Q
2022-03-05 21:17:59 +05:00

31 lines
742 B
C

// SPDX-License-Identifier: GPL-2.0
#include <test_progs.h>
#include <network_helpers.h>
void test_skb_helpers(void)
{
struct __sk_buff skb = {
.wire_len = 100,
.gso_segs = 8,
.gso_size = 10,
};
struct bpf_prog_test_run_attr tattr = {
.data_in = &pkt_v4,
.data_size_in = sizeof(pkt_v4),
.ctx_in = &skb,
.ctx_size_in = sizeof(skb),
.ctx_out = &skb,
.ctx_size_out = sizeof(skb),
};
struct bpf_object *obj;
int err;
err = bpf_prog_test_load("./test_skb_helpers.o", BPF_PROG_TYPE_SCHED_CLS, &obj,
&tattr.prog_fd);
if (CHECK_ATTR(err, "load", "err %d errno %d\n", err, errno))
return;
err = bpf_prog_test_run_xattr(&tattr);
CHECK_ATTR(err, "len", "err %d errno %d\n", err, errno);
bpf_object__close(obj);
}