Skip to content

utils: fix IPv4 /0 netmask conversion - #36

Open
tllovesxs wants to merge 1 commit into
ZSvirt:mainfrom
tllovesxs:codex/fix-zero-prefix-netmask
Open

tllovesxs wants to merge 1 commit into
ZSvirt:mainfrom
tllovesxs:codex/fix-zero-prefix-netmask

Conversation

@tllovesxs

Copy link
Copy Markdown
Contributor

Summary

  • Handle the IPv4 /0 netmask without a Java shift-by-32 error.
  • Reject prefix lengths outside the IPv4 range.
  • Add boundary and invalid-input unit tests.

Fixes #31.

Test plan

  • git diff --check
  • Added TestNetworkUtilsEdgeCases covering prefixes 0, 1, 24, 32, and an invalid prefix.
  • The full Maven build is currently blocked in this environment by the repository's existing JAXB dependency issue on JDK 24.

Copilot AI lite review requested due to automatic review settings September 11, 2026 05:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@zsphere-opensource

zsphere-opensource commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the detailed report and the proposed fix.
The change correctly handles the /0 case and validates the IPv4 prefix range before performing the shift. The added boundary tests for /0, /1, /24, and /32 are helpful.
Before we complete the evaluation, please also add test coverage for null and negative prefix values, since both are rejected by the new validation logic.
We’ll review and validate the change through our internal workflow. If the validation passes and the change is approved, we’ll integrate it internally and synchronize the accepted commit to the public repository while preserving your authorship.
We’ll update this PR after the evaluation is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ZSvirt] bug: NetworkUtils.convertNetmask(0) returns the wrong mask

3 participants