Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4003c00
docs: collector revision plan rev 4 addressing delegated review
Aug 20, 2026
334450b
feat(archive): Phase 0 foundations - parser 0.20, dual-stack, raw pas…
Aug 20, 2026
4105000
docs: Phase 1 rev - duck announcement reference and in-process accept…
Aug 20, 2026
fcbddb4
feat(bgp): Phase 1 - real peering collector with capability negotiation
Aug 20, 2026
59ddd87
fix(bgp): family gating for announcements and End-of-RIB markers
Aug 20, 2026
0ccae7e
fix(bgp): parse peer address as IpAddr for IPv6 connect paths
Aug 20, 2026
549ddca
test: regression for bare IPv6 peer address dial path
Aug 20, 2026
fd6fbd3
fix(bgp): AS_PATH type 2 with negotiated segment width, not AS4_PATH
Aug 20, 2026
a0310cb
feat(prefix): runtime announce/withdraw via `focl prefix`
digizeph Sep 11, 2026
c0cf2cb
fix(prefix): address review round 1
digizeph Sep 11, 2026
e580820
fix(prefix): address review round 2
digizeph Sep 11, 2026
cbadda1
Merge pull request #1 from bgpkit/feat/runtime-prefix-control
digizeph Sep 11, 2026
31b0189
feat(bgp): optional attribute-255 clock on announcements
Sep 12, 2026
25b4577
Merge pull request #2 from bgpkit/feat/attr255-clock
digizeph Sep 29, 2026
bd0605a
docs: cover the collector revision in the CHANGELOG and drop deployme…
digizeph Sep 29, 2026
3f7a076
fix(bgp): passive TCP-MD5, hold-time negotiation, AS4_PATH, refresh r…
digizeph Sep 29, 2026
0778bd4
fix(bgp): prefix control review findings (remove, list, reload delta,…
digizeph Sep 29, 2026
3d91fa0
fix(archive): wire live Adj-RIB-In into snapshots, archive local dire…
digizeph Sep 29, 2026
89c5599
fix(bgp,archive): close the remaining PR-3 review findings
digizeph Sep 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,48 @@ All notable changes to this project will be documented in this file.

## Unreleased

### Fixes

* **TCP-MD5 on the passive listener** - the per-peer keys are installed on the listening socket (Linux `TCP_MD5SIG`) before the accept loop, because the kernel validates the digest on the SYN and `accept()` never returns for a peer whose key is missing; the key is still applied to the accepted socket as well.
* **RFC 4271 hold time** - OPEN advertises the configured hold time unchanged (0 disables the timers instead of being raised to 3), the remote OPEN's hold time is taken into account (0 on either side disables the timers, otherwise the smaller value wins), and the keepalive and hold timers are driven by that negotiated value.
* **RFC 6793 AS4_PATH fallback** - a session that did not negotiate the four-octet AS capability now carries `AS_TRANS` in AS_PATH and the real local ASN in AS4_PATH instead of a truncated 2-octet AS_PATH.
* **RFC 2918 route refresh replay** - a received ROUTE-REFRESH for a negotiated family re-sends that family's Adj-RIB-Out followed by its End-of-RIB (the hold timer reset is unchanged); a refresh for a family the session does not carry is ignored, and the RFC 7313 BoRR/EoRR subtypes are not implemented.
* **End-of-RIB for a capability-less peer** - the IPv4 End-of-RIB decision now agrees with the announcement decision, so a plain RFC 4271 peer that negotiated no capabilities gets its IPv4 marker.
* **One initial table send** - the establishment table is sent exactly once, inside the registration critical section, with the End-of-RIB markers after it; the previous pre-lock send re-sent every copy after the EoR and archived it twice.
* The TCP-MD5 socket helpers are re-exported as `focl::bgp::{TcpSocketExt, TcpStreamExt}`.

### New features

* **Real peering collector (Phase 1)** - the established session loop no longer discards UPDATEs: raw frames go to the archive and parsed prefixes fill a per-peer Adj-RIB-In that `focl rib in` reads, cleared on session end. OPEN advertises MP-BGP IPv4 and IPv6 unicast plus four-octet AS (AS_TRANS on the wire for a 4-byte local ASN) and, when configured, route refresh; peer capabilities are parsed from the raw frame with negotiated families, ASN4 and route refresh tracked per session, and the remote ASN validated including AS_TRANS resolution. A peer that negotiates no capabilities still establishes plain IPv4 unicast. IPv4 prefixes are announced with classic NLRI and NEXT_HOP, IPv6 through MP_REACH_NLRI, and an invalid non-IPv6 configured next hop is rejected instead of malformed-encoded.
* **Global passive listener** - one bind of `global.listen_addr` serves every inbound connection; a connection is matched against the configured peers before any state change (unmatched ones are dropped with a log), TCP-MD5 is applied to accepted sockets, an inbound connection wins a collision with a simultaneous outbound attempt, and the active loop resumes once it ends.
* **Dual-stack archive with raw-frame passthrough (Phase 0)** - archive record types carry `IpAddr`/`IpNet` peers and prefixes, so both families share the update and RIB paths. An UPDATE is written as the original wire frame inside a `BGP4MP_MESSAGE_AS4` envelope instead of being parsed and re-encoded, preserving wire fidelity and unknown attributes. TABLE_DUMP_V2 groups IPv4 and IPv6 entries per (family, prefix) with snapshot-global sequence numbers and ADD-PATH subtypes when a path id is present. Dependencies move to `bgpkit-parser` 0.20 and `bzip2` 0.6, with a new `ipnet-trie` dependency.
* **Runtime prefix control** - `focl prefix add|remove|list` announces or withdraws an originated prefix on the running daemon without restarting it or resetting any session. The effective set is (configured `[[prefixes]]` + runtime additions) minus runtime suppressions: `prefix remove` suppresses a configured prefix (a runtime-only one is dropped), `prefix add` announces it again and clears the suppression, and `prefix list` shows each prefix as `announced`/`suppressed` with a `config`/`runtime` source. Runtime overrides are in-memory only and are never written back to the config file. Address family is inferred from the prefix, `--next-hop` defaults to the configured next hop of the same family, `--dry-run` reports what would be sent without changing state, and `--json` prints the control response.
* **`focl reload` applies the config's prefix delta** - reload re-reads the config file, announces prefixes added since the last read, withdraws removed ones, and clears runtime overrides; the response reports the delta and how many overrides were reset. Peer and archive settings still require a restart.
* **Attribute-255 clock on announcements** - a `[[prefixes]]` entry with `dev_attr255_interval_secs = N` attaches attribute 255 (reserved for development, RFC 2042) carrying a 13-byte BGPKIT clock payload (magic, version, refresh round, unix seconds) to that prefix's announcements, re-announced every N seconds. A runtime `prefix add` for a configured network keeps its clock, and an interval of 0 is rejected by config validation.

### Code improvements

* Outbound route changes are dispatched to established sessions through a per-session channel, and the session loop now selects between that channel and the socket read on split read/write halves. Update encoding for both directions is shared with the establishment path (`emit_updates`).
* Session framing moved to a dedicated reader task: the session loop selects between control operations and incoming messages, and `read_exact` is no longer cancelled mid-message by an operation.
* A session is registered as a runtime-change target only after it is serving, and its negotiated address families travel with the registration, so dispatch and `--dry-run` targets name only the peers that can carry the update.
* Runtime prefix mutations are serialized with their dispatch, so two concurrent control clients cannot enqueue a withdrawal before the announcement it reverses.
* `prefix add` treats a next-hop change as a change (peers keep the old next hop until re-announced), a runtime entry shadows the configured entry for the same network, and the default next hop is taken from the config baseline only.
* A session registers for runtime changes under the same lock as its initial table send, so a mutation racing with establishment cannot leave the new session advertising a stale set. `prefix remove` reports `source: null` for a network the state never knew instead of labelling it `config`.
* Review fixes on the runtime prefix control path: `prefix remove` now also suppresses the config baseline of a configured network that carried a runtime override (previously peers got a withdrawal while the state still called the network announced), `prefix list` shows the runtime entry that is actually announced, `reload` re-announces an entry whose next hop or attribute-255 interval changed, `--dry-run` reports a next-hop change like the real mutation, provenance is read under the mutation lock, and a configured next hop that does not match the prefix family is rejected when the config is parsed.
* Socket-level acceptance tests cover the runtime path: `prefix_add`/`prefix_remove` reach an established peer on the wire (announcement, withdrawal, session stays established) and a prefix is not dispatched to a peer that did not negotiate its family.
* `focl --json` output now exits non-zero on a failed response; `--json` changes formatting only.
* Archive writers rotate on the ingestion clock only, so a record with a late or zero event timestamp stays in the current segment with its event time preserved in the MRT header, and a rollover with no routes no longer writes an empty RIB snapshot.
* The archive collector id and custom path templates are validated at config load: the id must match `^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$`, templates reject absolute, backslash, control-character, empty and `..` components, and the rendered path is asserted to stay inside the archive root.

### Bug fixes

* **RIB snapshots carry the live Adj-RIB-In.** The archive asks the speaker for its current view through a small source port that `focld` registers after both services exist, so `rib.*` segments are produced again on the configured interval: one peer index table entry per peer holding a session (with the BGP identifier from its OPEN) and one `TABLE_DUMP_V2` RIB entry per Adj-RIB-In route, with path attributes rebuilt from ORIGIN, the received AS path and the IPv4 next hop. A view without routes still writes no file, and `archive snapshot-now` serves the same view while writing a segment on the explicit request.
* **An inbound session's exit from Established is archived.** The state transition is recorded before the RIB (and the session's local address with it) is cleared, in both the active and the passive session path, so the `Established -> Active` record is no longer dropped.
* **Locally generated messages use the local BGP4MP subtype.** Our own announcements are archived as `BGP4MP_MESSAGE_AS4_LOCAL` (subtype 7) instead of `BGP4MP_MESSAGE_AS4`, so a consumer does not read them as updates received from the peer. Both directions stay archived; the received path is unchanged.
* **A ROUTE-REFRESH replay no longer waits for the mutation lock.** The replay reads the advertised state directly, because the session loop is the only drain for its own queue: a control client blocked on that full queue while holding the lock could never be unblocked. Ordering is kept by the loop itself - the state read is one view, so a mutation applied before it is inside the replay and a later one is written after it.
* **A queued manifest cannot redirect a copy.** The replication path re-reads the manifest from disk on every attempt, so its relative path is now resolved before use: absolute paths, `..` components and an empty path are refused, and a local target is asserted to stay inside the destination root.
* **Missed clock ticks are skipped.** The attribute-255 ticker no longer bursts: after a stall one refresh per clock round is dispatched instead of one per missed tick, which could fill a session queue without recovering a measurement.

## v0.1.0 - 2025-02-21

### New features
Expand Down
Loading
Loading