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: InterfaceAddrs returns nil on select IPv6 addresses #6360

Closed
gopherbot opened this issue Sep 11, 2013 · 8 comments
Closed

net: InterfaceAddrs returns nil on select IPv6 addresses #6360

gopherbot opened this issue Sep 11, 2013 · 8 comments

Comments

@gopherbot
Copy link

by ihsan.junaidi:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

On FreeBSD 9.1 amd64, net.interfaceAddrs() does not return correct IPv6 address for
select addresses. Link-locals and localhost work well but all other addresses return nil.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1.  intf, err := net.InterfaceAddrs()

    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(intf)

What is the expected output?
[2400:3700:20:2::94/64 fe80::225:90ff:fe6c:2448/64 124.108.16.94/28 124.108.16.92/32
2400:3700:10:2::92/64 2400:3700:20:2::94/64 fe80::225:90ff:fe77:35f8/64 10.0.4.94/24
::1/128 fe80::1/64 127.0.0.1/8]

What do you see instead?
[<nil> fe80::225:90ff:fe6c:2448/64 124.108.16.94/28 124.108.16.92/32 <nil>
<nil> fe80::225:90ff:fe77:35f8/64 10.0.4.94/24 ::1/128 fe80::1/64 127.0.0.1/8]

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
FreeBSD 9.1 amd/64

Which version are you using?  (run 'go version')
go version go1.1.2 freebsd/amd64

Please provide any additional information below.
I've tried with latest devel version and it's not working.
#go version devel +77a4d225cc7e Wed Sep 11 10:50:56 2013 +1000 freebsd/amd64
@gopherbot
Copy link
Author

Comment 1 by ihsan.junaidi:

When I tried to run interface test, it failed.
nsv01-kul:net $ go version
go version devel +77a4d225cc7e Wed Sep 11 10:50:56 2013 +1000 freebsd/amd64
nsv01-kul:net $ hg id
77a4d225cc7e tip
nsv01-kul:net $ uname -a
FreeBSD nsv01-kul.x.n3labs.my 9.1-RELEASE-p6 FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21
20:40:52 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC 
amd64
nsv01-kul:net $ go test -v -run=Interface
# _/home/ihsan/golang/go/src/pkg/net
./fd_unix.go:418: undefined: syscall.F_DUPFD_CLOEXEC
FAIL    _/home/ihsan/golang/go/src/pkg/net [build failed]

@gopherbot
Copy link
Author

Comment 2 by ihsan.junaidi:

When I tried to run the test, it failed. The interfaces are configured statically. No
SLAAC, no DHCP.
nsv01-kul:net $ go version
go version devel +77a4d225cc7e Wed Sep 11 10:50:56 2013 +1000 freebsd/amd64
nsv01-kul:net $ hg id
77a4d225cc7e tip
nsv01-kul:net $ uname -a
FreeBSD nsv01-kul.x.n3labs.my 9.1-RELEASE-p6 FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21
20:40:52 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC 
amd64
nsv01-kul:net $ go test -v -run=Interface
# _/home/ihsan/golang/go/src/pkg/net
./fd_unix.go:418: undefined: syscall.F_DUPFD_CLOEXEC
FAIL    _/home/ihsan/golang/go/src/pkg/net [build failed]

@davecheney
Copy link
Contributor

Comment 3:

I'm concerned that you have two Go installations on your system. Can you please double
check that $(which go) points to /home/ihsan/golang/go/bin/go

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 4 by ihsan.junaidi:

When I tried to run the test, it failed. The interfaces are configured statically. No
SLAAC, no DHCP.
nsv01-kul:net $ go version
go version devel +77a4d225cc7e Wed Sep 11 10:50:56 2013 +1000 freebsd/amd64
nsv01-kul:net $ hg id
77a4d225cc7e tip
nsv01-kul:net $ uname -a
FreeBSD nsv01-kul.x.n3labs.my 9.1-RELEASE-p6 FreeBSD 9.1-RELEASE-p6 #0: Wed Aug 21
20:40:52 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC 
amd64
nsv01-kul:net $ go test -v -run=Interface
# _/home/ihsan/golang/go/src/pkg/net
./fd_unix.go:418: undefined: syscall.F_DUPFD_CLOEXEC
FAIL    _/home/ihsan/golang/go/src/pkg/net [build failed]
nsv01-kul:net $ ifconfig
igb0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
    options=405bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,VLAN_HWTSO>
    ether 00:25:90:6c:24:48
    inet6 2400:3700:10:2::94 prefixlen 64
    inet6 fe80::225:90ff:fe6c:2448%igb0 prefixlen 64 scopeid 0x1
    inet 124.108.16.94 netmask 0xfffffff0 broadcast 124.108.16.95
    inet 124.108.16.92 netmask 0xffffffff broadcast 124.108.16.92
    inet6 2400:3700:10:2::92 prefixlen 64
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
igb1: flags=8c02<BROADCAST,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=401bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,VLAN_HWTSO>
    ether 00:25:90:6c:24:49
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet autoselect
    status: no carrier
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
    options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
    ether 00:25:90:77:35:f8
    inet6 2400:3700:20:4::94 prefixlen 64
    inet6 fe80::225:90ff:fe77:35f8%em0 prefixlen 64 scopeid 0x4
    inet 10.0.4.94 netmask 0xffffff00 broadcast 10.0.4.255
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

@gopherbot
Copy link
Author

