Skip to content

extract loopback ip manager from maghemite#347

Open
internet-diglett wants to merge 7 commits intomainfrom
levon/add-loopback-manager-utility
Open

extract loopback ip manager from maghemite#347
internet-diglett wants to merge 7 commits intomainfrom
levon/add-loopback-manager-utility

Conversation

@internet-diglett
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Collaborator

@rcgoodfellow rcgoodfellow left a comment

Choose a reason for hiding this comment

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

Thanks @internet-diglett. Comments/questions follow.

Comment thread loopback-ip-mgr/src/lib.rs Outdated
let mut ip_descr = format!("{v}{}", ip.address);
ip_descr.retain(|c| c.is_alphanumeric());
let addr_obj = format!("{}/{}", ifname, ip_descr);
let cmd = [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice to use https://github.com/oxidecomputer/netadm-sys/ here eventually instead of shelling out. If you want something cross plaform https://github.com/oxidecomputer/network-interface/tree/illumos might be an option.

Comment thread loopback-ip-mgr/src/lib.rs Outdated
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
// "Address already exists/assigned" is ok — another process beat us to it
if !stderr.to_lowercase().contains("already") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems quite fragile.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think most of this implementation is what levon took out of maghemite, i.e. it's what I wrote originally.
When I wrote it, I just needed something quickly to enable multiple BGP speakers on the same local system to use TCP and I just got a quick and dirty impl working.
Do you view this as a blocker?

break;
}

// Last in-process user: decrement the cross-process refcount
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is the multiprocess model here? What does it mean semantically for multiple processes to hold a reference to a loopback address? Since only one process can listen on a given address at a time for a particular port, it's not clear to me what multiple processes holding a reference to a loopback address means.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My initial implementation was meant to accommodate both cargo test (separate thread per test) and cargo nextest (separate process per test).
I've updated all the bgp tests relying on this to use unique IPs per test to avoid overlap where possible, but I wanted the framework to support IP re-use across tests regardless of whether the tests are executed in the same or different processes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I could see this being applicable to the omicron-dev stuff levon is doing by having a set of processes all have a reference to a Loopback IP since they pretend to be the same virtual node

Copy link
Copy Markdown
Contributor

@taspelund taspelund left a comment

Choose a reason for hiding this comment

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

LGTM. Seems like a straightforward port of the maghemite implementation.
Obviously there's room for improvement, but I'm not sure if that needs to be addressed prior to merge.

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.

3 participants