if_data8 in types_freebsd.go is incompatible with FreeBSD-11's if.h. This results in go:net failing test and not being able to pick up available network interfaces correctly. Extra info: https://github.com/golang/go/issues/11641 ztypes_freebsd_{amd64/i386}.go need to be regenerated with: CC=clang go tool cgo -godefs types_freebsd.go > ztypes_freebsd_amd64.go Patch with: --- types_freebsd.go 2015-08-19 21:29:37.683186671 -0700 +++ /opt/go-src/1.5/go/src/syscall/types_freebsd.go 2015-08-19 17:39:53.767826664 -0700 @@ -106,15 +106,16 @@ // This structure is a duplicate of if_data on FreeBSD 8-STABLE. // See /usr/include/net/if.h. +#undef ifi_epoch +#undef ifi_lastchange struct if_data8 { u_char ifi_type; u_char ifi_physical; u_char ifi_addrlen; u_char ifi_hdrlen; u_char ifi_link_state; - u_char ifi_spare_char1; - u_char ifi_spare_char2; - u_char ifi_datalen; + u_char ifi_vhid; + u_short ifi_datalen; u_long ifi_mtu; u_long ifi_metric; u_long ifi_baudrate;
Created attachment 160383 [details] go-if_data.patch Attaching a proper patch against port dir based on Leon Dang's command. It adds a conditional patch, activated only on FreeBSD 11. The files generated by `go tool cgo` are also included in the patch, as they required manual tweaking on i386. Tested on amd64 and in an i386 jail. Test case: $ cat > iftest.go package main import "fmt" import "net" func main() { fmt.Println(net.InterfaceByName("lo0")) } Correct result (on patched system): $ go run iftest.go &{2 16384 lo0 up|loopback|multicast} <nil> Incorrect result: $ go run iftest.go <nil> route ip+net: no such network interface
I am hitting this bug on FreeBSD/current as well. Please fix.
What would need to happen for this to be merged? This issue is blocking my work, and is a blocker for Go 1.5 on -CURRENT.
A commit references this bug: Author: jlaffaye Date: Tue Sep 1 20:41:31 UTC 2015 New revision: 395798 URL: https://svnweb.freebsd.org/changeset/ports/395798 Log: Fix net package on CURRENT PR: 202504 Submitted by: Maciej Pasternacki <maciej@pasternacki.net> Changes: head/lang/go/Makefile head/lang/go/files/struct-if_data-patch
Committed, thanks!
Thanks!