Skip to content

fix(unikernels): use actual subnet mask in Mirage IP configuration instead of hardcoded /24#703

Merged
cmainas merged 1 commit into
urunc-dev:main-pr703from
mdryaan:fix/mirage-hardcoded-subnet
May 25, 2026
Merged

fix(unikernels): use actual subnet mask in Mirage IP configuration instead of hardcoded /24#703
cmainas merged 1 commit into
urunc-dev:main-pr703from
mdryaan:fix/mirage-hardcoded-subnet

Conversation

@mdryaan
Copy link
Copy Markdown
Contributor

@mdryaan mdryaan commented May 18, 2026

Description

Mirage.Init() reads the subnet mask from data.Net.Mask but ignores it, always hardcoding /24 into the IP address
string. Any network with a prefix other than /24 produces a wrong kernel command line, causing incorrect routing inside
the MirageOS unikernel.

The fix calls subnetMaskToCIDR() — already present in the same package and used correctly by Hermit.Init() and
Mewz.Init() — and uses the returned CIDR prefix instead of the hardcoded /24.

Related issues

How was this tested?

Added TestMirageInitSubnetMask in pkg/unikontainers/unikernels/mirage_test.go with 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

Screenshot 2026-05-17 094253

After fix:

Screenshot 2026-05-17 094340

LLM usage

N/A

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit ba3cc40
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a101207a7f65b00087a4c4d

@cmainas
Copy link
Copy Markdown
Contributor

cmainas commented May 19, 2026

There is something wrong with the PR description. Please if you use LLMs you must disclose it. This is important for various reasons.

@mdryaan
Copy link
Copy Markdown
Contributor Author

mdryaan commented May 21, 2026

There is something wrong with the PR description. Please if you use LLMs you must disclose it. This is important for various reasons.

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
help format the PR description following the template and forgot to clean it up properly before submitting. I've read
the LLM policy, If I use LLMs for code in the future, I’ll make sure to disclose it properly

Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
@mdryaan mdryaan force-pushed the fix/mirage-hardcoded-subnet branch from 7ea0bc2 to ba3cc40 Compare May 22, 2026 08:21
@urunc-bot urunc-bot Bot changed the base branch from main to main-pr703 May 25, 2026 14:17
Copy link
Copy Markdown
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mdryaan .

@cmainas cmainas merged commit 9d80812 into urunc-dev:main-pr703 May 25, 2026
34 checks passed
github-actions Bot pushed a commit that referenced this pull request May 25, 2026
PR: #703
Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot Bot pushed a commit that referenced this pull request May 25, 2026
PR: #703
Signed-off-by: Md Raiyan <alikhurshid842001@gmail.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

use actual subnet mask in Mirage IP configuration instead of hardcoded /24

2 participants