Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
3d55f09
remove mg-common::net::IpPrefix and friends
taspelund Jul 25, 2025
26e3205
mg-ddm-verify: remove custom Prefix/Destination types
taspelund Jul 25, 2025
3c1e428
rdb: remove unused types
taspelund Jul 30, 2025
35885bc
IPv6 foundations
taspelund Jul 31, 2025
f8c8740
Support for IPv6 Static Routes
taspelund Jul 31, 2025
e15860f
mgadm: move to oxnet instead of custom types
taspelund Aug 1, 2025
1594219
Zero host bits in prefixes
taspelund Aug 3, 2025
c004f22
remove invalid static prefixes from db on startup
taspelund Aug 5, 2025
dae03ff
rename host_bit zeroing function
taspelund Aug 5, 2025
e1620eb
Add unit tests for Prefix conversion, IPv6, static routing
taspelund Aug 6, 2025
3cb5f54
Move macros from bgp into mg-common
taspelund Aug 6, 2025
fa64f8b
Add IPv6 support for BGP Origin
taspelund Aug 8, 2025
560eaa7
Add buildomat job for mgadm
taspelund Aug 8, 2025
d64b896
Use const for interval/iterations in wait_for macros
taspelund Aug 8, 2025
b899397
Fix buildomat copy pasta error
taspelund Aug 8, 2025
004a86d
move rib queries out of bgp and add query filters
taspelund Aug 9, 2025
f2082b0
remove useless cp in test-mgadm.sh
taspelund Aug 9, 2025
bfaef67
bgp: add more info to session logs
taspelund Aug 20, 2025
21e4c01
bgp: Add NET error logs for channel
taspelund Aug 20, 2025
0f05fb4
mg-common, bgp: refactor test macros, add assert msg
taspelund Aug 20, 2025
59985f4
bgp: fix IdleHoldTimer handling
taspelund Aug 22, 2025
cde0b69
Merge remote-tracking branch 'origin/main' into trey/ipv6
taspelund Aug 22, 2025
e39f0bd
bgp: stop binding the listener after every accept
taspelund Aug 22, 2025
e6713cb
bgp: centralize IdleHoldTimer handling
taspelund Aug 22, 2025
44b4795
bgp: document and refactor basic tests
taspelund Aug 22, 2025
47378e5
bgp: refactor tests and add support for TCP
taspelund Aug 25, 2025
50320a3
bgp: add support for local TCP based tests
taspelund Aug 26, 2025
ff26150
bgp: more connection log changes
taspelund Aug 26, 2025
1f707e5
bgp, mg-common: fix LoopbackIpManager, cleanup tests
taspelund Aug 26, 2025
bc846a6
bgp: refactor tests, bind before TCP connect()
taspelund Aug 27, 2025
0ed315b
bgp: fix comment, remove dupe timer disable
taspelund Aug 27, 2025
c214ac0
bgp, mg-common: add unit to session runner logs
taspelund Aug 28, 2025
810ff47
bgp, mg-common: move bgp log macros to mod in bgp
taspelund Aug 28, 2025
e89861d
bgp: start adding structure to logs
taspelund Aug 28, 2025
28487f3
bgp: add structured logging for connections
taspelund Aug 28, 2025
4a8d46a
bgp: add structured logs to clock, fix mod/unit name
taspelund Aug 28, 2025
bf69398
bgp: finish converting to structured logging
taspelund Aug 28, 2025
1f26da8
rdb: convert to structured logging
taspelund Aug 28, 2025
3ac20cb
bgp: tweak message display, expand logs
taspelund Aug 28, 2025
cc57542
bfd: move to structured logging
taspelund Aug 29, 2025
de48295
mg-lower: convert to structured logging
taspelund Aug 29, 2025
8d12047
mgd: convert to structured logging
taspelund Aug 30, 2025
21158ab
bgp: track connection creator in logs
taspelund Aug 30, 2025
7458c6f
bgp: give clock named values
taspelund Aug 30, 2025
d985f6a
bgp: add clock state to session_runner logs
taspelund Aug 30, 2025
ffc4af8
bgp: add connection collision logs
taspelund Aug 31, 2025
a0dbbbe
bgp: major fsm refactoring
taspelund Sep 25, 2025
2f55bb1
bgp: continuation of session runner refactor
taspelund Sep 30, 2025
de04bb2
bgp: start Cnx recv loop after conn registration
taspelund Oct 2, 2025
0e4796a
bgp: finish conn_id handling e.g. in established
taspelund Oct 2, 2025
7daa26d
bgp: more SessionRunner.stop() and unregister_conn()
taspelund Oct 3, 2025
14b44dd
bgp: logging macro improvements
taspelund Oct 3, 2025
cdf0a44
bgp: fix premature clock shutdown on connection drop
taspelund Oct 6, 2025
3a18ab0
bgp: remove restart_connect_retry() method
taspelund Oct 6, 2025
cece3c1
bgp: improve timer and connection lifecycle management
taspelund Oct 6, 2025
5c23902
bgp: fix ConnectRetryTimerExpires deadlock
taspelund Oct 6, 2025
e29fc0d
bgp: make outbound connections non-blocking
taspelund Oct 7, 2025
86752c0
move back to mpsc channels
taspelund Oct 7, 2025
180e6a9
bgp: improve connection cleanup and error handling
taspelund Oct 7, 2025
3efab1c
mg-common: remove fs2 dependency
taspelund Oct 7, 2025
05a9445
fix illumos compilation errors and tcp md5
taspelund Oct 7, 2025
7a24018
mg-common: fix LoopbackIpManager for illumos
taspelund Oct 8, 2025
6b7f4fa
bgp: update channel logging
taspelund Oct 8, 2025
a9a5188
bgp: fix collision resolution semantics
taspelund Oct 8, 2025
5358c21
buildomat: run bgp tests with pfexec
taspelund Oct 9, 2025
67ade06
bgp: fix IPv6 next-hops sent for IPv4 updates
taspelund Oct 9, 2025
f5aeb34
bgp, mgd: more bind() and connect() fixes
taspelund Oct 9, 2025
6036628
bgp: cleanup Update Display impl
taspelund Oct 10, 2025
5fbcd4c
bgp: reject second connection with same initiator
taspelund Oct 10, 2025
9930a02
bgp: add type documentation and do minor refactoring
taspelund Oct 14, 2025
545ee54
bgp, mgd: add timer enabled check, shorten names
taspelund Oct 14, 2025
83d6c17
bgp: make connect() timeout 1/3 ConnectRetryTime
taspelund Oct 15, 2025
27f2481
bgp: track BgpConnector thread lifecycle
taspelund Oct 15, 2025
37eda87
bgp: fix missing connection collision unregister
taspelund Oct 15, 2025
bc0312f
bgp: fix concurrent startup deadlock w/ timer jitter
taspelund Oct 16, 2025
51045a6
bgp: add channel_id to BgpConnectionChannel
taspelund Oct 16, 2025
56d2a7e
bgp: refactor resolve_collision()
taspelund Oct 17, 2025
ecb986a
bgp: validate connection ID in OpenConfirm message handler
taspelund Oct 18, 2025
50b4c53
bgp: eagerly resolve collisions on first open
taspelund Oct 18, 2025
1cb96d2
buildomat: use new rib status commands
taspelund Oct 22, 2025
50655b1
bgp: handle async collision resolution notifications
taspelund Oct 22, 2025
28ec049
Add MPL to new files
taspelund Oct 22, 2025
ccaca84
bgp: consolidate to rdb Prefix types
taspelund Oct 23, 2025
1837449
bgp: Idle and IdleHoldTime improvements
taspelund Oct 23, 2025
6cf0bc1
bgp: disable IdleHoldTimer in test topologies
taspelund Oct 23, 2025
1904844
bgp: revert non-standard notification handling
taspelund Oct 23, 2025
10d7c46
Remove last vestiges of crossbeam_channel
taspelund Oct 23, 2025
2a2717e
Merge remote-tracking branch 'origin/main' into trey/ipv6
taspelund Oct 24, 2025
eb9af4c
rdb: add generic get_test_db method
taspelund Oct 24, 2025
181497a
bfd: make cargo fmt happy
taspelund Oct 25, 2025
e4f85d3
bgp: address some linux build errors
taspelund Oct 27, 2025
9380f83
bgp: fix another double import
taspelund Oct 27, 2025
9702361
buildomat: remember to source test-common
taspelund Oct 27, 2025
2039742
bgp: singly re-add sockopt imports
taspelund Oct 27, 2025
556087c
bgp: make clippy happy
taspelund Oct 27, 2025
bff225a
Add versioned endpoint for bgp message history
taspelund Oct 28, 2025
996d464
bgp: add versioned endpoint for BGP neighbors
taspelund Oct 28, 2025
a3f3c54
bgp: versioned API updates
taspelund Oct 28, 2025
dcad2e9
openapi: publish spec for mg-admin API v2
taspelund Oct 28, 2025
e64aa1f
mgadm: update client API calls
taspelund Oct 28, 2025
1201b75
Remove AddressFamily::All
taspelund Oct 28, 2025
41ac151
refactor: consolidate AddressFamily and improve documentation
taspelund Oct 28, 2025
cf1c650
bgp: add deterministic collision resolution knob
taspelund Oct 28, 2025
08bf9e8
Make libnet dependency illumos-specific
taspelund Oct 29, 2025
20f022f
mg-common: linux clippy make happy
taspelund Oct 29, 2025
2054c22
docs: add docs dir with bgp architecture overview
taspelund Oct 30, 2025
1b236ab
PR review feedback batch #1
taspelund Oct 31, 2025
d3eb8fe
Fix missing rename for illumos
taspelund Oct 31, 2025
a3d003d
PR review feedback batch #2
taspelund Nov 4, 2025
5235789
bgp: initial work to move recv loop to typestate
taspelund Nov 6, 2025
1865014
bgp: apply typestate pattern to connections and recv loops
taspelund Nov 7, 2025
1496cf3
bgp: move FSM event queue reads to macro
taspelund Nov 7, 2025
08fe710
PR review batch #3
taspelund Nov 7, 2025
d5ee84f
bgp: retry accept() until timeout expires
taspelund Nov 7, 2025
bab9114
bgp: initial cleanup/improvement of md5 code
taspelund Nov 7, 2025
5e24fec
bgp: refactor MD5 SA keepalive to use typestate
taspelund Nov 7, 2025
70d0d33
bgp: fix illumos compile issues in md5 code
taspelund Nov 8, 2025
795c70a
rdb: separate wire format parsing from semantic validation
taspelund Nov 11, 2025
6c482f1
bgp: filter bogus nlri before empty check
taspelund Nov 11, 2025
d8db273
bgp: make Prefix -> PrefixV1 conversion infallible
taspelund Nov 11, 2025
06db20d
bgp, rdb: refactor Prefix validation
taspelund Nov 13, 2025
8043c42
docs: expand on deterministic collision resolution
taspelund Nov 13, 2025
0a289a2
buildomat, bfd, rdb: fix test issues with Db
taspelund Nov 13, 2025
fb04ee2
bgp: remove Default for SessionInfo
taspelund Nov 13, 2025
88ba092
mgd, rdb: update prefix host bit handling
taspelund Nov 13, 2025
9ef321d
bgp: cleanup connection id validation in FSM
taspelund Nov 13, 2025
b57f159
bgp: mark event_rx channel disconnected unreachable
taspelund Nov 13, 2025
a5c5a26
bgp: defensive handling of FSM timer events
taspelund Nov 13, 2025
32f5436
fmt
taspelund Nov 13, 2025
674e352
mgadm: sort bgp neighbors by IP
taspelund Nov 14, 2025
4621c28
Add BGP FSM event history
taspelund Nov 14, 2025
07181aa
bgp: fix first batch of thread leaks
taspelund Nov 15, 2025
a57c700
bgp: add explicit router lifecycle
taspelund Nov 16, 2025
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
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-bfd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#: rust_toolchain = "stable"
#: output_rules = [
#: "/work/*.log",
#: "/tmp/*.db",
#: ]
#:

