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