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 1 commit 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. |
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: #827
Description
Related issues
How was this tested?
LLM usage
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).