Rhai made a decision about a route cost one to three microseconds, some two hundred times what the same costs in Rust. That was bearable where a function is asked once for an UPDATE, and is not where every route is weighed against every peer, as it is when routes are passed on. What is wanted of a policy (mark routes by where they came from, mark what is announced, let communities say who is told what) needs no language; it is to be configuration, done natively. Kept from that work: route selection goes by a LOCAL_PREF that policy set on a route from an external peer, and the lab's configuration can be added to by a phase. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
69 lines
2.9 KiB
Markdown
69 lines
2.9 KiB
Markdown
# Ferrix BGP
|
|
|
|
An implementation of the Border Gateway Protocol, which is used to exchange routing and control plane information between Autonomous Systems.
|
|
|
|
The aim of this project is to provide a modern, high performance, secure, programmatic and customizable software package that can be useful to network operators, researchers, and people interested in Internet.
|
|
|
|
## Current status
|
|
|
|
The daemon holds sessions with configured peers, takes their routes through an import policy, validates them against the RPKI (route origin validation and ASPA), picks the best route for each prefix and, on Linux, installs it in the kernel. It announces the routes it originates. It does not yet pass routes learned from one peer on to another.
|
|
|
|
- [`bin/bgp/README.md`](bin/bgp/README.md): what the daemon does, how to configure and run it, and how it is tested against FRR, BIRD and Routinator.
|
|
- [`docs/RFCs.md`](docs/RFCs.md): which parts of which RFCs are implemented.
|
|
- [`crates/server/proto/config.proto`](crates/server/proto/config.proto): the configuration, field by field.
|
|
|
|
It has not yet run in a production network.
|
|
|
|
### Not there yet
|
|
|
|
- Announcing learned routes to other peers, and an export policy for it
|
|
- TCP-AO / TCP MD5 and GTSM
|
|
- Graceful restart, BFD, changing the configuration without a restart
|
|
- Next hops that are not directly connected
|
|
|
|
### Layout
|
|
|
|
| Crate | What is in it |
|
|
|-------|---------------|
|
|
| `crates/primitives` | Prefixes, address families, parsing helpers |
|
|
| `crates/packet` | The wire format: messages, attributes, capabilities |
|
|
| `crates/rib` | The routing table, best route selection, the journal of changes |
|
|
| `crates/rpki` | The RTR client; origin validation and ASPA path verification |
|
|
| `crates/fib` | The best routes in the Linux kernel, over netlink |
|
|
| `crates/server` | Sessions, the state machine, policy, configuration |
|
|
| `crates/web` | The status page, HTTP API and metrics |
|
|
| `bin/bgp` | The daemon |
|
|
|
|
## Development
|
|
|
|
CI runs these on every push, and fails on any warning:
|
|
|
|
```
|
|
cargo fmt --all -- --check
|
|
cargo clippy --workspace --all-targets -- -D warnings
|
|
cargo test --workspace
|
|
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items
|
|
```
|
|
|
|
It also runs the tests that need a real Linux kernel
|
|
(`scripts/kernel-tests.sh`) and the lab with FRR, BIRD and Routinator
|
|
(`scripts/interop/lab.sh`); `scripts/linux-vm.sh` runs either from macOS.
|
|
|
|
Lints are configured once, under `[workspace.lints]` in the root `Cargo.toml`.
|
|
`unsafe` code is forbidden throughout.
|
|
|
|
`cargo test` includes property tests: generated messages must survive being
|
|
written and read back, and no input, however damaged, may make a parser
|
|
panic. They take about a second; for a longer hunt:
|
|
|
|
```
|
|
PROPTEST_CASES=1000000 cargo test --release -p bgp-packet --test properties
|
|
```
|
|
|
|
Coverage-guided fuzz targets for the same parsers are in `fuzz/`; see
|
|
`fuzz/README.md`. CI runs each of them for a minute.
|
|
|
|
## License
|
|
|
|
Apache License 2.0; see `LICENSE`.
|