Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

How Wren selects a route

Follow a prefix

flowchart LR
  proto[Protocol task] -->|import filter| upd[Route update]
  upd --> rib[Router loop<br/>RIB per table and prefix]
  rib -->|winner changed| chg[Install or removal]
  chg -->|FIB export policy| be{Backend}
  be --> k[kernel: netlink]
  be --> m[memory: in process]
  rib -->|redistribution| proto
  rib --> mon[wren monitor routes]
  1. A protocol accepts an advertisement and submits a candidate to the route manager.
  2. The RIB compares candidates for that table and prefix. When the winner changes, the RIB produces an install or a removal.
  3. The selected backend applies the forwarding update. Import and FIB export policy can affect what is retained or installed. Connected networks stay under kernel ownership.

Learned, selected and installed are three views:

wren show bgp routes
wren show routes
ip -4 route show proto bgp

Compare competing sources

Within a table and prefix, higher administrative preference wins, followed by lower metric. Defaults include Connected 240, Static 200, OSPF 150, IS-IS 145, RIP 120, Babel 115, BGP 100, and Kernel 10. A BGP path first competes with other BGP paths inside the protocol. A configured static administrative distance uses the opposite scale: a larger distance makes it a weaker candidate.

Trace the implementation

ComponentResponsibility
wren-corePrefixes, next hops, route identity, best-route selection, and the FIB trait
wren-filterApply rule sets at import and export
wren-daemonSockets, timers, control queries, the router loop, and configuration reload
wren-netlinkEncode decisions as Linux kernel route updates

Other processes can subscribe to forwarding changes over the local control socket.