Skip to content

net: DefaultResolver.Lookup{Host,IPAddr} and LookupHost fail to parse a literal IPv6 address w/ zone #20790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikioh opened this issue Jun 25, 2017 · 1 comment
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@mikioh
Copy link
Contributor

mikioh commented Jun 25, 2017

When GODEBUG=netdns=go or Resolver.PreferGo is true, DefaultResolver.Lookup{IPAddr,Host} and LookupHost fail to parse a literal IPv6 address w/ zone like the following:

% go run x.go 
lookup fe80::1%lo0: no such host
exit status 1

--
package main

import (
	"context"
	"log"
	"net"
)

func main() {
	r := &net.Resolver{PreferGo: true}
	ipas, err := r.LookupIPAddr(context.Background(), "fe80::1%lo0")
	if err != nil {
		log.Fatal(err)
	}
	log.Println(ipas)
}

Hope this is the last one of long standing issues regarding inconsistency between GODEBUG=netdns=cgo and GODEBUG=netdns=go. The fix would be simply to replace the use of ParseIP with a pair of parseIPv4 and parseIPv6, so this is probably a good first contribution issue.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/79935 mentions this issue: net: Parse IPv6 address with zone using DefaultResolver.Lookup{Host,IPAddr}

@bradfitz bradfitz added NeedsFix The path to resolution is known, but the work has not been done. release-blocker labels Nov 27, 2017
@golang golang locked and limited conversation to collaborators Jun 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants