xdp-project / xdp-tutorial

XDP tutorial
2.5k stars 580 forks source link

run ./xdp_pass_user --dev lo error! in Ubuntu 20.04 #382

Open alenliu opened 11 months ago

alenliu commented 11 months ago
  1. My os version
    
    root@ubuntu20-04:~/xdp-tutorial/basic01-xdp-pass# cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=20.04
    DISTRIB_CODENAME=focal
    DISTRIB_DESCRIPTION="Ubuntu 20.04.5 LTS"

root@ubuntu20-04:~/xdp-tutorial/basic01-xdp-pass# uname -a Linux ubuntu20-04 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

2. My configure  process

~/xdp-tutorial# ./configure clang: 11.0.0-2~ubuntu20.04.1 libbpf support: submodule ELF support: yes zlib support: yes libxdp support: submodule Configuring libxdp to use our libbpf submodule Found clang binary 'clang' with version 11 (from 'Ubuntu clang version 11.0.0-2~ubuntu20.04.1') not using emacs: using bpftool v7.3.0 libbpf support: custom v1.2.0 perf_bufferconsume support: yes btfload_from_kernel_by_id support: yes btftype_cnt support: yes bpf_objectnext_map support: yes bpf_objectnext_program support: yes bpf_programinsn_cnt support: yes bpf_programtype support: yes bpf_program__flags support: yes bpf_programexpected_attach_type support: yes bpf_map_create support: yes perf_buffernew_raw support: yes bpf_xdp_attach support: yes bpf_mapset_autocreate support: yes bpf_prog_test_run_opts support: yes bpf_xdp_query support: yes zlib support: yes ELF support: yes pcap support: yes secure_getenv support: yes

3. xdp_pass_user --dev lo error information

root@ubuntu20-04:~/xdp-tutorial/basic01-xdp-pass# ./xdp_pass_user --dev lo libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument libbpf: prog 'xdp_pass': failed to load: -22 libbpf: failed to load object 'xdp-dispatcher.o' libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Argument list too long libbpf: prog 'xdp_pass': failed to load: -7 libbpf: failed to load object 'xdp-dispatcher.o' libxdp: Compatibility check for dispatcher program failed: Argument list too long libxdp: Falling back to loading single prog without dispatcher libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument libbpf: prog 'xdp_pass': failed to load: -22 libbpf: failed to load object 'xdp-dispatcher.o' Success: Loading XDP prog name:xdp_prog_simple(id:48) on device:lo(ifindex:1)


Can anybody help me?
tohojo commented 10 months ago

alenliu @.***> writes:

@.***:~/xdp-tutorial/basic01-xdp-pass# uname -a Linux ubuntu20-04 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

A 5.4 kernel is too old to use the XDP dispatcher, so you can't attach multiple programs to a single interface...

Success: Loading XDP prog name:xdp_prog_simple(id:48) on device:lo(ifindex:1)

However, it looks like the fallback to loading a single program works, and you end up with the attachment working?

daiminglong commented 8 months ago

Hi, I have the same problem, but even though this happend, the example bpf code loaded successfully. My kernel version is 5.4, So if I just wanna to try single bpf program case, that means I can ignore this error msg? @tohojo

[root@VM-119-213-tencentos basic01-xdp-pass]# ls Makefile README.org xdp_pass_kern.c xdp_pass_kern.ll xdp_pass_kern.o xdp_pass_user xdp_pass_user.c [root@VM-119-213-tencentos basic01-xdp-pass]# ./xdp_pass_user --dev test libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument libbpf: prog 'xdp_pass': failed to load: -22 libbpf: failed to load object 'xdp-dispatcher.o' libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Argument list too long libbpf: prog 'xdp_pass': failed to load: -7 libbpf: failed to load object 'xdp-dispatcher.o' libxdp: Compatibility check for dispatcher program failed: Argument list too long libxdp: Falling back to loading single prog without dispatcher libbpf: elf: skipping unrecognized data section(7) xdp_metadata libbpf: prog 'xdp_pass': BPF program load failed: Invalid argument libbpf: prog 'xdp_pass': failed to load: -22 libbpf: failed to load object 'xdp-dispatcher.o' Success: Loading XDP prog name:xdp_prog_simple(id:18) on device:test(ifindex:84) [root@VM-119-213-tencentos basic01-xdp-pass]# xdp-loader status test CURRENT XDP PROGRAM STATUS:

Interface Prio Program name Mode ID Tag Chain actions

test xdp_prog_simple native 18 3b185187f1855c4c

tohojo commented 8 months ago

Minglong Dai @.***> writes:

Hi, I have the same problem, but even though this happend, the example bpf code loaded successfully. My kernel version is 5.4, So if I just wanna to try single bpf program case, that means I can ignore this error msg? @tohojo

Yup, that should be fine :)

daiminglong commented 8 months ago

Minglong Dai @.***> writes: Hi, I have the same problem, but even though this happend, the example bpf code loaded successfully. My kernel version is 5.4, So if I just wanna to try single bpf program case, that means I can ignore this error msg? @tohojo Yup, that should be fine :)

thks, It works