Skip to content

Commit d56c2f9

Browse files
rdnaAlexei Starovoitov
authored andcommitted
bpf: Allow sk lookup helpers in cgroup skb
Currently sk lookup helpers are allowed in tc, xdp, sk skb, and cgroup sock_addr programs. But they would be useful in cgroup skb as well so that for example cgroup skb ingress program can lookup a peer socket a packet comes from on same host and make a decision whether to allow or deny this packet based on the properties of that socket, e.g. cgroup that peer socket belongs to. Allow the following sk lookup helpers in cgroup skb: * bpf_sk_lookup_tcp; * bpf_sk_lookup_udp; * bpf_sk_release; * bpf_skc_lookup_tcp. Signed-off-by: Andrey Ignatov <rdna@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/f8c7ee280f1582b586629436d777b6db00597d63.1589486450.git.rdna@fb.com
1 parent 5b0004d commit d56c2f9

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎net/core/filter.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6159,6 +6159,14 @@ cg_skb_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
61596159
return &bpf_skb_cgroup_id_proto;
61606160
#endif
61616161
#ifdef CONFIG_INET
6162+
case BPF_FUNC_sk_lookup_tcp:
6163+
return &bpf_sk_lookup_tcp_proto;
6164+
case BPF_FUNC_sk_lookup_udp:
6165+
return &bpf_sk_lookup_udp_proto;
6166+
case BPF_FUNC_sk_release:
6167+
return &bpf_sk_release_proto;
6168+
case BPF_FUNC_skc_lookup_tcp:
6169+
return &bpf_skc_lookup_tcp_proto;
61626170
case BPF_FUNC_tcp_sock:
61636171
return &bpf_tcp_sock_proto;
61646172
case BPF_FUNC_get_listener_sock:

0 commit comments

Comments
 (0)