Expand Down
4 changes: 2 additions & 2 deletions .github/buildomat/jobs/test-bgp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ set -e

source .github/buildomat/test-common.sh
pushd bgp
cargo nextest run
pfexec cargo nextest run
cp *.log /work/
popd

pushd mgd
cargo nextest run
pfexec cargo nextest run
cp *.log /work/
popd
4 changes: 2 additions & 2 deletions .github/buildomat/jobs/test-interop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ net_info() {
MGD_IP=$(pfexec ./interop exec mgd "ipadm show-addr $MGD_IF/v4 -p -o addr | cut -d / -f 1")
fi
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status neighbors 65100"
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status imported 65100"
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status selected 65100"
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm rib status imported"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems odd to me that getting imported routes no longer requires an ASN as a router identifier. But i'll probably get to that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tracked in #525

I moved it under rib instead of bgp because it is not a bgp-specific table. Static routes follow the same imported -> selected path and are un-queryable without a BGP router configured.

ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm rib status selected"
ssh root@"$MGD_IP" "/opt/cargo-bay/mgadm bgp status exported 65100"
}

Expand Down
32 changes: 32 additions & 0 deletions .github/buildomat/jobs/test-mgadm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#:
#: name = "test-mgadm"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "stable"
#: output_rules = [
#: "/work/*.log",
#: ]
#: access_repos = [
#: "oxidecomputer/dendrite",
#: ]
#:

