On Wed, Jan 17, 2024 at 1:57 PM Amery Hung <ameryhung@xxxxxxxxx> wrote: > > While eBPF qdisc uses NETLINK for attachment, expected_attach_type is > required at load time to verify context access from different programs. > This patch adds the section definition for this. > > Signed-off-by: Amery Hung <amery.hung@xxxxxxxxxxxxx> > --- > tools/lib/bpf/libbpf.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index e067be95da3c..0541f85b4ce6 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -8991,6 +8991,10 @@ static const struct bpf_sec_def section_defs[] = { > SEC_DEF("struct_ops.s+", STRUCT_OPS, 0, SEC_SLEEPABLE), > SEC_DEF("sk_lookup", SK_LOOKUP, BPF_SK_LOOKUP, SEC_ATTACHABLE), > SEC_DEF("netfilter", NETFILTER, BPF_NETFILTER, SEC_NONE), > + SEC_DEF("qdisc/enqueue", QDISC, BPF_QDISC_ENQUEUE, SEC_ATTACHABLE_OPT), > + SEC_DEF("qdisc/dequeue", QDISC, BPF_QDISC_DEQUEUE, SEC_ATTACHABLE_OPT), > + SEC_DEF("qdisc/reset", QDISC, BPF_QDISC_RESET, SEC_ATTACHABLE_OPT), > + SEC_DEF("qdisc/init", QDISC, BPF_QDISC_INIT, SEC_ATTACHABLE_OPT), seems like SEC_ATTACHABLE (or just 0) is what you want. expected_attach_type shouldn't be optional for any new program type > }; > > int libbpf_register_prog_handler(const char *sec, > -- > 2.20.1 > >