1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
3 #include <network_helpers.h>
5 void test_xdp_adjust_tail(void)
7 const char *file = "./test_adjust_tail.o";
8 struct bpf_object *obj;
10 __u32 duration, retval, size;
13 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
17 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
18 buf, &size, &retval, &duration);
20 CHECK(err || retval != XDP_DROP,
21 "ipv4", "err %d errno %d retval %d size %d\n",
22 err, errno, retval, size);
24 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6),
25 buf, &size, &retval, &duration);
26 CHECK(err || retval != XDP_TX || size != 54,
27 "ipv6", "err %d errno %d retval %d size %d\n",
28 err, errno, retval, size);
29 bpf_object__close(obj);