History

bpf: adding bpf_xdp_adjust_tail helper

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.

Nikita V. Shirokov committed 8 years ago

Commit b32cc5b1 parent 0c90f222 files · +37 −2Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+9−1
@@ -755,6 +755,13 @@ union bpf_attr { · 754 unmodified lines
755 * @addr: pointer to struct sockaddr to bind socket to755 * @addr: pointer to struct sockaddr to bind socket to
756 * @addr_len: length of sockaddr structure756 * @addr_len: length of sockaddr structure
757 * Return: 0 on success or negative error code757 * 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#define __BPF_FUNC_MAPPER(FN) \766#define __BPF_FUNC_MAPPER(FN) \
760 FN(unspec), \767 FN(unspec), \
@@ -821,7 +828,8 @@ union bpf_attr { · 60 unmodified lines
821 FN(msg_apply_bytes), \828 FN(msg_apply_bytes), \
822 FN(msg_cork_bytes), \829 FN(msg_cork_bytes), \
823 FN(msg_pull_data), \830 FN(msg_pull_data), \
824 FN(bind),831 FN(bind), \
832 FN(xdp_adjust_tail),
825 833
826/* integer value in 'imm' field of BPF_CALL instruction selects which helper834/* integer value in 'imm' field of BPF_CALL instruction selects which helper
827 * function eBPF program intends to call835 * function eBPF program intends to call

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t