[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d3041f61-2f3c-dee7-0129-bc18179d7520@linux.dev>
Date: Thu, 6 Oct 2022 13:15:17 -0700
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: razor@...ckwall.org, ast@...nel.org, andrii@...nel.org,
john.fastabend@...il.com, joannelkoong@...il.com, memxor@...il.com,
toke@...hat.com, joe@...ium.io, netdev@...r.kernel.org,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH bpf-next 01/10] bpf: Add initial fd-based API to attach tc
BPF programs
On 10/4/22 4:11 PM, Daniel Borkmann wrote:
> static int bpf_prog_detach(const union bpf_attr *attr)
> {
> @@ -3527,6 +3531,9 @@ static int bpf_prog_detach(const union bpf_attr *attr)
> return -EINVAL;
>
> ptype = attach_type_to_prog_type(attr->attach_type);
> + if (ptype != BPF_PROG_TYPE_SCHED_CLS &&
> + (attr->attach_flags || attr->replace_bpf_fd))
It seems no ptype is using the attach_flags in detach. xtc_prog_detach() is also
not using it. Should it be checked regardless of the ptype instead?
> + return -EINVAL;
>
> switch (ptype) {
> case BPF_PROG_TYPE_SK_MSG:
> @@ -3545,6 +3552,8 @@ static int bpf_prog_detach(const union bpf_attr *attr)
> case BPF_PROG_TYPE_SOCK_OPS:
> case BPF_PROG_TYPE_LSM:
> return cgroup_bpf_prog_detach(attr, ptype);
> + case BPF_PROG_TYPE_SCHED_CLS:
> + return xtc_prog_detach(attr);
> default:
> return -EINVAL;
> }
> @@ -3598,6 +3607,9 @@ static int bpf_prog_query(const union bpf_attr *attr,
> case BPF_SK_MSG_VERDICT:
> case BPF_SK_SKB_VERDICT:
> return sock_map_bpf_prog_query(attr, uattr);
> + case BPF_NET_INGRESS:
> + case BPF_NET_EGRESS:
> + return xtc_prog_query(attr, uattr);
> default:
> return -EINVAL;
> }
Powered by blists - more mailing lists