Scheduled maintenance: Some features related to account registration and licensing may be temporarily unavailable from Friday (May 8) at 1 PM to Sunday (May 10) at 5 PM (PST).
HomeDefectsLIN1022-5363
Fixed

LIN1022-5363 : [bpftool] can't lookup key of a map

Created: Sep 8, 2023    Updated: Mar 7, 2024
Resolved Date: Mar 7, 2024
Found In Version: 10.22.33.13
Severity: Standard
Applicable for: Wind River Linux LTS 22
Component/s: Userspace

Description

Run below commands to create and update a map,

# bpftool map create /sys/fs/bpf/map1 type hash key 4 value 4 entries 8 name map1
# bpftool map update name map1 key 0x01 0x02 0x03 0x04 value 0x05 0x06 0x07 0x08

the key:value can be seen with dump,

# bpftool map dump name map1
key: 01 02 03 04  value: 05 06 07 08
Found 1 element

but can't be looked up,

# bpftool map lookup name map1 key 0x01 0x02 0x03 0x04
no output

it works on {*}ubuntu 22.04+bpftool-v7.0.0{*},

sudo bpftool map lookup name map1 key 0x01 0x02 0x03 0x04
key: 01 02 03 04  value: 05 06 07 08

Steps to Reproduce

$ setup.sh --machines intel-x86-64 --templates feature/bpf --distro wrlinux --dl-layers=1 --accept-eula=yes && source environment-setup-x86_64-wrlinuxsdk-linux && source oe-init-build-env build
$ echo 'IMAGE_INSTALL:append = " clang libbpf libbpf-dev"' >>conf/local.conf
$ bitbake wrlinux-image-std
# boot the target and run bpftool commands