This source file includes following definitions.
- test_xdp_adjust_tail
1
2 #include <test_progs.h>
3
4 void test_xdp_adjust_tail(void)
5 {
6 const char *file = "./test_adjust_tail.o";
7 struct bpf_object *obj;
8 char buf[128];
9 __u32 duration, retval, size;
10 int err, prog_fd;
11
12 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
13 if (CHECK_FAIL(err))
14 return;
15
16 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
17 buf, &size, &retval, &duration);
18
19 CHECK(err || retval != XDP_DROP,
20 "ipv4", "err %d errno %d retval %d size %d\n",
21 err, errno, retval, size);
22
23 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6),
24 buf, &size, &retval, &duration);
25 CHECK(err || retval != XDP_TX || size != 54,
26 "ipv6", "err %d errno %d retval %d size %d\n",
27 err, errno, retval, size);
28 bpf_object__close(obj);
29 }