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: Interfaces() does not return all interfaces on Windows #37652

Open
ChenYahui2019 opened this issue Mar 4, 2020 · 5 comments
Open

net: Interfaces() does not return all interfaces on Windows #37652

ChenYahui2019 opened this issue Mar 4, 2020 · 5 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ChenYahui2019
Copy link

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

$ go version
go version go1.13.4 linux/amd64

Does this issue reproduce with the latest release?

Y

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/golang"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build467654165=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I am trying to use net.Interfaces() to get all interfaces on Windows, however, some interfaces can only display using Wireshark.

What did you expect to see?

If Wireshark was able to display an interface on Windows, net.Interfaces() can also do the same.

What did you see instead?

Some interfaces can be seen using Wireshark on Windows, which cannot been seen by net.Interfaces().

@ChenYahui2019
Copy link
Author

ChenYahui2019 commented Mar 4, 2020

I found the list of net.Interfaces() is same with ipconfig or GetAdaptersAddresses/GetAdaptersInfo, Wireshark use another Windows API pcap.FindAllDevs/pcapFindalldevsPtr.

So, may net.Interfaces() chang the method of getting all interfaces here?

@ChenYahui2019 ChenYahui2019 changed the title Some interfaces can be seen using Wireshark on Windows, which cannot been seen by net.Interfaces() net.Interfaces() can not get all interfaces on Windows Mar 5, 2020
@toothrot toothrot changed the title net.Interfaces() can not get all interfaces on Windows net: Interfaces() does not return all interfaces on Windows Mar 9, 2020
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 9, 2020
@toothrot toothrot added this to the Backlog milestone Mar 9, 2020
@toothrot
Copy link
Contributor

toothrot commented Mar 9, 2020

/cc @mikioh @alexbrainman @bradfitz

@alexbrainman
Copy link
Member

I found the list of net.Interfaces() is same with ipconfig or GetAdaptersAddresses/GetAdaptersInfo, Wireshark use another Windows API pcap.FindAllDevs/pcapFindalldevsPtr.

Sorry, but I don't have time even to investigate this. I don't think net.Interfaces is very useful on Windows.

Alex

@bradfitz
Copy link
Contributor

What types of interfaces does Wireshark include that Go/ipconfig do not?

@ChenYahui2019
Copy link
Author

@bradfitz The NIC2 which is used for Hyper-v vswitch.

PS C:\Program Files> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
NIC4                      Broadcom NetXtreme Gigabit Ethernet          19 Disconnected C8-1F-66-F8-24-A8          0 bps
NIC3                      Broadcom NetXtreme Gigabit Ethernet #2       18 Disconnected C8-1F-66-F8-24-A7          0 bps
vEthernet (vswitch123)    Hyper-V Virtual Ethernet Adapter             45 Up           C8-1F-66-F8-24-A6         1 Gbps
Npcap Loopback Adapter    Npcap Loopback Adapter                       65 Up           02-00-4C-4F-4F-50       1.2 Gbps
NIC2                      Broadcom NetXtreme Gigabit Ethernet #3       10 Up           C8-1F-66-F8-24-A6         1 Gbps
NIC1                      Broadcom NetXtreme Gigabit Ethernet #4        7 Up           C8-1F-66-F8-24-A5         1 Gbps


PS C:\Program Files> Get-VMSwitch vswitch123

Name       SwitchType NetAdapterInterfaceDescription
----       ---------- ------------------------------
vswitch123 External   Broadcom NetXtreme Gigabit Ethernet #3

PS C:\Program Files> ipconfig.exe

Windows IP 配置


以太网适配器 NIC4:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :

以太网适配器 NIC3:

   媒体状态  . . . . . . . . . . . . : 媒体已断开连接
   连接特定的 DNS 后缀 . . . . . . . :

以太网适配器 NIC1:

   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
   IPv4 地址 . . . . . . . . . . . . : 172.16.1.134
   子网掩码  . . . . . . . . . . . . : 255.255.0.0
   默认网关. . . . . . . . . . . . . :

以太网适配器 Npcap Loopback Adapter:

   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
   自动配置 IPv4 地址  . . . . . . . : 169.254.70.224
   子网掩码  . . . . . . . . . . . . : 255.255.0.0
   默认网关. . . . . . . . . . . . . :

以太网适配器 vEthernet (vswitch123):

   连接特定的 DNS 后缀 . . . . . . . :
   本地链接 IPv6 地址. . . . . . . . : xxxx::xxx:xxxxx:xxxx:xxxxxxxx
   IPv4 地址 . . . . . . . . . . . . : x.x.x.x
   子网掩码  . . . . . . . . . . . . : 255.255.0.0
   默认网关. . . . . . . . . . . . . : x.x.x.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants