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: interface tests fail with multiple prefixes from IPv4 loopback address block #23903

Closed
rasky opened this issue Feb 18, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@rasky
Copy link
Member

commented Feb 18, 2018

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

Go 1.10.

Does this issue reproduce with the latest release?

Yes.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/rasky/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/rasky/Sources/go"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.10rc2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.10rc2/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/q5/4h90rf793dz456wy2tmfl7_80000gn/T/go-build815831965=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to run all.bash to run all tests.

What did you expect to see?

All tests passed.

What did you see instead?

=== RUN   TestInterfaceAddrs
--- FAIL: TestInterfaceAddrs (0.00s)
	interface_test.go:94: unexpected prefix length: 24/32 for &net.IPNet{IP:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x36}, Mask:net.IPMask{0xff, 0xff, 0xff, 0x0}}
=== RUN   TestInterfaceUnicastAddrs
--- FAIL: TestInterfaceUnicastAddrs (0.00s)
	interface_test.go:118: {1 16384 lo0  up|loopback|multicast} unexpected prefix length: 24/32 for &net.IPNet{IP:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x36}, Mask:net.IPMask{0xff, 0xff, 0xff, 0x0}}
=== RUN   TestInterfaceMulticastAddrs
--- FAIL: TestInterfaceMulticastAddrs (0.00s)
	interface_test.go:140: unexpected prefix length: 24/32 for &net.IPNet{IP:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0x7f, 0x0, 0x0, 0x36}, Mask:net.IPMask{0xff, 0xff, 0xff, 0x0}}

It looks like the problem is that I have a loopback interface with netmask /24 on my system. This is the output of netstat -nr:

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.1.1        UGSc          153        0     en0
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              1  2986383     lo0
127.0.0.54         127.0.0.54         UH              3      808     lo0

I traced this to dnscrypt-osx-client, a software that wraps dns-crypt, the DNS-encryption protocol supported by OpenDNS servers. This is where the interface is created:

https://github.com/stammy/dnscrypt-osx-client/blob/69fdd9c44cc7e19c05608cfd463e55829de43416/DNSCrypt-Preference-Pane/DNSCrypt/extra/usr/scripts/common.inc#L62

I don't know if this violates some RFC requirements, but I don't think all.bash should fail in this situation.

@rasky rasky changed the title net: interface_test faille on OSX after installing dnscrypt net: interface_test fail on OSX after installing dnscrypt Feb 18, 2018

@rasky rasky changed the title net: interface_test fail on OSX after installing dnscrypt net: interface_test fails on OSX after installing dnscrypt Feb 18, 2018

@mikioh

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2018

It's fine to use any block from 127/8 as your system's loopback operation. Let's loosen the existing grave test cases.

@mikioh mikioh changed the title net: interface_test fails on OSX after installing dnscrypt net: interface tests fail with multiple prefixes from IPv4 loopback address block Feb 20, 2018

@mikioh mikioh added this to the Go1.11 milestone Feb 20, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Feb 20, 2018

Change https://golang.org/cl/95336 mentions this issue: net: adjust the test for IPv4 loopback address block

@gopherbot gopherbot closed this in 9b7f221 Feb 20, 2018

@golang golang locked and limited conversation to collaborators Feb 20, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.