History

bpf: sync tools bpf.h uapi header

Only sync the header from include/uapi/linux/bpf.h.

Daniel Borkmann committed 8 years ago

Commit 32b36521 parent 24dea041 file · +32 −1Browse files

Showing the changes to tools/include/uapi/linux (1 of 1 file). Show all

Unified · Split

tools/include/uapi/linux/bpf.h+32−1
@@ -1801,6 +1801,30 @@ union bpf_attr { · 1800 unmodified lines
18011801 * Return
18021802 * a non-negative value equal to or less than size on success, or
18031803 * a negative error in case of failure.
1804+ *
1805+ * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header)
1806+ * Description
1807+ * This helper is similar to **bpf_skb_load_bytes**\ () in that
1808+ * it provides an easy way to load *len* bytes from *offset*
1809+ * from the packet associated to *skb*, into the buffer pointed
1810+ * by *to*. The difference to **bpf_skb_load_bytes**\ () is that
1811+ * a fifth argument *start_header* exists in order to select a
1812+ * base offset to start from. *start_header* can be one of:
1813+ *
1814+ * **BPF_HDR_START_MAC**
1815+ * Base offset to load data from is *skb*'s mac header.
1816+ * **BPF_HDR_START_NET**
1817+ * Base offset to load data from is *skb*'s network header.
1818+ *
1819+ * In general, "direct packet access" is the preferred method to
1820+ * access packet data, however, this helper is in particular useful
1821+ * in socket filters where *skb*\ **->data** does not always point
1822+ * to the start of the mac header and where "direct packet access"
1823+ * is not available.
1824+ *
1825+ * Return
1826+ * 0 on success, or a negative error in case of failure.
1827+ *
18041828 */
18051829 #define __BPF_FUNC_MAPPER(FN) \
18061830 FN(unspec), \
@@ -1870,7 +1894,8 @@ union bpf_attr { · 63 unmodified lines
18701894 FN(bind), \
18711895 FN(xdp_adjust_tail), \
18721896 FN(skb_get_xfrm_state), \
1873− FN(get_stack),
1897+ FN(get_stack), \
1898+ FN(skb_load_bytes_relative),
18741899
18751900 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
18761901 * function eBPF program intends to call
@@ -1931,6 +1956,12 @@ enum bpf_adj_room_mode { · 54 unmodified lines
19311956 BPF_ADJ_ROOM_NET,
19321957 };
19331958
1959+/* Mode for BPF_FUNC_skb_load_bytes_relative helper. */
1960+enum bpf_hdr_start_off {
1961+ BPF_HDR_START_MAC,
1962+ BPF_HDR_START_NET,
1963+};
1964+
19341965 /* user accessible mirror of in-kernel sk_buff.
19351966 * new fields can only be added to the end of this structure
19361967 */