What the code-health review found, and what a fuzz target written for it
found in its first seconds.
- A set of attributes with the same attribute twice is refused by the
routing table. Its readers (the selection key, the path, the next hop)
could each take a different one of the two. The decoder never lets one
through; the new fuzz target `attrs` found that the table would.
- bgp_peer_up{peer}, to alert on a peer going away, and bgp_build_info.
Every metric is there from the first scrape. Alerts for a peer down,
hijack attempts and kernel errors are in the README.
- `bgp --check config` validates a configuration without starting, and
`--version` says which build it is. CI runs the first on the example
configuration, which a test now also parses with its commented fields
put in; the example had to learn about the next hop check.
- Path attributes have a module of their own, packet::attributes,
re-exported from packet::message as before.
- policy::From, which shadowed the trait, is RouteSource. The server's
connection, dialer and fsm modules are private. Logging arguments live
in the binary; the server library no longer depends on clap.
- One is_unicast_link_local (the standard library's) instead of two of
our own; SelectionKey::origin(); one place where an Import is made.
- READMEs say what the daemon does today rather than what it did not do
a year ago. Documentation links are checked in CI. Unused dependencies
and bgp_web::serve are gone; the Docker build is --locked and does not
ship the fuzz corpus.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
76 lines
2.5 KiB
YAML
76 lines
2.5 KiB
YAML
# Runs on every push and pull request. Gitea Actions reads this file too
|
|
# (it falls back to .github/workflows), so one definition serves both.
|
|
name: ci
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# Warnings fail the build here, and only here: locally they stay warnings
|
|
# so that work in progress compiles.
|
|
RUSTFLAGS: -D warnings
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
- name: Format
|
|
run: cargo fmt --all -- --check
|
|
- name: Lint
|
|
run: cargo clippy --locked --workspace --all-targets -- -D warnings
|
|
- name: Test
|
|
run: cargo test --locked --workspace
|
|
# A link in the documentation to something that is not there.
|
|
- name: Documentation
|
|
env:
|
|
RUSTDOCFLAGS: -D warnings
|
|
run: cargo doc --locked --workspace --no-deps --document-private-items
|
|
# The example operators start from, through the daemon itself.
|
|
- name: Example configuration
|
|
run: cargo run --locked -p bgp -- --check testdata/server.textpb
|
|
# The tests that change a kernel's routes, in a network namespace of
|
|
# their own; and two daemons that route for each other.
|
|
- name: Kernel tests
|
|
run: scripts/kernel-tests.sh
|
|
|
|
# The daemon against FRR, BIRD and Routinator; see bin/bgp/README.md.
|
|
interop:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- name: Install FRR, BIRD and Routinator
|
|
run: scripts/interop/install.sh
|
|
- name: Build
|
|
run: cargo build --release --locked -p bgp
|
|
- name: Interoperability lab
|
|
run: scripts/interop/lab.sh
|
|
|
|
# A short run of each fuzz target: enough to notice a parser change that
|
|
# breaks on input the seeds are close to. Long runs are done by hand; see
|
|
# fuzz/README.md.
|
|
fuzz:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
- name: Install cargo-fuzz
|
|
run: cargo install cargo-fuzz --locked
|
|
- name: Fuzz
|
|
working-directory: fuzz
|
|
# cargo-fuzz sets its own flags; the workspace's -D warnings would
|
|
# replace them.
|
|
env:
|
|
RUSTFLAGS: ""
|
|
run: |
|
|
for target in message message_body attrs prefix_text config rtr netlink; do
|
|
mkdir -p "corpus/$target"
|
|
cargo fuzz run "$target" "corpus/$target" "seeds/$target" -- -max_total_time=60
|
|
done
|