fix(unikernels): use actual subnet mask in Unikraft netdev.ip args#823
fix(unikernels): use actual subnet mask in Unikraft netdev.ip args#823Aditya-132 wants to merge 2 commits into
Conversation
The current-version args path in configureUnikraftArgs hardcoded a /24 CIDR prefix in the netdev.ip= boot argument, ignoring the container interface's actual subnet mask. Any network with a different prefix (e.g. a /16 CNI subnet) resulted in a guest with a wrong netmask and broken on-link routing decisions. Convert the mask with the existing subnetMaskToCIDR helper and use the real prefix. Keep /24 only as a fallback when no mask is provided, to preserve the no-network behavior. Return an error for malformed masks, consistent with Mirage, Hermit and Mewz. Fixes: #1 Signed-off-by: Aditya-132 <adityachincholkar11@gmail.com>
✅ Deploy Preview for urunc canceled.
|
|
@Reviewer please reviewe it |
|
Hello @Aditya-132 , which issue does this PR solv. (it is linked to #1) which is resolved. Could you also go through the checklist in the PR template? |
check now |
| maskCIDR := 24 | ||
| if ethDeviceMask != "" { | ||
| var err error | ||
| maskCIDR, err = subnetMaskToCIDR(ethDeviceMask) |
There was a problem hiding this comment.
CIDR conversion now happens before version routing, so compat/old versions can fail on masks they previously just passed through untouched.
I'd also add a test case for old version + invalid mask to lock in that the compat path stays unaffected.
Your PR description still doesn't match the template. You can check other contributors PRs to understand /Fixit. |
Description
The current Unikraft
netdev.ip=argument path was hardcoding a/24CIDR prefix and ignoring the container interface subnet mask. This caused guests on non-/24 networks, such as /16 CNI subnets, to boot with the wrong netmask and make incorrect on-link routing decisions.This PR converts the provided subnet mask to CIDR for current Unikraft versions and keeps
/24only as the fallback when no mask is provided. For compat/old Unikraft versions, the subnet mask is still passed through untouched so existing behavior is preserved.Related issues
How was this tested?
go test ./pkg/unikontainers/unikernelsgit diff --checkLLM usage
LLM was used to help update the implementation and add regression test coverage.
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).