xdp-project / xdp-tools

Utilities and example programs for use with XDP
Other
661 stars 144 forks source link

Loading of XDP program fails with `prog 'xdp_prog1': missing BPF prog type, check ELF section name 'xdp-prog1'` #399

Open Simonacb opened 8 months ago

Simonacb commented 8 months ago

I need to load 2 prog in my xdp program and here is my defintion:

SEC("xdp-prog1") 
int xdp_prog1(struct xdp_md *ctx) {
    ...
    return XDP_PASS;
}
SEC("xdp-prog2")
int xdp_prog2(struct xdp_md *ctx) {
    ...
    return XDP_PASS;
}

and the error log is here:

libbpf: prog 'xdp_prog1': missing BPF prog type, check ELF section name 'xdp-prog1'
libbpf: prog 'xdp_prog1': failed to load: -22

and I'm using the latest libxdp. How can I fixed the problem? Thanks!

tohojo commented 8 months ago

Simonacb @.***> writes:

I need to load 2 prog in my xdp program and here is my defintion: SEC("xdp-prog1") int xdp_prog1(struct xdp_md *ctx) { ... return XDP_PASS; } SEC("xdp-prog2") int xdp_prog2(struct xdp_md *ctx) { ... return XDP_PASS; and the error log is here: libbpf: prog 'xdp_prog1': missing BPF prog type, check ELF section name 'xdp-prog1' libbpf: prog 'xdp_prog1': failed to load: -22 and I'm using the latest libxdp. How can I fixed the problem? Thanks!

You should be using SEC("xdp") for both of them...