]> Cypherpunks repositories - gostls13.git/commitdiff
net: handle more interface types without a hardware address on Plan 9
authorFazlul Shahriar <fshahriar@gmail.com>
Mon, 29 Jun 2020 05:50:50 +0000 (01:50 -0400)
committerDavid du Colombier <0intro@gmail.com>
Mon, 29 Jun 2020 08:06:23 +0000 (08:06 +0000)
We were handling loopback devices when attempting to read hardware
address, but packet interfaces were not being handled. As a general fix,
don't attempt to read hardware address of any device that's not inside
/net.

Fixes #39908

Change-Id: Ifa05e270357e111c60906110db2cc23dc7c1c49c
Reviewed-on: https://go-review.googlesource.com/c/go/+/240259
Run-TryBot: David du Colombier <0intro@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David du Colombier <0intro@gmail.com>
src/net/interface_plan9.go

index 1295017a1b9fec7b5bc13a422584b1ac071033c9..31bbaca4675c2955acd9f4064b070c9c6827224a 100644 (file)
@@ -68,8 +68,8 @@ func readInterface(i int) (*Interface, error) {
        }
        ifc.MTU = mtu
 
-       // Not a loopback device
-       if device != "/dev/null" {
+       // Not a loopback device ("/dev/null") or packet interface (e.g. "pkt2")
+       if stringsHasPrefix(device, netdir+"/") {
                deviceaddrf, err := open(device + "/addr")
                if err != nil {
                        return nil, err