fix(unikernels): use actual subnet mask in Mirage IP configuration instead of hardcoded /24#703
Open
mdryaan wants to merge 1 commit into
Open
fix(unikernels): use actual subnet mask in Mirage IP configuration instead of hardcoded /24#703mdryaan wants to merge 1 commit into
mdryaan wants to merge 1 commit into
Conversation
…stead of hardcoded /24 Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
✅ Deploy Preview for urunc canceled.
|
Contributor
|
There is something wrong with the PR description. Please if you use LLMs you must disclose it. This is important for various reasons. |
Contributor
Author
Hi @cmainas , sorry about the messy description I didn't use any LLM to write the code or tests, but I did use GPT-5 to |
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
Mirage.Init()reads the subnet mask fromdata.Net.Maskbut ignores it, always hardcoding/24into the IP addressstring. Any network with a prefix other than
/24produces a wrong kernel command line, causing incorrect routing insidethe MirageOS unikernel.
The fix calls
subnetMaskToCIDR()— already present in the same package and used correctly byHermit.Init()andMewz.Init()— and uses the returned CIDR prefix instead of the hardcoded/24.Related issues
How was this tested?
Added
TestMirageInitSubnetMaskinpkg/unikontainers/unikernels/mirage_test.gowith three sub-tests: a non-/24 mask (255.255.255.240→/28), a /24 mask (regression check), and no network (empty mask guard).Before fix
After fix:
LLM usage
N/A
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).