OSDN Git Service

bpf: Add ingress_ifindex to bpf_sk_lookup
authorMark Pashmfouroush <markpash@cloudflare.com>
Wed, 10 Nov 2021 11:10:15 +0000 (11:10 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 11 Nov 2021 00:29:58 +0000 (16:29 -0800)
commitf89315650ba34ec6c91a8bded72796980bee2a4d
treec860a28dda8d188d6cdc7c863942d5dd7d77b83e
parent1a8b597ddabe7dc25aa9defd33949d455ee9cde8
bpf: Add ingress_ifindex to bpf_sk_lookup

It may be helpful to have access to the ifindex during bpf socket
lookup. An example may be to scope certain socket lookup logic to
specific interfaces, i.e. an interface may be made exempt from custom
lookup code.

Add the ifindex of the arriving connection to the bpf_sk_lookup API.

Signed-off-by: Mark Pashmfouroush <markpash@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211110111016.5670-2-markpash@cloudflare.com
include/linux/filter.h
include/uapi/linux/bpf.h
net/core/filter.c
net/ipv4/inet_hashtables.c
net/ipv4/udp.c
net/ipv6/inet6_hashtables.c
net/ipv6/udp.c
tools/include/uapi/linux/bpf.h