1================ 2bpftool-map 3================ 4------------------------------------------------------------------------------- 5tool for inspection and simple manipulation of eBPF maps 6------------------------------------------------------------------------------- 7 8:Manual section: 8 9 10SYNOPSIS 11======== 12 13 **bpftool** **map** *COMMAND* 14 15 *COMMANDS* := 16 { show | dump | update | lookup | getnext | delete | pin | help } 17 18MAP COMMANDS 19============= 20 21| **bpftool** map show [*MAP*] 22| **bpftool** map dump *MAP* 23| **bpftool** map update *MAP* key *BYTES* value *VALUE* [*UPDATE_FLAGS*] 24| **bpftool** map lookup *MAP* key *BYTES* 25| **bpftool** map getnext *MAP* [key *BYTES*] 26| **bpftool** map delete *MAP* key *BYTES* 27| **bpftool** map pin *MAP* *FILE* 28| **bpftool** map help 29| 30| *MAP* := { id MAP_ID | pinned FILE } 31| *VALUE* := { BYTES | MAP | PROGRAM } 32| *UPDATE_FLAGS* := { any | exist | noexist } 33 34DESCRIPTION 35=========== 36 **bpftool map show** [*MAP*] 37 Show information about loaded maps. If *MAP* is specified 38 show information only about given map, otherwise list all 39 maps currently loaded on the system. 40 41 Output will start with map ID followed by map type and 42 zero or more named attributes (depending on kernel version). 43 44 **bpftool map dump** *MAP* 45 Dump all entries in a given *MAP*. 46 47 **bpftool map update** *MAP* **key** *BYTES* **value** *VALUE* [*UPDATE_FLAGS*] 48 Update map entry for a given *KEY*. 49 50 *UPDATE_FLAGS* can be one of: **any** update existing entry 51 or add if doesn't exit; **exist** update only if entry already 52 exists; **noexist** update only if entry doesn't exist. 53 54 **bpftool map lookup** *MAP* **key** *BYTES* 55 Lookup **key** in the map. 56 57 **bpftool map getnext** *MAP* [**key** *BYTES*] 58 Get next key. If *key* is not specified, get first key. 59 60 **bpftool map delete** *MAP* **key** *BYTES* 61 Remove entry from the map. 62 63 **bpftool map pin** *MAP* *FILE* 64 Pin map *MAP* as *FILE*. 65 66 Note: *FILE* must be located in *bpffs* mount. 67 68 **bpftool map help** 69 Print short help message. 70 71EXAMPLES 72======== 73**# bpftool map show** 74:: 75 76 10: hash name some_map flags 0x0 77 key 4B value 8B max_entries 2048 memlock 167936B 78 79**# bpftool map update id 10 key 13 00 07 00 value 02 00 00 00 01 02 03 04** 80 81**# bpftool map lookup id 10 key 0 1 2 3** 82 83:: 84 85 key: 00 01 02 03 value: 00 01 02 03 04 05 06 07 86 87 88**# bpftool map dump id 10** 89:: 90 91 key: 00 01 02 03 value: 00 01 02 03 04 05 06 07 92 key: 0d 00 07 00 value: 02 00 00 00 01 02 03 04 93 Found 2 elements 94 95**# bpftool map getnext id 10 key 0 1 2 3** 96:: 97 98 key: 99 00 01 02 03 100 next key: 101 0d 00 07 00 102 103| 104| **# mount -t bpf none /sys/fs/bpf/** 105| **# bpftool map pin id 10 /sys/fs/bpf/map** 106| **# bpftool map del pinned /sys/fs/bpf/map key 13 00 07 00** 107 108SEE ALSO 109======== 110 **bpftool**\ (8), **bpftool-prog**\ (8) 111