Repository navigation
Closed
Milestone
Description
The IP range add/remove endpoints allow pairs of v4 or v6 addresses, and have done so since they were added in #1253 (June 2022).
Lines 351 to 361 in 235420e
| /// An IP Range is a contiguous range of IP addresses, usually within an IP | |
| /// Pool. | |
| /// | |
| /// The first address in the range is guaranteed to be no greater than the last | |
| /// address. | |
| #[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)] | |
| #[serde(untagged)] | |
| pub enum IpRange { | |
| V4(Ipv4Range), | |
| V6(Ipv6Range), | |
| } |
I only just found out that while the API lets you add and remove them, IPv6 address ranges will not actually work from a networking POV — it's possible we can allocate an IPv6 address to an instance, but the instance will not be reachable through it.
The simplest thing would be to change the endpoint to take an Ipv4Range instead of an IpRange. That is probably not as a simple as it sounds — there will be a lot of fiddly changes to the tests.
omicron/nexus/src/external_api/http_entrypoints.rs
Lines 1731 to 1741 in 235420e
| /// Add range to IP pool | |
| #[endpoint { | |
| method = POST, | |
| path = "/v1/system/ip-pools/{pool}/ranges/add", | |
| tags = ["system/networking"], | |
| }] | |
| async fn ip_pool_range_add( | |
| rqctx: RequestContext<Arc<ServerContext>>, | |
| path_params: Path<params::IpPoolPath>, | |
| range_params: TypedBody<shared::IpRange>, | |
| ) -> Result<HttpResponseCreated<IpPoolRange>, HttpError> { |
Metadata
Metadata
Assignees
Labels
No labels
Activity
bnaecker commentedon Feb 16, 2024
Could you explain more about why we'd remove this? It's true that support for IPv6 has been deferred, but it's not abandoned AFAIK. One cannot add an IPv6 address to an instance at this point, since there are a number of places that check that condition and return a 400. A client gets a pretty immediate notification that this failed, rather than just an unreachable instance.
david-crespo commentedon Feb 16, 2024
I can soften the issue title: really what I want to do is make sure the user and operator don't have an egregiously bad experience around this, and disallowing IPv6 ranges altogether is only one approach among others.
What I want to avoid is mysterious failures in this scenario:
What I need to find out in detail is: what happens at this point? Where does the 400 actually happen?
Right now, the help text in the create IP range form says the IPs must be either v4 or v6, implicitly endorsing the possibility of using v6. At the very least I want to fix that. But I don't see why we would accept something in the API that we know cannot work, and it seems pretty light-weight to me to stop the operator from adding an IPv6 range at the API layer while leaving everything below that IP version agnostic (or however agnostic it currently is) until we can properly accept IPv6.
bnaecker commentedon Feb 16, 2024
I agree.
It does not today, which is news to me. When we added all these APIs, there were several places that checked for requests for external IPv6 and returned a 400. I can't find those anymore. I'm not sure what actually happens, but I'm looking at it now.
bnaecker commentedon Feb 16, 2024
Ok, so this is definitely not great right now. You certainly can create a pool with IPv6 ranges, and instance with an IPv6 address from that pool.
But you get a 500 when starting the instance:
That comes from here:
So the current blocker is that IPv6 NAT isn't implemented, here:
omicron/nexus/src/app/instance_network.rs
Lines 480 to 485 in 9e9e60c
Given how much this has obviously changed since I've last looked at the code, I have no idea how many other blockers exist even if we clear this one.
I generally agree with your point @david-crespo, that the current behavior is confusing and a bad experience. I also don't particularly want to unwind support or modify tests, since we do still want to support IPv6. (I don't know how far away we are from that though.)
Rather than changing the API, tests, etc., could we instead quickly fail a request if IPv6 is used? I think doing so at the range-add API would make sense, but I'm not positive about that.
david-crespo commentedon Feb 16, 2024
Yes, I think 400ing on IPv6 address range add would not be very invasive and it avoids the whole problem while we figure things out.
IP range add can only be IPv4 (#5107)