Add IPv6 subnet pool allocation for network creation - #1480
Open
thrawn-sh wants to merge 1 commit into
Open
Conversation
Add support for sequential IPv6 subnet allocation from configurable subnet pools, complementing the existing IPv4 pool allocation and random IPv6 subnet generation (RFC 4193). When container-libs passes a `subnet_pools_v6` field in the create config, netavark now allocates IPv6 subnets sequentially from those pools — mirroring how `subnet_pools` works for IPv4. When the field is absent or empty, the existing random fd00::/8 allocation is used. Key changes: - types.rs: Add `subnet_pools_v6` field to `CreateOpts` with `#[serde(default)]` for backward compatibility with older container-libs versions that don't send this field. - subnet.rs: Add `next_subnet_v6()` for incrementing IPv6 network addresses using u128 arithmetic, and `get_free_ipv6_network_subnet_from_pools()` for sequential allocation with a 10,000 iteration cap to prevent runaway scans in large address spaces (e.g. fd00::/8 with /64 subnets has 2^56 candidates vs 256 for typical IPv4 pools). - driver.rs: Dispatch to pool-based allocation when `subnet_pools_v6` is non-empty, falling back to random generation otherwise. This is the netavark counterpart to the container-libs configuration wiring in podman-container-tools/container-libs#995.
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.
Add support for sequential IPv6 subnet allocation from configurable subnet pools, complementing the existing IPv4 pool allocation and random IPv6 subnet generation (RFC 4193).
When container-libs passes a
subnet_pools_v6field in the create config, netavark now allocates IPv6 subnets sequentially from those pools — mirroring howsubnet_poolsworks for IPv4. When the field is absent or empty, the existing random fd00::/8 allocation is used.Key changes:
types.rs: Add
subnet_pools_v6field toCreateOptswith#[serde(default)]for backward compatibility with older container-libs versions that don't send this field.subnet.rs: Add
next_subnet_v6()for incrementing IPv6 network addresses using u128 arithmetic, andget_free_ipv6_network_subnet_from_pools()for sequential allocation with a 10,000 iteration cap to prevent runaway scans in large address spaces (e.g. fd00::/8 with /64 subnets has 2^56 candidates vs 256 for typical IPv4 pools).driver.rs: Dispatch to pool-based allocation when
subnet_pools_v6is non-empty, falling back to random generation otherwise.This is the netavark counterpart to the container-libs configuration wiring in podman-container-tools/container-libs#995.