Skip to content

flow_dissector: lay groundwork for calling BPF hook from eth_get_headlen

Stanislav Fomichev bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5selftests/bpf: fix vlan handling in flow dissector programtools/testing/selftests/bpf/prog_tests/flow_dissector.c tools/testing/selftests/bpf/progs/bpf_flow.c+72 -110 replies
2/5net/flow_dissector: pass flow_keys->n_proto to BPF programsnet/core/flow_dissector.c tools/testing/selftests/bpf/progs/bpf_flow.c+5 -20 replies
3/5flow_dissector: fix clamping of BPF flow_keys for non-zero nhoffnet/core/flow_dissector.c+2 -10 replies
4/5flow_dissector: allow access only to a subset of __sk_buff fieldsnet/core/filter.c+3 -130 replies
5/5flow_dissector: document BPF flow dissector environmentDocumentation/networking/bpf_flow_dissector.txt+115 -04 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWillem de BruijnPetar Penkov
SeriesA-b A-b
1/5
2/5
3/5
4/5
5/5

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

Read the v1 thread

Cover letter [PATCH bpf 0/5] flow_dissector: lay groundwork for calling BPF hook from eth_get_headlen

This patch series fixes the existing BPF flow dissector API to support calling BPF progs from the eth_get_headlen context (the support itself will be added in bpf-next tree).

The summary of the changes:
* fix VLAN handling in bpf_flow.c, we don't need to peek back and look

    at skb->vlan_present; add selftests

* pass and use flow_keys->n_proto instead of skb->protocol
* fix clamping of flow_keys->nhoff for packets with nhoff > 0
* prohibit access to most of the __sk_buff fields from BPF flow dissector progs; only data/data_end/flow_keys are allowed (all input is now passed via flow_keys)
* finally, document BPF flow dissector program environment

Stanislav Fomichev (5):
selftests/bpf: fix vlan handling in flow dissector program net/flow_dissector: pass flow_keys->n_proto to BPF programs
flow_dissector: fix clamping of BPF flow_keys for non-zero nhoff
flow_dissector: allow access only to a subset of __sk_buff fields
flow_dissector: document BPF flow dissector environment

 .../networking/bpf_flow_dissector.txt         | 115 ++++++++++++++++++
 net/core/filter.c                             |  16 +--
 net/core/flow_dissector.c                     |   4 +-
 .../selftests/bpf/prog_tests/flow_dissector.c |  68 +++++++++++
 tools/testing/selftests/bpf/progs/bpf_flow.c  |  19 ++-
 5 files changed, 196 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/networking/bpf_flow_dissector.txt
Signature · 1 line
2.21.0.392.gf8f6787159e-goog