Skip to content

bpf: add helper for getting xfrm states

Eyal Birger netdev 3 versions – Applied

Status from this message: Applied to bpf-next, thanks Eyal!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyApplied
  2. v22 patches 4 repliesSuperseded
  3. v12 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- Kept SPI and peer IPv4 address in state in network byte order following suggestion from Alexei Starovoitov

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2bpf: add helper for getting xfrm statesinclude/uapi/linux/bpf.h net/core/filter.c+72 -10 replies
2/2samples/bpf: extend test_tunnel_bpf.sh with xfrm state testsamples/bpf/tcbpf2_kern.c samples/bpf/test_tunnel_bpf.sh tools/include/uapi/linux/bpf.h +1 more+114 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH bpf-next,v3 0/2] bpf: add helper for getting xfrm states

This patchset adds support for fetching XFRM state information from an eBPF program called from TC.

The first patch introduces a helper for fetching an XFRM state from the skb's secpath. The XFRM state is modeled using a new virtual struct which contains the SPI, peer address, and reqid values of the state; This struct can be extended in the future to provide additional state information.

The second patch adds a test example in test_tunnel_bpf.sh. The sample validates the correct extraction of state information by the eBPF program.

---
v3:
- Kept SPI and peer IPv4 address in state in network byte order following suggestion from Alexei Starovoitov
v2:
- Fixed two comments by Daniel Borkmann:
- disallow reserved flags in helper call
- avoid compiling in helper code when CONFIG_XFRM is off

Eyal Birger (2):
bpf: add helper for getting xfrm states samples/bpf: extend test_tunnel_bpf.sh with xfrm state test

 include/uapi/linux/bpf.h                  | 25 ++++++++++-
 net/core/filter.c                         | 48 +++++++++++++++++++++
 samples/bpf/tcbpf2_kern.c                 | 16 +++++++
 samples/bpf/test_tunnel_bpf.sh            | 71 +++++++++++++++++++++++++++++++
 tools/include/uapi/linux/bpf.h            | 25 ++++++++++-
 tools/testing/selftests/bpf/bpf_helpers.h |  4 +-
 6 files changed, 186 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4