diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2021-11-10 16:29:59 -0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2021-11-10 16:30:17 -0800 |
| commit | 04f8cb6d6b6752ed14dbf91c616717fa30655ef6 (patch) | |
| tree | e1a7fbbafc0e7f63aacf5e09a97c37c2da937023 /include/linux | |
| parent | 1a8b597ddabe7dc25aa9defd33949d455ee9cde8 (diff) | |
| parent | 8b4fd2bf1f47c3e3a63c327fca2ad5c4e2691ef8 (diff) | |
| download | cachepc-linux-04f8cb6d6b6752ed14dbf91c616717fa30655ef6.tar.gz cachepc-linux-04f8cb6d6b6752ed14dbf91c616717fa30655ef6.zip | |
Merge branch 'Get ingress_ifindex in BPF_SK_LOOKUP prog type'
Mark Pashmfouroush says:
====================
BPF_SK_LOOKUP users may want to have access to the ifindex of the skb
which triggered the socket lookup. This may be useful for selectively
applying programmable socket lookup logic to packets that arrive on a
specific interface, or excluding packets from an interface.
v3:
- Rename ifindex field to ingress_ifindex for consistency. (Yonghong)
v2:
- Fix inaccurate comment (Alexei)
- Add more details to commit messages (John)
====================
Revieview-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/filter.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index 24b7ed2677af..b6a216eb217a 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -1374,6 +1374,7 @@ struct bpf_sk_lookup_kern { const struct in6_addr *daddr; } v6; struct sock *selected_sk; + u32 ingress_ifindex; bool no_reuseport; }; @@ -1436,7 +1437,7 @@ extern struct static_key_false bpf_sk_lookup_enabled; static inline bool bpf_sk_lookup_run_v4(struct net *net, int protocol, const __be32 saddr, const __be16 sport, const __be32 daddr, const u16 dport, - struct sock **psk) + const int ifindex, struct sock **psk) { struct bpf_prog_array *run_array; struct sock *selected_sk = NULL; @@ -1452,6 +1453,7 @@ static inline bool bpf_sk_lookup_run_v4(struct net *net, int protocol, .v4.daddr = daddr, .sport = sport, .dport = dport, + .ingress_ifindex = ifindex, }; u32 act; @@ -1474,7 +1476,7 @@ static inline bool bpf_sk_lookup_run_v6(struct net *net, int protocol, const __be16 sport, const struct in6_addr *daddr, const u16 dport, - struct sock **psk) + const int ifindex, struct sock **psk) { struct bpf_prog_array *run_array; struct sock *selected_sk = NULL; @@ -1490,6 +1492,7 @@ static inline bool bpf_sk_lookup_run_v6(struct net *net, int protocol, .v6.daddr = daddr, .sport = sport, .dport = dport, + .ingress_ifindex = ifindex, }; u32 act; |
