summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/bpf_helpers.h
diff options
context:
space:
mode:
authorEyal Birger <eyal.birger@gmail.com>2018-04-24 17:50:29 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2018-04-24 22:26:58 +0200
commit12bed760a78da6e12ac8252fec64d019a9eac523 (patch)
tree8cc73ba606e4af8871318a5c1e0ff64cffcd43b3 /tools/testing/selftests/bpf/bpf_helpers.h
parentfbcf93ebcaef7d09881ee308b52cd84f5e43c622 (diff)
downloadlinux-12bed760a78da6e12ac8252fec64d019a9eac523.tar.gz
linux-12bed760a78da6e12ac8252fec64d019a9eac523.tar.bz2
linux-12bed760a78da6e12ac8252fec64d019a9eac523.zip
bpf: add helper for getting xfrm states
This commit introduces a helper which allows fetching xfrm state parameters by eBPF programs attached to TC. Prototype: bpf_skb_get_xfrm_state(skb, index, xfrm_state, size, flags) skb: pointer to skb index: the index in the skb xfrm_state secpath array xfrm_state: pointer to 'struct bpf_xfrm_state' size: size of 'struct bpf_xfrm_state' flags: reserved for future extensions The helper returns 0 on success. Non zero if no xfrm state at the index is found - or non exists at all. struct bpf_xfrm_state currently includes the SPI, peer IPv4/IPv6 address and the reqid; it can be further extended by adding elements to its end - indicating the populated fields by the 'size' argument - keeping backwards compatibility. Typical usage: struct bpf_xfrm_state x = {}; bpf_skb_get_xfrm_state(skb, 0, &x, sizeof(x), 0); ... Signed-off-by: Eyal Birger <eyal.birger@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions