bpf: making bpf_prog_test run aware of possible data_end ptr change
after introduction of bpf_xdp_adjust_tail helper packet length could be changed not only if xdp->data pointer has been changed but xdp->data_end as well. making bpf_prog_test_run aware of this possibility Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
6870de435b
commit
587b80cce9
|
@ -170,7 +170,8 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
|
|||
xdp.rxq = &rxqueue->xdp_rxq;
|
||||
|
||||
retval = bpf_test_run(prog, &xdp, repeat, &duration);
|
||||
if (xdp.data != data + XDP_PACKET_HEADROOM + NET_IP_ALIGN)
|
||||
if (xdp.data != data + XDP_PACKET_HEADROOM + NET_IP_ALIGN ||
|
||||
xdp.data_end != xdp.data + size)
|
||||
size = xdp.data_end - xdp.data;
|
||||
ret = bpf_test_finish(kattr, uattr, xdp.data, size, retval, duration);
|
||||
kfree(data);
|
||||
|
|
Loading…
Reference in New Issue