summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/test_pkt_access.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2019-02-10 19:46:17 -0800
committerAlexei Starovoitov <ast@kernel.org>2019-02-10 19:46:18 -0800
commitd105fa983c582ab92923b160cc7e9d19e5d9ce3c (patch)
treeacbb0d1786bcccde256ee57a9be1fd731885c1cf /tools/testing/selftests/bpf/test_pkt_access.c
parent5f4566498dee5e38e36a015a968c22ed21568f0b (diff)
parente0b27b3f97b8fce620331baad563833617c1f303 (diff)
downloadlinux-rt-d105fa983c582ab92923b160cc7e9d19e5d9ce3c.tar.gz
Merge branch 'skb_sk-sk_fullsock-tcp_sock'
Martin KaFai Lau says: ==================== This series adds __sk_buff->sk, "struct bpf_tcp_sock", BPF_FUNC_sk_fullsock and BPF_FUNC_tcp_sock. Together, they provide a common way to expose the members of "struct tcp_sock" and "struct bpf_sock" for the bpf_prog to access. The patch series first adds a bpf_sock pointer to __sk_buff and a new helper BPF_FUNC_sk_fullsock. It then adds BPF_FUNC_tcp_sock to get a bpf_tcp_sock pointer from a bpf_sock pointer. The current use case is to allow a cg_skb_bpf_prog to provide per cgroup traffic policing/shaping. Please see individual patch for details. v2: - Patch 1 depends on commit d623876646be ("bpf: Fix narrow load on a bpf_sock returned from sk_lookup()") in the bpf branch. - Add sk_to_full_sk() to bpf_sk_fullsock() and bpf_tcp_sock() such that there is a way to access the listener's sk and tcp_sk when __sk_buff->sk is a request_sock. The comments in the uapi bpf.h is updated accordingly. - bpf_ctx_range_till() is used in bpf_sock_common_is_valid_access() in patch 1. Saved a few lines. - Patch 2 is new in v2 and it adds "state", "dst_ip4", "dst_ip6" and "dst_port" to the bpf_sock. Narrow load is allowed on them. The "state" (i.e. sk_state) has already been used in INET_DIAG (e.g. ss -t) and getsockopt(TCP_INFO). - While at it in the new patch 2, also allow narrow load on some existing fields of the bpf_sock, which are "family", "type", "protocol" and "src_port". Only allow loading from first byte for now. i.e. does not allow narrow load starting from the 2nd byte. - Add some narrow load tests to the test_verifier's sock.c ==================== Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/test_pkt_access.c')
0 files changed, 0 insertions, 0 deletions