Adding new bpf helper which would allow us to manipulate xdp's data_end pointer, and allow us to reduce packet's size indended use case: to generate ICMP messages from XDP context, where such message would contain truncated original packet.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -755,6 +755,13 @@ union bpf_attr { · 754 unmodified lines | ||
| 755 | 755 | * @addr: pointer to struct sockaddr to bind socket to |
| 756 | 756 | * @addr_len: length of sockaddr structure |
| 757 | 757 | * Return: 0 on success or negative error code |
| 758 | + * | |
| 759 | + * int bpf_xdp_adjust_tail(xdp_md, delta) | |
| 760 | + * Adjust the xdp_md.data_end by delta. Only shrinking of packet's | |
| 761 | + * size is supported. | |
| 762 | + * @xdp_md: pointer to xdp_md | |
| 763 | + * @delta: A negative integer to be added to xdp_md.data_end | |
| 764 | + * Return: 0 on success or negative on error | |
| 758 | 765 | */ |
| 759 | 766 | #define __BPF_FUNC_MAPPER(FN) \ |
| 760 | 767 | FN(unspec), \ |
| @@ -821,7 +828,8 @@ union bpf_attr { · 60 unmodified lines | ||
| 821 | 828 | FN(msg_apply_bytes), \ |
| 822 | 829 | FN(msg_cork_bytes), \ |
| 823 | 830 | FN(msg_pull_data), \ |
| 824 | − FN(bind), | |
| 831 | + FN(bind), \ | |
| 832 | + FN(xdp_adjust_tail), | |
| 825 | 833 | |
| 826 | 834 | /* integer value in 'imm' field of BPF_CALL instruction selects which helper |
| 827 | 835 | * function eBPF program intends to call |