linux/tools/testing
Jonathan Lemon da2577fdd0 bpf: lpm_trie: check left child of last leftmost node for NULL
If the leftmost parent node of the tree has does not have a child
on the left side, then trie_get_next_key (and bpftool map dump) will
not look at the child on the right.  This leads to the traversal
missing elements.

Lookup is not affected.

Update selftest to handle this case.

Reproducer:

 bpftool map create /sys/fs/bpf/lpm type lpm_trie key 6 \
     value 1 entries 256 name test_lpm flags 1
 bpftool map update pinned /sys/fs/bpf/lpm key  8 0 0 0  0   0 value 1
 bpftool map update pinned /sys/fs/bpf/lpm key 16 0 0 0  0 128 value 2
 bpftool map dump   pinned /sys/fs/bpf/lpm

Returns only 1 element. (2 expected)

Fixes: b471f2f1de ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE")
Signed-off-by: Jonathan Lemon <jonathan.lemon@gmail.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-06-11 13:52:37 +02:00
..
fault-injection
ktest treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 166 2019-05-30 11:26:39 -07:00
nvdimm tools/testing/nvdimm: add watermarks for dax_pmem* modules 2019-04-22 15:56:28 -07:00
radix-tree
scatterlist treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
selftests bpf: lpm_trie: check left child of last leftmost node for NULL 2019-06-11 13:52:37 +02:00
vsock treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00