Skip to content

Add IPv6 CIDR matching and /64 unique-IP comparison. - #935

Merged
connorgallopo merged 1 commit into
connorgallopo:mainfrom
gmacarthur:fix/ipv6-cidr-and-unique-ips
Jul 21, 2026
Merged

Add IPv6 CIDR matching and /64 unique-IP comparison.#935
connorgallopo merged 1 commit into
connorgallopo:mainfrom
gmacarthur:fix/ipv6-cidr-and-unique-ips

Conversation

@gmacarthur

Copy link
Copy Markdown
Contributor

Summary

This implements the Part 1 approach discussed in #934.

It adds IPv6 support to IP Range rules and updates the Unique IP comparisons used by Unique IPs, Unique IPs in Window, and the Concurrent Streams "same IP" exclusion to compare IPv6 addresses by /64. Existing IPv4 behaviour is unchanged.

As discussed I've kept the scope narrow. No configurable IPv6 prefixes, LAN household grouping, or any schema/UI/template changes.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Breaking change

Related issue

Closes #934

What's included

  • Added isIpInCidr using Node's BlockList for IPv4 and IPv6 CIDR matching.
  • Normalised IPv4-mapped IPv6 addresses (::ffff:x.x.x.x and the hexadecimal form, rare but good idea to cover) before CIDR matching and Unique IP comparisons.
  • Added toNetworkKey:
    • IPv4 is compared as-is.
    • IPv6 is normalised to a hardcoded /64.
  • Updated:
    • Unique IPs
    • Unique IPs in Window
    • Concurrent Streams exclude_same_ip
    • Legacy device velocity unique-IP counting
  • Updated the IP Range placeholder to mention IPv6 CIDRs.
  • Added unit tests for the new helpers and rule evaluators.

Testing

  • Added/updated unit tests
  • Ran pnpm typecheck
  • Ran pnpm lint
  • Ran pnpm test:unit
  • Pre-push hooks passed
  • Manually tested against an IPv6-enabled server

IP Range rules now match IPv6 CIDRs via BlockList. Unique IPs, Unique IPs in Window, and Concurrent Streams same-IP exclude compare IPv6 by /64 (IPv4 unchanged). IPv4-mapped addresses are unmapped before matching so dual-stack clients work with v4 rules.
@connorgallopo

Copy link
Copy Markdown
Owner

This looks great - Thank you for the scope adjustment and working the process!

@connorgallopo
connorgallopo merged commit c74b042 into connorgallopo:main Jul 21, 2026
11 checks passed
@gmacarthur
gmacarthur deleted the fix/ipv6-cidr-and-unique-ips branch July 21, 2026 20:55
@gmacarthur

Copy link
Copy Markdown
Contributor Author

Thank you 🥳

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.

2 participants