Levon/make bgp dispatch listen configurable#654
Draft
internet-diglett wants to merge 4 commits intomainfrom
Draft
Levon/make bgp dispatch listen configurable#654internet-diglett wants to merge 4 commits intomainfrom
internet-diglett wants to merge 4 commits intomainfrom
Conversation
We'd like the ability to create a topology of BGP routers in our test and dev tooling. To do so with the current omicron-dev and testing contexts, we need the peering to occur over localhost, which means we need to be able to configure unique localhost socketaddrs for each instance.
The omicron dev and test contexts provide :0 as the listen port and rely on the log messages to output the actual port number that the daemon bound to.
taspelund
requested changes
Mar 4, 2026
Contributor
taspelund
left a comment
There was a problem hiding this comment.
Looks good overall. If you wouldn't mind using the preexisting logging macros that wrap slog, that would be great. Otherwise, LGTM!
| }; | ||
| use mg_common::lock; | ||
| use slog::Logger; | ||
| use slog::{Logger, info}; |
Contributor
There was a problem hiding this comment.
Instead of using slog::info!, please use crate::log::connection_log or connection_log_lite.
They have a bunch of the slog KV values pre-populated that add additional context to the logs.
Contributor
Author
There was a problem hiding this comment.
It appears that the custom macros do not support debug formatting (the ? prefix):
error: no rules expected `?`
--> bgp/src/connection_tcp.rs:120:73
|
120 | connection_log!(log, info, "TcpListener created"; "listener" => ?listener);
| ^ no rules expected this token in macro call
|
::: bgp/src/log.rs:251:1
|
251 | macro_rules! connection_log {
| --------------------------- when calling this macro
|
note: while trying to match meta-variable `$value:expr`
--> bgp/src/log.rs:252:58
|
252 | ($self:expr, $level:ident, $msg:expr; $($key:expr => $value:expr),*) => {
| ^^^^^^^^^^^
Checking ddmd v0.1.0 (/disk1/workspace/maghemite/ddmd)
error: could not compile `bgp` (lib) due to 1 previous error
Contributor
Author
There was a problem hiding this comment.
Per our conversation in chat, I've updated this logic to use the slog::o! method of updating and carrying forward the log context:
pfexec ./target/debug/mgd run --bgp-dispatcher-addr "[::]:0" | looker
18:35:48.595Z INFO slog-rs (mgd): signal handler waiting for context
module = admin
unit = signal
18:35:48.663Z INFO slog-rs (mgd): interface monitor started
module = unnumbered manager
unit = daemon
18:35:48.663Z INFO slog-rs (bgp): dispatcher started
module = neighbor
unit = dispatcher
18:35:48.663Z INFO slog-rs (bgp): starting listener with bind arg: [::]:0
module = neighbor
unit = dispatcher
18:35:48.663Z INFO slog-rs (bgp): TcpListener created
listener = TcpListener { addr: [::]:48382, fd: 10 }
module = neighbor
unit = dispatcher
18:35:48.663Z INFO slog-rs (bgp): transitioning to accept loop
bind_addr = [::]:48382
module = neighbor
unit = dispatcher
...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.