1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
3 #include <network_helpers.h>
5 void test_pkt_access(void)
7 const char *file
= "./test_pkt_access.o";
8 struct bpf_object
*obj
;
9 __u32 duration
, retval
;
12 err
= bpf_prog_load(file
, BPF_PROG_TYPE_SCHED_CLS
, &obj
, &prog_fd
);
16 err
= bpf_prog_test_run(prog_fd
, 100000, &pkt_v4
, sizeof(pkt_v4
),
17 NULL
, NULL
, &retval
, &duration
);
18 CHECK(err
|| retval
, "ipv4",
19 "err %d errno %d retval %d duration %d\n",
20 err
, errno
, retval
, duration
);
22 err
= bpf_prog_test_run(prog_fd
, 100000, &pkt_v6
, sizeof(pkt_v6
),
23 NULL
, NULL
, &retval
, &duration
);
24 CHECK(err
|| retval
, "ipv6",
25 "err %d errno %d retval %d duration %d\n",
26 err
, errno
, retval
, duration
);
27 bpf_object__close(obj
);