Rayhaan JaufeerallyandClaude Fable 5.1 87f96f9389 feature: RFC 4271 §6.8 connection collision detection
When both ends dial each other, exactly one TCP connection must survive
and both ends must pick the same one. Previously ferrix relied on the
other router to sort this out and could briefly hold two sessions.

- collision: a shared map keyed by the peer's BGP Identifier holds the one
  connection currently preferred for that peer plus a kill signal. Each
  connection calls admit() on receiving the peer's OPEN. The connection
  initiated by the higher BGP Identifier wins; the loser gets Cease /
  Connection Collision Resolution, whether it is the new connection or an
  existing one in OpenConfirm running in another task.
- A collision with an Established session closes the new connection (RFC
  default). The optional CollisionDetectEstablishedState is available as
  collision_detect_established_state: a restarted peer's new connection
  then replaces the stale session at once instead of being refused until
  the hold timer expires. Enabled in the lab config.
- Two connections opened by the same side: the newer wins.
- OPEN validation rejects a peer using our own BGP Identifier or 0.0.0.0
  with Bad BGP Identifier; collision resolution needs distinct identifiers.
- OpenConfirm no longer times out instantly when the negotiated hold time
  is zero.
- Sessions record which side opened them; shown as "opened by" on the
  status page and as `direction` in /api/peers. New counter
  bgp_connection_collisions_total{closed}.
- Tests: unit tests for the rule (including that both ends agree), and
  integration tests for simultaneous open in both identifier orders and
  both arrival orders, Established default, restart replacement with route
  flush, distinct identifiers, slot release, and Bad BGP Identifier.
  Existing fan-out test now gives its two peers distinct identifiers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-19 15:05:13 +02:00
2025-04-19 17:13:04 +02:00

BGP

The bgp crate is an implementation of the Border Gateway Protocol, which is used to exchange routing and control plane information between Autonomous Systms.

The aim of this project is to provide a modern, high performance, secure and programatic and customizable software package that can be useful to network operators, researchers, and people interested in Internet.

Current status.

The project is currently being rewritten from scratch to be more modular and maintainable, as well as to fix deeper issues with the previous implementation.

⚠️ Warning: This is currently a work in progress and not ready for use.

🛣️ Roadmap to v1.0

We aim for the 1.0 release to be functional and stable to operate peering sessions, and to install routes in the Linux Kernel.

  • ☐ Implement basic parsers for the fundamental types required
    • ✅ Path Attributes from RFC4271
    • ✅ Open message
      • ✅ Capabilities from RFC4271
    • ✅ Update message
    • ☐ Notification message
  • ✅ Implement scaffolding required to start and configure a server
  • ✅ Implement connection logic to establish sessions with peers (passive and active)
  • ✅ Locally originated routes with communities, announced to all peers
  • ✅ HTTP API, live status page and Prometheus metrics
  • ☐ Implement an efficient data structure for storing prefixes (e.g. Poptrie)
  • ☐ Filtering for peer RIB in / out
  • ☐ Main / auxillary RIBs for exchanging routes between peers
S
Description
Ferrix BGP Speaker
Readme
5 MiB
0 Stars 0 Watchers 0 Forks
Languages
Rust 92.3%
Shell 4.2%
HTML 3.5%