mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
UPSTREAM: bpf: Change bpf_sk_assign to accept ARG_PTR_TO_BTF_ID_SOCK_COMMON
This patch changes the bpf_sk_assign() to take ARG_PTR_TO_BTF_ID_SOCK_COMMON such that they will work with the pointer returned by the bpf_skc_to_*() helpers also. The bpf_sk_lookup_assign() is taking ARG_PTR_TO_SOCKET_"OR_NULL". Meaning it specifically takes a literal NULL. ARG_PTR_TO_BTF_ID_SOCK_COMMON does not allow a literal NULL, so another ARG type is required for this purpose and another follow-up patch can be used if there is such need. Change-Id: Ib210803ccc92294cdc531553c405408b4b355782 Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200925000415.3857374-1-kafai@fb.com
This commit is contained in:
parent
2f08dee56f
commit
b712bf2029
3 changed files with 4 additions and 4 deletions
|
|
@ -3117,7 +3117,7 @@ union bpf_attr {
|
|||
* Return
|
||||
* The id is returned or 0 in case the id could not be retrieved.
|
||||
*
|
||||
* long bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
|
||||
* long bpf_sk_assign(struct sk_buff *skb, void *sk, u64 flags)
|
||||
* Description
|
||||
* Helper is overloaded depending on BPF program type. This
|
||||
* description applies to **BPF_PROG_TYPE_SCHED_CLS** and
|
||||
|
|
|
|||
|
|
@ -6317,7 +6317,7 @@ static const struct bpf_func_proto bpf_tcp_gen_syncookie_proto = {
|
|||
|
||||
BPF_CALL_3(bpf_sk_assign, struct sk_buff *, skb, struct sock *, sk, u64, flags)
|
||||
{
|
||||
if (flags != 0)
|
||||
if (!sk || flags != 0)
|
||||
return -EINVAL;
|
||||
if (!skb_at_tc_ingress(skb))
|
||||
return -EOPNOTSUPP;
|
||||
|
|
@ -6341,7 +6341,7 @@ static const struct bpf_func_proto bpf_sk_assign_proto = {
|
|||
.gpl_only = false,
|
||||
.ret_type = RET_INTEGER,
|
||||
.arg1_type = ARG_PTR_TO_CTX,
|
||||
.arg2_type = ARG_PTR_TO_SOCK_COMMON,
|
||||
.arg2_type = ARG_PTR_TO_BTF_ID_SOCK_COMMON,
|
||||
.arg3_type = ARG_ANYTHING,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3084,7 +3084,7 @@ union bpf_attr {
|
|||
* Return
|
||||
* The id is returned or 0 in case the id could not be retrieved.
|
||||
*
|
||||
* long bpf_sk_assign(struct sk_buff *skb, struct bpf_sock *sk, u64 flags)
|
||||
* long bpf_sk_assign(struct sk_buff *skb, void *sk, u64 flags)
|
||||
* Description
|
||||
* Assign the *sk* to the *skb*. When combined with appropriate
|
||||
* routing configuration to receive the packet towards the socket,
|
||||
|
|
|
|||
Loading…
Reference in a new issue