]> git.baikalelectronics.ru Git - kernel.git/commit
Merge branch 'Support direct writes to nf_conn:mark'
authorAlexei Starovoitov <ast@kernel.org>
Sun, 11 Sep 2022 00:27:33 +0000 (17:27 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 11 Sep 2022 00:27:33 +0000 (17:27 -0700)
commitbd6ad8e5f89f55b1b24c7d198b4dd70aa73ac983
tree772801bba2c6592be345947e6e5d165fdef6d2f5
parent3eadf421a24c2edb32eb8c32861882cc8938d901
parent099a16ac2dfcb09c2ae6f48d2cd40b3073333ab5
Merge branch 'Support direct writes to nf_conn:mark'

Daniel Xu says:

====================

Support direct writes to nf_conn:mark from TC and XDP prog types. This
is useful when applications want to store per-connection metadata. This
is also particularly useful for applications that run both bpf and
iptables/nftables because the latter can trivially access this metadata.

One example use case would be if a bpf prog is responsible for advanced
packet classification and iptables/nftables is later used for routing
due to pre-existing/legacy code.

Past discussion:
- v4: https://lore.kernel.org/bpf/cover.1661192455.git.dxu@dxuuu.xyz/
- v3: https://lore.kernel.org/bpf/cover.1660951028.git.dxu@dxuuu.xyz/
- v2: https://lore.kernel.org/bpf/CAP01T74Sgn354dXGiFWFryu4vg+o8b9s9La1d9zEbC4LGvH4qg@mail.gmail.com/T/
- v1: https://lore.kernel.org/bpf/cover.1660592020.git.dxu@dxuuu.xyz/

Changes since v4:
- Use exported function pointer + mutex to handle CONFIG_NF_CONNTRACK=m
  case

Changes since v3:
- Use a mutex to protect module load/unload critical section

Changes since v2:
- Remove use of NOT_INIT for btf_struct_access write path
- Disallow nf_conn writing when nf_conntrack module not loaded
- Support writing to nf_conn___init:mark

Changes since v1:
- Add unimplemented stub for when !CONFIG_BPF_SYSCALL
====================

Signed-off-by: Alexei Starovoitov <ast@kernel.org>