set -x
set -e

# NOTE: This version should be in sync with the recommended version in
# .config/nextest.toml. (Maybe build an automated way to pull the recommended
# version in the future.)
NEXTEST_VERSION='0.9.97'
PLATFORM='illumos'

cargo --version
rustc --version
cargo install cargo-nextest --version "$NEXTEST_VERSION"

source .github/buildomat/test-common.sh

pushd mgadm

cargo nextest run
50 changes: 50 additions & 0 deletions .github/buildomat/jobs/test-proptest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
#:
#: name = "test-proptest"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "stable"
#: output_rules = [
#: "/work/*.log",
#: "/work/proptest-regressions/*",
#: "/tmp/*.db",
#: ]
#: access_repos = [
#: "oxidecomputer/dendrite",
#: ]
#:

set -x
set -e

# NOTE: This version should be in sync with the recommended version in
# .config/nextest.toml. (Maybe build an automated way to pull the recommended
# version in the future.)
NEXTEST_VERSION='0.9.97'
PLATFORM='illumos'

cargo --version
rustc --version
cargo install cargo-nextest --version "$NEXTEST_VERSION"

source .github/buildomat/test-common.sh

# Run property-based tests with high intensity (default is 256)

# RDB proptest suite
pushd rdb
PROPTEST_CASES=1000000 cargo nextest run --lib proptest
cp *.log /work/ 2>/dev/null || true
if [ -d proptest-regressions ]; then
cp -r proptest-regressions /work/rdb-proptest-regressions
fi
popd

