The Porting Layer: Routing Sockets, Netlink, and the Startup Order That Must Hold

Site Admin · 29 Nov 2026 · Routing & Protocols

Routing sockets on OpenBSD, netlink on Linux. The portable layer papers over the difference — and every difference is a potential startup-ordering bug.

Part 3 established the three conditions and Part 4 named the trade. This
part goes inside the machine: how OpenBGPD learns the local routing table
on each platform, what the portable layer actually translates, and why a
startup-order assumption — invisible on OpenBSD — is exactly the kind of
thing that breaks on Linux.

How a daemon learns the local table

A BGP speaker does not only learn routes from its peers. It also needs to
know the local machine's own routes — the prefixes directly attached to
its interfaces, the ones it is allowed to originate or redistribute. That
knowledge comes from the operating system's routing table, and the table
is delivered by different hands on different systems:

The portable layer exists to hide this difference — one internal view of
"the local RIB", fed by whichever mechanism the platform provides.
Hiding is the job; the seam is where the bug lives.

The two candidate mechanisms, as the corpus describes them

The corpus names the two standard ways this exact symptom appears in
portable routing daemons — and is careful to label them as inferred,
not confirmed:

Kernel-route import race. If the initial netlink dump races the
daemon's startup — the netlink socket opened before the interface
addresses are up, or the dump completing after the configuration is
loaded — bgpd can come up with an empty or partial RIB. Worse, nothing
later re-triggers the import: the daemon believes it has a complete view
with nothing in it.

Initial-update scheduling. The portable layer must emulate BSD's
event and timer semantics on Linux. If the initial-update timer is armed
relative to a clock or an event that never occurs in the Linux build's
startup order, the full-table send is scheduled — and then never
delivered.

Either way, the corpus's verdict is the same sentence: a
startup-ordering assumption that holds on the native platform and fails
on the port.

Why portability semantics are load-bearing

The phrase the corpus hangs the whole analysis on deserves to be read
slowly: "Portability semantics are load-bearing and under-tested."

Load-bearing means the daemon's correctness depends on them. The bridge
is not decoration — on Linux, the entire view of the local world flows
through it, and the initial-advertisement trigger is armed by it.

Under-tested means the failure appears only in conditions a test suite
almost never reproduces: a cold boot, with a real routing table, with
real peers on the other end of real sessions. Unit tests start the daemon
after the network is ready, because test harnesses are polite. Reboots are
not polite.

The design chain, stated

  1. Startup ordering on OpenBSD: routing socket delivers the table, timers
    arm against real events, the daemon's first advertisement fires on an
    established session with a populated RIB.
  2. On Linux, each of those steps is mediated by the portable layer.
  3. If any one of them assumes an order that the Linux boot does not
    guarantee, the daemon's state machine says "ready" while the RIB says
    "empty" or the trigger says "never armed".
  4. The remainder of the failure is invisible by construction — the next
    part's subject.

The daemon is not crashing. It is not logging. It is waiting — for a
trigger that, on this boot, is not coming.

Next: Part 6 — the quiet failures first: Established, keepalives
flowing, and completely silent.