DXRIPLookup − Click element; IP routing lookup through binary search in compact lookup tables


DXRIPLookup(ADDR1/MASK1 [GW1] OUT1, ADDR2/MASK2 [GW2] OUT2, ...)

Ports: any number of inputs, any number of outputs
: push
: ip (core)


Expects a destination IP address annotation with each packet. Looks up that address in its routing table, using longest-prefix-match, sets the destination annotation to the corresponding GW (if specified), and emits the packet on the indicated OUTput port.

Each argument is a route, specifying a destination and mask, an optional gateway IP address, and an output port. No destination-mask pair may occur more than once.

Uses the IPRouteTable(7) interface; see IPRouteTable(7) for description.

DXRIPLookup aims at achieving high lookup speeds through exploiting the CPU cache locality. The routing table is expanded into a very small lookup structure, typically occupying less than 4 bytes per IP prefix for large BGP views, which permits the lookup structures to easily fit in cache hierarchy of contemporary CPU cores. The algorithm is presented in detail in the paper cited below.

DXRIPLookup maintains a BSDIPLookup(7) backend database as well as its own auxiliary tables, which permit incremental lookup table updates to be performed at high speeds. Although those subsidiary tables are only accessed during route updates, they significantly add to DXRIPLookup’s total memory footprint.


table (read-only)

Outputs a human-readable version of the current routing table.

lookup (read-only)

Reports the OUTput port and GW corresponding to an address.

add (write-only)

Adds a route to the table. Format should be ‘ADDR/MASK [GW] OUT’. Fails if a route for ADDR/MASK already exists.

set (write-only)

Sets a route, whether or not a route for the same prefix already exists.

remove (write-only)

Removes a route from the table. Format should be ‘ADDR/MASK’.

ctrl (write-only)

Adds or removes a group of routes. Write ‘add/set ADDR/MASK [GW] OUT’ to add a route, and ‘remove ADDR/MASK’ to remove a route. You can supply multiple commands, one per line; all commands are executed as one atomic operation.

flush (write-only)

Clears the entire routing table in a single atomic operation.

stat (read-only)

Outputs human-readable report on current database state.


See IPRouteTable(7) for a performance comparison of the various IP routing elements.


IPRouteTable(7), BSDIPLookup(7), DirectIPLookup(7), StaticIPLookup(7), LinearIPLookup(7), SortedIPLookup(7), LinuxIPLookup(7)

Marko Zec, Luigi Rizzo, Miljenko Mikuc. "DXR: Towards a Billion Routing Lookups per Second in Software". ACM Computer Communication Review, Vol. 42(5), 2012, pp. 29-36.