Skip to content

bpf: Add ipip6 and ip6ip decap support for bpf_skb_adjust_room()

Ziyang Xuan bpf netdev 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesIn review
  2. v22 patches 5 repliesSuperseded
  3. v12 patches 7 repliesSuperseded

Changes in v3 from the cover letter

- Fix compilation failure of selftests/bpf.
- Combine two new branches in bpf_skb_adjust_room().
- Simplify description for new flags BPF_F_ADJ_ROOM_DECAP_L3_IP*.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: Add ipip6 and ip6ip decap support for bpf_skb_adjust_room()include/uapi/linux/bpf.h net/core/filter.c tools/include/uapi/linux/bpf.h+44 -11 reply
2/2selftests/bpf: add ipip6 and ip6ip decap to test_tc_tunneltools/testing/selftests/bpf/progs/test_tc_tunnel.c tools/testing/selftests/bpf/test_tc_tunnel.sh+98 -81 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchWillem de Bruijn
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH bpf-next v3 0/2] bpf: Add ipip6 and ip6ip decap support for bpf_skb_adjust_room()

Add ipip6 and ip6ip decap support for bpf_skb_adjust_room(). Main use case is for using cls_bpf on ingress hook to decapsulate IPv4 over IPv6 and IPv6 over IPv4 tunnel packets.

And add ipip6 and ip6ip decap testcases to verify that bpf_skb_adjust_room() correctly decapsulate ipip6 and ip6ip tunnel packets.

$./test_tc_tunnel.sh
ipip
encap 192.168.1.1 to 192.168.1.2, type ipip, mac none len 100 test basic connectivity
0
test bpf encap without decap (expect failure)
Ncat: TIMEOUT.
1
test bpf encap with tunnel device decap
0
test bpf encap with bpf decap
0
OK
ipip6
encap 192.168.1.1 to 192.168.1.2, type ipip6, mac none len 100 test basic connectivity
0
test bpf encap without decap (expect failure)
Ncat: TIMEOUT.
1
test bpf encap with tunnel device decap
0
test bpf encap with bpf decap
0
OK
ip6ip6
encap fd::1 to fd::2, type ip6tnl, mac none len 100 test basic connectivity
0
test bpf encap without decap (expect failure)
Ncat: TIMEOUT.
1
test bpf encap with tunnel device decap
0
test bpf encap with bpf decap
0
OK
sit
encap fd::1 to fd::2, type sit, mac none len 100 test basic connectivity
0
test bpf encap without decap (expect failure)
Ncat: TIMEOUT.
1
test bpf encap with tunnel device decap
0
test bpf encap with bpf decap
0
OK
...
OK. All tests passed

v3:
- Fix compilation failure of selftests/bpf.
- Combine two new branches in bpf_skb_adjust_room().
- Simplify description for new flags BPF_F_ADJ_ROOM_DECAP_L3_IP*.

v2:
- Use decap flags to indicate the new IP header.

    Do not rely on skb->encapsulation.

Ziyang Xuan (2):
bpf: Add ipip6 and ip6ip decap support for bpf_skb_adjust_room() selftests/bpf: add ipip6 and ip6ip decap to test_tc_tunnel

 include/uapi/linux/bpf.h                      |  7 ++
 net/core/filter.c                             | 31 ++++++-
 tools/include/uapi/linux/bpf.h                |  7 ++
 .../selftests/bpf/progs/test_tc_tunnel.c      | 91 ++++++++++++++++++-
 tools/testing/selftests/bpf/test_tc_tunnel.sh | 15 +--
 5 files changed, 142 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.1