Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions proxy/dns64.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (p *Proxy) setupDNS64() (err error) {
}

for i, pref := range p.Config.DNS64Prefs {
if pref.Addr() == netip.MustParseAddr("::") {
return fmt.Errorf("prefix at index %d: %q has zero address", i, pref)
}

if !pref.Addr().Is6() {
return fmt.Errorf("prefix at index %d: %q is not an IPv6 prefix", i, pref)
}
Expand Down
15 changes: 15 additions & 0 deletions proxy/dns64_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ func TestDNS64Race(t *testing.T) {
g.Wait()
}

func TestSetupDNS64_ZeroAddressPrefix(t *testing.T) {
t.Parallel()

p := &Proxy{
Config: Config{
UseDNS64: true,
DNS64Prefs: []netip.Prefix{netip.MustParsePrefix("::/96")},
},
}

err := p.setupDNS64()
require.Error(t, err)
assert.Contains(t, err.Error(), "zero address")
}

func sendTestAAAAMessageAsync(conn *dns.Conn, g *sync.WaitGroup, fqdn string, syncCh chan struct{}) {
pt := testutil.PanicT{}

Expand Down