Re: [PATCH bpf-next 01/10] bpf: Add initial fd-based API to attach tc BPF programs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
  	}




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux