Skip to content

fix(ipdo): correct ipInRange for IPv6 and high-bit IPv4#5

Open
7c wants to merge 1 commit into
funish:mainfrom
7c:fix/ipdo-ipinrange-ipv6
Open

fix(ipdo): correct ipInRange for IPv6 and high-bit IPv4#5
7c wants to merge 1 commit into
funish:mainfrom
7c:fix/ipdo-ipinrange-ipv6

Conversation

@7c

@7c 7c commented Jun 24, 2026

Copy link
Copy Markdown

ipv6ToBigInt expanded "::" to 9 groups (144 bits) instead of 8 due to an off-by-one and mishandling of the empty strings produced by split(":"). This corrupted CIDR comparisons, so addresses inside ranges like 2606:4700::/32 and 2000::/3 were reported as out of range.

parseCIDR also computed the IPv4 network with signed 32-bit bitwise ops, yielding a negative start for addresses >= 128.0.0.0 and breaking ranges such as 192.168.0.0/24. Switched to arithmetic, which also supports /0.

Fixes #4

ipv6ToBigInt expanded "::" to 9 groups (144 bits) instead of 8 due to an
off-by-one and mishandling of the empty strings produced by split(":").
This corrupted CIDR comparisons, so addresses inside ranges like
2606:4700::/32 and 2000::/3 were reported as out of range.

parseCIDR also computed the IPv4 network with signed 32-bit bitwise ops,
yielding a negative start for addresses >= 128.0.0.0 and breaking ranges
such as 192.168.0.0/24. Switched to arithmetic, which also supports /0.

Fixes funish#4
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.

bug in ipdo's ipInRange is wrong for IPv6

1 participant