Skip to content

Conversation

@nbrownus
Copy link
Collaborator

@nbrownus nbrownus commented Nov 20, 2025

This scenario is only present on master since v1.9.x and prior would refuse ipv6 traffic.

Currently a cidr of 0.0.0.0/0 or ::/0 results in a short circuit any for both ipv4 or ipv6 addresses. This is unnecessary and could lead to surprises for network operators.

This change makes it so that 0.0.0.0/0 means only all ipv4 addresses and ::/0 means only all ipv6 addresses.

This also adds support for the special cidr: any and localCidr: any which actually means "any ip family and address". The main reason for this is in unsafe routes, when you desire to expose the entire localCidr networks. If we did not support localCidr: any then you would need to create 2 rules, one for ipv4 0.0.0.0/0 and another for ip6 ::/0.

@nbrownus nbrownus added this to the v1.10.0 milestone Nov 20, 2025
johnmaguire
johnmaguire previously approved these changes Nov 21, 2025
Copy link
Collaborator

@johnmaguire johnmaguire left a comment

Choose a reason for hiding this comment

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

LGTM, and test coverage looks good.

fr.Hosts[host] = nlc
}

if ip.IsValid() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

For future reviewers - this just tells you if it's a zero-value or not. This is not true validation per se. We won't return new errors we didn't return before for an "invalid" IP.

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://pkg.go.dev/net/netip#Addr.IsValid strange they didn't follow the pattern in https://pkg.go.dev/time#Time.IsZero which is much more clear.

@nbrownus nbrownus merged commit 64f202f into master Nov 21, 2025
9 checks passed
@nbrownus nbrownus deleted the firewall-cidr branch November 21, 2025 19:46
@nbrownus nbrownus mentioned this pull request Dec 4, 2025
63 tasks
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.

5 participants