# BGP proptest suite
pushd bgp
PROPTEST_CASES=1000000 cargo nextest run --lib proptest
cp *.log /work/ 2>/dev/null || true
if [ -d proptest-regressions ]; then
cp -r proptest-regressions /work/bgp-proptest-regressions
fi
popd
1 change: 1 addition & 0 deletions .github/buildomat/jobs/test-rdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#: rust_toolchain = "stable"
#: output_rules = [
#: "/work/*.log",
#: "/tmp/*.db",
#: ]
#:

Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/test-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ set -o errexit

cargo --version
rustc --version
curl -sSfL --retry 10 https://get.nexte.st/"$NEXTEST_VERSION"/"$PLATFORM" | gunzip | tar -xvf - -C ~/.cargo/bin
cargo install cargo-nextest --version "$NEXTEST_VERSION"
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ reqwest = { version = "0.12", default-features = false, features = ["json", "str
clap = { version = "4.5.47", features = ["derive", "unstable-styles", "env"] }
tabwriter = { version = "1", features = ["ansi_formatting"] }
colored = "3.0"
ctrlc = { version = "3.4.7", features = ["termination"] }
ztest = { git = "https://github.com/oxidecomputer/falcon", branch = "main" }
anstyle = "1.0.11"
nom = "7.1"
Expand Down Expand Up @@ -108,6 +107,7 @@ libc = "0.2"
itertools = "0.14"
rhai = { version = "1", features = ["metadata", "sync"] }
semver = "1.0"
proptest = "1.4"
ddm-api = { path = "ddm-api" }
ddm-types = { path = "ddm-types" }

Expand Down
27 changes: 20 additions & 7 deletions bfd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,17 @@ use std::sync::atomic::AtomicU64;
use std::time::Duration;

pub mod bidi;
pub mod log;
pub mod packet;
mod sm;
mod util;

pub const COMPONENT_BFD: &str = "bfd";
pub const MOD_DAEMON: &str = "daemon";
pub const MOD_SM: &str = "state_machine";

pub const UNIT_PEER: &str = "peer";

/// A `Daemon` is a collection of BFD sessions.
pub struct Daemon {
/// Sessions keyed by peer IP address.
Expand Down Expand Up @@ -49,7 +56,10 @@ impl Daemon {
) {
if self.sessions.contains_key(&peer) {
warn!(self.log, "attempt to add peer that already exists";
"peer" => format!("{:#?}", peer)
"component" => COMPONENT_BFD,
"module" => MOD_DAEMON,
"unit" => UNIT_PEER,
"peer" => format!("{peer}")
);
return;
}
Expand Down Expand Up @@ -310,9 +320,10 @@ mod test {

#[test]
fn test_new_daemon() -> anyhow::Result<()> {
let db = rdb::Db::new("/tmp/bfd_new_daemon.db", test_logger()).unwrap();
let log = test_logger();
let db = rdb::test::get_test_db("bfd_new_daemon", log.clone()).unwrap();

let mut daemon = Daemon::new(test_logger());
let mut daemon = Daemon::new(log);
assert_eq!(daemon.sessions.len(), 0);

let (a, _b) = bidi::channel();
Expand All @@ -323,7 +334,7 @@ mod test {
3,
SessionMode::MultiHop,
a,
db,
db.db().clone(),
);
assert_eq!(daemon.peer_state(p1_addr), Some(BfdPeerState::Down));

Expand All @@ -332,7 +343,9 @@ mod test {

#[test]
fn test_protocol_basics() -> anyhow::Result<()> {
let db = rdb::Db::new("/tmp/bfd_new_daemon.db", test_logger()).unwrap();
let log = test_logger();
let db =
rdb::test::get_test_db("bfd_protocol_basics", log.clone()).unwrap();

let mut net = Network::default();

Expand All @@ -347,7 +360,7 @@ mod test {
3,
SessionMode::MultiHop,
a,
db.clone(),
db.db().clone(),
);
net.register(addr2, b);

Expand All @@ -359,7 +372,7 @@ mod test {
3,
SessionMode::MultiHop,
a,
db,
db.db().clone(),
);
net.register(addr1, b);

Expand Down
Loading