Skip to content
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

net: IPv6 network does not contain IPv4 to IPv6 translated addresses #37597

Open
pixelbender opened this issue Mar 2, 2020 · 2 comments
Open

net: IPv6 network does not contain IPv4 to IPv6 translated addresses #37597

pixelbender opened this issue Mar 2, 2020 · 2 comments
Milestone

Comments

@pixelbender
Copy link

@pixelbender pixelbender commented Mar 2, 2020

What version of Go are you using (go version)?

1.14

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

All operating system and processor architectures

What did you do?

https://play.golang.org/p/IN-TOcROQnr

// "8.8.8.8" translated to IPv6, same as net.ParseIP("8.8.8.8")
ip := net.ParseIP("0:0:0:0:0:ffff:808:808")

_, ipv4, _ := net.ParseCIDR("0.0.0.0/0")
fmt.Println(ipv4.Contains(ip)) // true

_, ipv6, _ := net.ParseCIDR("::/0")
fmt.Println(ipv6.Contains(ip)) // why it says false?

_, translated, _ := net.ParseCIDR("::ffff:0:0/96")
fmt.Println(translated.Contains(ip)) // true

What did you expect to see?

true
true
true

What did you see instead?

true
false
true
@gopherbot
Copy link

@gopherbot gopherbot commented Mar 2, 2020

Change https://golang.org/cl/221798 mentions this issue: net: IPv6 network does not contain IPv4 to IPv6 translated addresses

@dmitshur dmitshur added this to the Backlog milestone Mar 2, 2020
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Mar 2, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.