Comment 5 by ihsan.junaidi:

It's the devel version currently in the path.
nsv01-kul:net $ which go
/home/ihsan/golang/go/bin/go
nsv01-kul:net $ go test -v -run=Interface
# _/home/ihsan/golang/go/src/pkg/net
./fd_unix.go:418: undefined: syscall.F_DUPFD_CLOEXEC
FAIL    _/home/ihsan/golang/go/src/pkg/net [build failed]

@davecheney
Copy link
Contributor

Comment 6:

Thank you for confirming, can you also provide the output of 
go env

@gopherbot
Copy link
Author

Comment 7 by ihsan.junaidi:

It turned out, my $GOROOT is still pointing to the release version. Thanks for the hint.
Now that's being out of the way, the result is as follows:
nsv01-kul:net $ go test -v -run=Interface
=== RUN TestInterfaces
--- PASS: TestInterfaces (0.00 seconds)
    interface_test.go:59: table: len/cap = 6/8
    interface_test.go:76: "igb0": flags "up|broadcast|multicast", ifindex 1, mtu 9000
    interface_test.go:77:   hardware address "00:25:90:6c:24:48"
    interface_test.go:125:  interface address "2400:3700:10:2::94/64"
    interface_test.go:125:  interface address "fe80::225:90ff:fe6c:2448/64"
    interface_test.go:125:  interface address "124.108.16.94/28"
    interface_test.go:125:  interface address "124.108.16.92/32"
    interface_test.go:125:  interface address "2400:3700:10:2::92/64"
    interface_test.go:141:  joined group address "ff02::1:ff00:92"
    interface_test.go:141:  joined group address "224.0.0.1"
    interface_test.go:141:  joined group address "ff02::1:ff6c:2448"
    interface_test.go:141:  joined group address "ff01::1"
    interface_test.go:141:  joined group address "ff02::2:5311:6d09"
    interface_test.go:141:  joined group address "ff02::1"
    interface_test.go:141:  joined group address "ff02::1:ff00:94"
    interface_test.go:76: "igb1": flags "broadcast|multicast", ifindex 2, mtu 1500
    interface_test.go:77:   hardware address "00:25:90:6c:24:49"
    interface_test.go:76: "usbus0": flags "up", ifindex 3, mtu 0
    interface_test.go:77:   hardware address ""
    interface_test.go:76: "em0": flags "up|broadcast|multicast", ifindex 4, mtu 9000
    interface_test.go:77:   hardware address "00:25:90:77:35:f8"
    interface_test.go:125:  interface address "2400:3700:20:4::94/64"
    interface_test.go:125:  interface address "fe80::225:90ff:fe77:35f8/64"
    interface_test.go:125:  interface address "10.0.4.94/24"
    interface_test.go:141:  joined group address "224.0.0.1"
    interface_test.go:141:  joined group address "ff02::1:ff77:35f8"
    interface_test.go:141:  joined group address "ff01::1"
    interface_test.go:141:  joined group address "ff02::2:5311:6d09"
    interface_test.go:141:  joined group address "ff02::1"
    interface_test.go:141:  joined group address "ff02::1:ff00:94"
    interface_test.go:76: "usbus1": flags "up", ifindex 5, mtu 0
    interface_test.go:77:   hardware address ""
    interface_test.go:76: "lo0": flags "up|loopback|multicast", ifindex 6, mtu 16384
    interface_test.go:77:   hardware address ""
    interface_test.go:125:  interface address "::1/128"
    interface_test.go:125:  interface address "fe80::1/64"
    interface_test.go:125:  interface address "127.0.0.1/8"
    interface_test.go:141:  joined group address "224.0.0.1"
    interface_test.go:141:  joined group address "ff01::1"
    interface_test.go:141:  joined group address "ff02::2:5311:6d09"
    interface_test.go:141:  joined group address "ff02::1"
    interface_test.go:141:  joined group address "ff02::1:ff00:1"
=== RUN TestInterfaceAddrs
--- PASS: TestInterfaceAddrs (0.00 seconds)
    interface_test.go:88: table: len/cap = 11/16
    interface_test.go:125:  interface address "2400:3700:10:2::94/64"
    interface_test.go:125:  interface address "fe80::225:90ff:fe6c:2448/64"
    interface_test.go:125:  interface address "124.108.16.94/28"
    interface_test.go:125:  interface address "124.108.16.92/32"
    interface_test.go:125:  interface address "2400:3700:10:2::92/64"
    interface_test.go:125:  interface address "2400:3700:20:4::94/64"
    interface_test.go:125:  interface address "fe80::225:90ff:fe77:35f8/64"
    interface_test.go:125:  interface address "10.0.4.94/24"
    interface_test.go:125:  interface address "::1/128"
    interface_test.go:125:  interface address "fe80::1/64"
    interface_test.go:125:  interface address "127.0.0.1/8"
=== RUN TestPointToPointInterface
--- SKIP: TestPointToPointInterface (0.00 seconds)
    interface_unix_test.go:52: skipping test; must be root
=== RUN TestInterfaceArrivalAndDeparture
--- SKIP: TestInterfaceArrivalAndDeparture (0.00 seconds)
    interface_unix_test.go:100: skipping test; must be root
PASS
ok      net 0.004s

@mikioh
Copy link
Contributor

mikioh commented Sep 11, 2013

Comment 8:

This issue was closed by 3cde0ba2c729.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants