Longest Prefix Matching Using Longest-First Search in a Leaf-Pushing Trie
Jinsol Lee, Hyesook Lim · 2024
This paper introduces a new algorithm for IP address lookup, a pivotal task for routers to determine the appropriate output link for each incoming packet. With the advent of classless inter-domain routing (CIDR) scheme, the IP address lookup problem encounters the challenge of efficiently finding the longest matching prefix (LMP) at wire-speed. While off-chip ternary content addressable memories (TCAMs) are commonly employed for this purpose, they have drawbacks, particularly in power consumption and large cost. To address this, our research explores algorithmic alternatives, focusing specifically on utilizing a Bloom filter (BF) stored in an on-chip memory and a hash table stored in an off-chip memory. We propose to perform the longest-first search for the Bloom filter storing every prefix in a leaf-pushing trie. Since prefixes are exclusively located at the leaves of a trie following the leaf-pushing procedure, querying the BF from the longest level of the trie is highly effective. The on-chip BF serves the role of avoiding unnecessary off-chip hash table accesses by producing negative results for non-existing nodes. We have constructed the proposed algorithm using C++ code and tested against real-world routing data from backbone routers. Our results demonstrate that, given a Bloom filter of sufficient size, the proposed algorithm requires only one off-chip hash table access on average for each IP address lookup.