proxy: add dns64 zero-address prefix validation#499
Open
fakhriaunur wants to merge 1 commit intoAdguardTeam:masterfrom
Open
proxy: add dns64 zero-address prefix validation#499fakhriaunur wants to merge 1 commit intoAdguardTeam:masterfrom
fakhriaunur wants to merge 1 commit intoAdguardTeam:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add zero-address validation for DNS64 prefixes in
setupDNS64().When configuring DNS64 prefixes, a prefix with a zero IPv6 address (e.g.,
::/96) would be accepted but causes all IPv4 addresses to map to the same IPv6 address, breaking DNS64 functionality. This change adds validation to reject such prefixes with a clear error message.Changes
setupDNS64()before the IPv6 format checkpref.Addr() == netip.MustParseAddr("::")"prefix at index %d: %q has zero address"TestSetupDNS64_ZeroAddressPrefixverifying rejection of::/96Root Cause
The DNS64 prefix
::/96(zero address) would cause all IPv4 addresses to map to the same IPv6 address due to how the lower 32 bits are preserved in the mapping. This effectively breaks DNS64 synthesis since every A record would produce an identical AAAA record.Testing
Code Change Statistics
Technical Details
The zero-address check is placed before the IPv6 format validation because:
netip.MustParseAddr("::")for comparison sincenetip.Addrhas noIsZero()methodIssues
Related to M1 in contrib-cat.md
Checklist
go test ./proxy/)go test -race ./proxy/)go vet ./proxy/)Note: This is a minimal validation fix. The check ensures misconfigured DNS64 prefixes are rejected at setup time rather than causing silent failures during DNS64 synthesis.