Repository navigation
Conversation
Signed-off-by: Arshil Ahmed <194646586+arshil42@users.noreply.github.com>
For Unikraft 0.16.1 and later, and when the version is unknown, the guest network is set with netdev.ip=<ip>/24:<gw>:<dns>, so the prefix is always /24 and the subnet mask of the container network is ignored. On a network with any other mask, such as Docker's default 172.17.0.0/16 bridge, the guest gets the wrong subnet. The older netdev.ipv4_subnet_mask path already passes the real mask. Convert the mask to a prefix length with subnetMaskToCIDR, as the Hermit, Mewz and MirageOS guests do, and keep /24 when there is no mask. Fixes: urunc-dev#827 Signed-off-by: Arshil Ahmed <194646586+arshil42@users.noreply.github.com>
👷 Deploy request for urunc pending review.Visit the deploys page to approve it
|
3 of 4 tasks
This branch has not been deployed
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.
Description
For Unikraft 0.16.1 and later, and when the Unikraft version is undefined or cannot be parsed,
configureUnikraftArgssets the guest network withso the prefix length is always
/24and theethDeviceMaskof the container network is ignored. On any network with a different mask, such as Docker's default172.17.0.0/16bridge, the guest gets the wrong subnet. The oldernetdev.ipv4_subnet_maskpath already passes the real mask.This converts the mask to a prefix length with the existing
subnetMaskToCIDRhelper, as the Hermit, Mewz and MirageOS guests already do. When there is no mask, the prefix stays/24, as before. An invalid mask now returns an error fromInit, like it does for those guests.The PR also adds me to
.github/contributors.yamlin a separate commit.This picks up #827 after #823, which addressed it, was closed as stale.
Related issues
How was this tested?
On Ubuntu (WSL2, x86_64), in a fresh clone of the branch:
TestUnikraftNetdevIPPrefixLengthandTestUnikraftNetdevIPInvalidMaskinpkg/unikontainers/unikernels/unikraft_test.gocover/16,/24and/20masks, an undefined version, a missing mask (stays/24), the pre-0.16.1 path (mask passed as is) and an invalid mask. Without the change, the/16,/20, undefined-version and invalid-mask cases fail.go test ./pkg/... ./cmd/... ./internal/...: everything passes exceptTestCopyFileandTestMoveFileinpkg/unikontainers, which fail the same way onmainin this environment because the tests run as root, so the permission errors they expect do not happen.golangci-lint runwith v2.15.0 (the version used bymake lint) over the whole repository: 0 issues..github/linters: no issues.I could not run the e2e tests: this machine has no KVM or containerd setup.
LLM usage
Claude Opus 5.5 (
claude-opus-5-5, through Claude Code) was used to find the code path, write the change and the tests, and draft this description. I reviewed the changes and ran the tests above before opening the PR.Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).