Skip to content

Conversation

@sergeymatov
Copy link
Contributor

this is WIP, desc will be added later

@sergeymatov sergeymatov requested a review from a team as a code owner December 11, 2025 13:00
@sergeymatov sergeymatov requested review from Fredi-raspall and removed request for a team December 11, 2025 13:00
@sergeymatov sergeymatov marked this pull request as draft December 11, 2025 13:00
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch from 43e8d27 to 6044efa Compare December 11, 2025 13:01
@Fredi-raspall Fredi-raspall self-requested a review December 12, 2025 10:50
Copy link
Contributor

@Fredi-raspall Fredi-raspall left a comment

Choose a reason for hiding this comment

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

I like the approach and implementation!
I am going to request changes because I'd like to review this again once it is no longer a draft and some of the questions get clarified.
Thanks!

@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch 2 times, most recently from 66e7168 to 613b990 Compare December 15, 2025 08:07
@mvachhar mvachhar closed this Dec 15, 2025
@mvachhar mvachhar reopened this Dec 15, 2025
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch 2 times, most recently from 4ce4148 to eeea2b2 Compare December 16, 2025 14:20
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch from eeea2b2 to 679f01e Compare December 16, 2025 14:53
@sergeymatov sergeymatov reopened this Dec 16, 2025
@sergeymatov sergeymatov marked this pull request as ready for review December 16, 2025 15:28
@sergeymatov sergeymatov reopened this Dec 16, 2025
@sergeymatov sergeymatov marked this pull request as draft December 16, 2025 15:53
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch 2 times, most recently from c0e177d to 7db2e9d Compare December 17, 2025 10:58
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch from 7db2e9d to 7548ecd Compare December 17, 2025 11:03
Signed-off-by: Sergey Matov <sergey.matov@githedgehog.com>
@sergeymatov sergeymatov force-pushed the pr/smatov/bmp-frr-config branch from 378b682 to 51e56a8 Compare January 7, 2026 11:45
Copy link
Collaborator

@daniel-noland daniel-noland left a comment

Choose a reason for hiding this comment

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

just posting initial thoughts

}
}
active += 1;
let cfg = self.cfg.clone();
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think this clone is wrong

With this strategy you won't change configs for established sessions no?

/// Name for `bmp targets <name>`
pub target_name: String,
/// Collector host/IP in `bmp connect`
pub connect_host: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be IpAddr?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, shouldn't this be called collector?

#[derive(Clone, Debug)]
pub struct BmpOptions {
/// Name for `bmp targets <name>`
pub target_name: String,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we would enforce validity at the type level. What are the constraints on this string?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I assume this would be called target

/// Collector host/IP in `bmp connect`
pub connect_host: String,
/// Collector TCP port
pub port: u16,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We have a type for TCP port in net

#[derive(Clone, Debug)]
pub enum BmpSource {
Address(IpAddr),
Interface(String),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this an interface name? If so, we should use the InterfaceName type

Self {
bind_addr: "0.0.0.0:5000".parse().unwrap(),
tcp_nodelay: true,
tcp_recv_buf: Some(1 << 20), // 1 MiB
Copy link
Collaborator

Choose a reason for hiding this comment

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

make this a constant on the type rather than hard code it in Default::default

handler: &H,
) -> Result<()> {
if cfg.tcp_nodelay {
let _ = sock.set_nodelay(true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why eat the error?

let _ = sock.set_nodelay(true);
}
if let Some(sz) = cfg.tcp_recv_buf {
let _ = sock.set_recv_buffer_size(sz);
Copy link
Collaborator

Choose a reason for hiding this comment

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

why eat the error?

tokio::pin!(reader);

// Use a scratch buffer for zero-copy clones if needed
let mut _scratch = BytesMut::new();
Copy link
Collaborator

Choose a reason for hiding this comment

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

???

async fn on_message(&self, peer: std::net::SocketAddr, msg: BmpMessage);

/// Called when a connection terminates (EOF / error).
async fn on_disconnect(&self, peer: std::net::SocketAddr, reason: &str) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend making this a sync function so this can be called from a Drop trait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants