Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
92 changes: 92 additions & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ vpcmap = { path = "./vpcmap", package = "dataplane-vpcmap", features = [] }
# External
afpacket = { version = "0.2.3", default-features = false, features = [] }
ahash = { version = "0.8.12", default-features = false, features = [] }
anyhow = { version = "1.0.93", default-features = false, features = ["std"] }
arc-swap = { version = "1.7.1", default-features = false, features = [] }
arrayvec = { version = "0.7.6", default-features = false, features = [] }
async-trait = { version = "0.1.89", default-features = false, features = [] }
Expand Down Expand Up @@ -111,6 +112,7 @@ dyn-iter = { version = "1.0.1", default-features = false, features = [] }
etherparse = { version = "0.19.0", default-features = false, features = [] }
fixin = { git = "https://github.com/githedgehog/fixin", branch = "main", features = [] }
futures = { version = "0.3.31", default-features = false, features = [] }
futures-util = { version = "0.3.31", default-features = false, features = ["std"] }
hashbrown = { version = "0.16.1", default-features = false, features = [] }
hwlocality = { version = "1.0.0-alpha.11", default-features = false, features = [] }
hyper = { version = "1.8.1", default-features = false, features = [] }
Expand All @@ -135,6 +137,8 @@ multi_index_map = { version = "0.15.0", default-features = false, features = []
n-vm = { git = "https://github.com/githedgehog/testn.git", tag = "v0.0.9", default-features = false, features = [], package = "n-vm" }
netdev = { version = "0.39.0", default-features = false, features = [] }
nix = { version = "0.30.1", default-features = false, features = [] }
netgauze-bgp-pkt = { version = "0.8.0", features = [] }
netgauze-bmp-pkt = { version = "0.8.0", features = ["codec"] }
num-derive = { version = "0.4.2", default-features = false, features = [] }
num-traits = { version = "0.2.19", default-features = false, features = [] }
once_cell = { version = "1.21.3", default-features = false, features = [] }
Expand Down Expand Up @@ -174,6 +178,7 @@ thiserror = { version = "2.0.17", default-features = false, features = [] }
thread_local = { version = "1.1.9", default-features = false, features = [] }
tokio = { version = "1.48.0", default-features = false, features = [] }
tokio-stream = { version = "0.1.17", default-features = false, features = [] }
tokio-util = { version = "0.7.13", default-features = false, features = ["codec"] }
tonic = { version = "0.14.2", default-features = false, features = [] }
tracing = { version = "0.1.43", default-features = false, features = [] }
tracing-error = { version = "0.2.1", default-features = false, features = [] }
Expand Down
63 changes: 62 additions & 1 deletion args/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,25 @@ pub struct ConfigServerSection {
pub address: GrpcAddress,
}

/// BMP server configuration (optional; disabled when absent)
#[derive(
Debug,
PartialEq,
Eq,
serde::Serialize,
rkyv::Serialize,
rkyv::Deserialize,
rkyv::Archive,
CheckBytes,
)]
#[rkyv(attr(derive(PartialEq, Eq, Debug)))]
pub struct BmpConfigSection {
/// Bind address for the BMP server (IP:PORT)
pub address: SocketAddr,
/// Periodic housekeeping/flush interval in milliseconds
pub interval_ms: u64,
}

/// Complete dataplane launch configuration.
///
/// This structure contains all configuration parameters needed to initialize and run
Expand All @@ -574,7 +593,7 @@ pub struct ConfigServerSection {
/// 3. **Transfer**: Passed via sealed memfd to the worker process
/// 4. **Worker Process**: Calls [`LaunchConfiguration::inherit()`] to access the config
///
// TODO: implement bytecheck::Validate in addition to CheckBytes on all components of the launch config.
/// TODO: implement bytecheck::Validate in addition to CheckBytes on all components of the launch config.
#[derive(
Debug,
PartialEq,
Expand All @@ -601,6 +620,8 @@ pub struct LaunchConfiguration {
pub tracing: TracingConfigSection,
/// Metrics collection configuration
pub metrics: MetricsConfigSection,
/// Optional BMP server configuration (None => BMP disabled)
pub bmp: Option<BmpConfigSection>,
/// Profiling configuration
pub profiling: ProfilingConfigSection,
}
Expand Down Expand Up @@ -1152,6 +1173,14 @@ impl TryFrom<CmdArgs> for LaunchConfiguration {
metrics: MetricsConfigSection {
address: value.metrics_address(),
},
bmp: if value.bmp_enabled() {
Some(BmpConfigSection {
address: value.bmp_address(),
interval_ms: value.bmp_interval_ms(),
})
} else {
None
},
profiling: ProfilingConfigSection {
pyroscope_url: value.pyroscope_url().map(std::string::ToString::to_string),
frequency: ProfilingConfigSection::DEFAULT_FREQUENCY,
Expand Down Expand Up @@ -1275,6 +1304,26 @@ E.g. default=error,all=info,nat=debug will set the default target to error, and

#[arg(long, help = "Set the name of this gateway")]
name: Option<String>,

/// Enable BMP server
#[arg(long, default_value_t = false, help = "Enable BMP server")]
bmp_enable: bool,

#[arg(
long,
value_name = "IP:PORT",
default_value_t = SocketAddr::from(([0, 0, 0, 0], 5000)),
help = "Bind address for the BMP server"
)]
bmp_address: SocketAddr,

#[arg(
long,
value_name = "MILLISECONDS",
default_value_t = 10_000,
help = "BMP periodic interval for housekeeping/flush (ms)"
)]
bmp_interval_ms: u64,
}

impl CmdArgs {
Expand Down Expand Up @@ -1464,6 +1513,18 @@ impl CmdArgs {
pub fn get_name(&self) -> Option<&String> {
self.name.as_ref()
}
#[must_use]
pub fn bmp_enabled(&self) -> bool {
self.bmp_enable
}
#[must_use]
pub fn bmp_address(&self) -> SocketAddr {
self.bmp_address
}
#[must_use]
pub fn bmp_interval_ms(&self) -> u64 {
self.bmp_interval_ms
}
}

#[cfg(test)]
Expand Down
10 changes: 9 additions & 1 deletion config/src/internal/routing/bgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use lpm::prefix::Prefix;
use std::collections::BTreeSet;
use std::net::{IpAddr, Ipv4Addr};

use super::bmp::BmpOptions;
// FRR defaults {datacenter | traditional}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
Expand Down Expand Up @@ -68,7 +69,7 @@ pub struct BgpNeighCapabilities {
pub ext_nhop: bool,
pub fqdn: bool,
pub software_ver: bool,
//ORF
// ORF
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -190,6 +191,7 @@ pub struct BgpConfig {
pub af_ipv4unicast: Option<AfIpv4Ucast>,
pub af_ipv6unicast: Option<AfIpv6Ucast>,
pub af_l2vpnevpn: Option<AfL2vpnEvpn>,
pub bmp: Option<BmpOptions>,
}

/* ===== impls: Builders ===== */
Expand Down Expand Up @@ -574,6 +576,7 @@ impl BgpOptions {
self
}
}

impl BgpConfig {
#[must_use]
pub fn new(asn: u32) -> Self {
Expand Down Expand Up @@ -607,4 +610,9 @@ impl BgpConfig {
pub fn set_af_ipv6unicast(&mut self, af_ipv6unicast: AfIpv6Ucast) {
self.af_ipv6unicast = Some(af_ipv6unicast);
}

pub fn set_bmp_options(&mut self, bmp: BmpOptions) -> &Self {
self.bmp = Some(bmp);
self
}
}
Loading