Skip to content

IP ranges in pools should only be IPv4 #5085

Closed
@david-crespo

Description

@david-crespo

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).

/// 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.

/// 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
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions