IPv6 longest-prefix-match (LPM) using a linearized B+-tree with AVX-512 SIMD and a scalar fallback. Based on the algorithm from:
Zhihao Zhang, Lanzheng Liu, Chen Chen, Huiba Li, Jiwu Shu, Windsor Hsu, Yiming Zhang. PlanB: Efficient Software IPv6 Lookup with Linearized B+-Tree. NSDI '26. arXiv:2604.14650. Author's reference code: https://github.com/nicexlab/planb.
This repository is an independent, clean-room reimplementation of the algorithm as a portable, MIT-licensed C++17 library with extras that were not part of the reference:
Portable header-only core ( include/lpm6.hpp ) that compiles without AVX-512 and transparently falls back to a scalar path.
( ) that compiles without AVX-512 and transparently falls back to a scalar path. Dynamic FIB ( lpm6::Dynamic ) using the paper's rebuild-and-swap model with std::atomic<std::shared_ptr> ; lookups are wait-free.
( ) using the paper's rebuild-and-swap model with ; lookups are wait-free. Python bindings via pybind11 ( pip install -e . ).
via pybind11 ( ). Correctness tests ( tests/test_correctness.cpp ) that verify the tree against a brute-force LPM reference on synthetic FIBs.
( ) that verify the tree against a brute-force LPM reference on synthetic FIBs. Sample FIB/trace generator ( examples/generate_sample.py ).
Why this exists
The PlanB paper is a solid engineering idea, but the reference code on GitHub is not something you can drop into another project: it is Linux- and AVX-512-only, has no license, no Python layer, and no dynamic-FIB path. planb-lpm re-expresses the algorithm from the paper as a portable, tested, and permissively licensed library so the technique is actually usable in research, teaching, and production software.
... continue reading