add IPv6 support#752
Conversation
| if ipv4Gateway == nil && ipv6Gateway == nil { | ||
| logger?.debug("no gateway for \(name)") | ||
| } | ||
| try await routeAddDefault( |
There was a problem hiding this comment.
Is this something we can skip if v4 and v6 gateway are both nil?
There was a problem hiding this comment.
No we need to keep this call because #628 added support for installing a default route without a gateway. So skipping routeAddDefault when both v4 and v6 gateway are nil would cause a regression. The server-side handler at Server+GRPC.swift:1290 ensures the behavior is preserved.
| /// - id: The container ID. | ||
| /// - ipv6Address: The IPv6 CIDR address to assign to the interface. | ||
| /// - ipv6Gateway: The IPv6 gateway address for the default route. | ||
| public mutating func createInterface(_ id: String, ipv6Address: CIDRv6, ipv6Gateway: IPv6Address? = nil) throws -> Containerization.Interface? { |
There was a problem hiding this comment.
Dumb question, this call was supposed to be the "just give me a NIC" call that ContainerManager can use. Can our allocator not be extended to also give us a v6 addr?
There was a problem hiding this comment.
Yes I think we can do the allocator + static v6 pattern here as well. The only thing is we also need to add sysctl to disable v6 auto-configuration (SLAAC) when using static v6 address. Working on this.
There was a problem hiding this comment.
Fixed, added v6 allocator and added specifying v6 prefix to VmnetNetwork so now when calling createInterface will get both v4 and v6 address allocated.
Extends the network plumbing to support per-interface IPv6 address configuration. The `Interface` protocol supports `ipv6Address` and `ipv6Gateway`. The agent's networking RPCs carry per-family fields via new `InterfaceAddress`, `LinkRoute`, and `DefaultRoute` types in `ContainerizationExtras`. `NetlinkSession` adds IPv6 methods for address and route operations. Co-authored-by: Michael Crosby <crosbymichael@gmail.com>
Extend the allocator with independent v4 and v6 rotating sub-allocators; Now callers of Network.createInterface(id) would get dual-stack automatically with no protocol changes. Disable IPv6 RA/autoconf per-interface in vminitd's ipAddrAdd handler when a static v6 address is assigned, preventing SLAAC duplicates. Add unit and integration tests covering dual-stack allocation, concurrent allocation, and end-to-end v6 networking.
Extends the network plumbing to support per-interface IPv6 address configuration.
The
Interfaceprotocol supportsipv6Addressandipv6Gateway.The agent's networking RPCs carry per-family fields via new
InterfaceAddress,LinkRoute, andDefaultRoutetypes inContainerizationExtras.NetlinkSessionadds IPv6 methods for address and route operations.