What BIRD Does

Site Admin · 3 Dec 2026 · Routing & Protocols

BGP, OSPF, RIP, Babel, RPKI, and a filter language with real AS path masks. The matcher that evaluates those masks is the busiest code in the daemon — and the one with a fixed-size stack record.

One daemon, four protocols, one filter language. The filter language is the
feature people choose BIRD for — and the component that turns a long AS_PATH
into a stack write.

The protocols

BGP is the main event: eBGP and iBGP, IPv4 and IPv6, route reflection,
confederations, communities, large communities, AS_PATH prepending, ADD-PATH,
and route refresh. BIRD's BGP implementation is what exchanges and service
providers deploy.

OSPF and RIP cover the interior. BIRD runs them where a small daemon
is preferable to a full routing suite, and its OSPF implementation is mature
enough for enterprise edges.

Babel is the interesting outlier: a loop-avoiding distance-vector protocol
designed for mesh and wireless networks. BIRD's Babel support is one of the
better open implementations.

RPKI is the validation side: BIRD can connect to an RPKI-to-Router server
and mark routes by origin validation state, so filters can reject invalid
origins. That is table-stakes for modern BGP hygiene.

The filter language

Filters are BIRD's defining feature. They are real programs: variables,
functions, loops, sets, prefix patterns, and AS path masks.

Examples of the mask syntax:

bgp_path ~ [= * 64500 =]     # any path ending in 64500
bgp_path ~ [= 64500 * =]     # any path starting with 64500
bgp_path ~ [= * 64500 64501 =]

The last form says: match a sequence where 64500 is followed by 64501 anywhere
in the path. To evaluate it, BIRD has to align the pattern against the path and
record where each element lands. That alignment is as_path_match().

The jobs, and where the bug lives

Job What the filter does Exposure
Route server Accept customer prefixes, reject transit leaks AS_PATH masks on every route
Route reflector Reflect iBGP with policy Same matcher, internal paths
Edge router Inbound/outbound policy, RPKI Matcher plus attribute parsing
Looking glass Query the RIB No peer input, lower risk

The route-server job is the highest-exposure one because it applies masks to
routes from hundreds of members. The matcher is on the hot path for every
UPDATE.

A tiny policy, for scale

protocol bgp member_64500 {
  local as 65000;
  neighbor 192.0.2.10 as 64500;

  ipv4 {
    import filter {
      if (bgp_path ~ [= * 64500 =]) then accept;
      reject;
    };
    export filter {
      if (bgp_path ~ [= * 65000 =]) then accept;
      reject;
    };
  };
}

Two mask evaluations per route. Multiply by the number of routes and members,
and the matcher is the busiest piece of code in the daemon. It is also the
piece that stores match positions in a fixed array.

Why the design is attractive

BIRD's combination is rare: a small C daemon, a fast event loop, a filter
language with real expressiveness, and protocol coverage that fits an exchange.
It starts quickly, uses little memory, and its configuration is readable by
humans.

That compactness is also why the bug matters. The same hand-sized data
structures that make BIRD fast are the ones that need bounds checking — and the
matcher's bound is the subject of part 5.

Next: Part 4 — what you trade for a small daemon: BIRD against FRR,
OpenBGPD, GoBGP and the vendor stacks.