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() fails on Plan 9 if there is a packet interface #39908

Closed
fhs opened this issue Jun 29, 2020 · 2 comments
Closed

net: Interfaces() fails on Plan 9 if there is a packet interface #39908

fhs opened this issue Jun 29, 2020 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9

Comments

@fhs
Copy link
Contributor

fhs commented Jun 29, 2020

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

$ go version
go version devel +master Thu Jun 25 19:13:01 EDT 2020 plan9/amd64

What did you do?

  • Create a packet interface. For example, 6in4(8) and tinc(8) creates them by writing bind pkt to the interface control file.
    Note that the device name in the interface status file is pkt2:
cpu% cat /net/ipifc/2/status | sed 1q
device pkt2 maxtu 1472 sendra 0 recvra 0 mflag 0 oflag 0 maxraint 600000 minraint 200000 linkmtu 0 reachtime 0 rxmitra 0 ttl 255 routerlt 1800 pktin 0 pktout 0 errin 0 errout 0 speed 0 delay 40
  • Call net.Interfaces() in a Go program.

What did you expect to see?

nil error

What did you see instead?

Error returned:

route ip+net: open pkt2/addr: 'pkt2' file not found

The code is assuming pkt2 is a path to a network device (e.g. /net/ether0) and tries to open pkt2/addr to read in the Interface.HardwareAddr:

// Not a loopback device
if device != "/dev/null" {
deviceaddrf, err := open(device + "/addr")
if err != nil {
return nil, err
}

It does skip this for the loopback interface (/dev/null device), but it should also skip for packet interfaces. Maybe it should just skip anything without a /net/ prefix.

@gopherbot add labels OS-Plan9, NeedsFix

@gopherbot gopherbot added NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9 labels Jun 29, 2020
@fhs fhs changed the title net: net.Interfaces() fails on Plan 9 if there is a packet interface net: Interfaces() fails on Plan 9 if there is a packet interface Jun 29, 2020
@fhs
Copy link
Contributor Author

fhs commented Jun 29, 2020

Tests are also failing:

cpu% cd src/net
cpu% go test -short
--- FAIL: TestInterfaces (0.00s)
    interface_test.go:56: route ip+net: open pkt2/addr: 'pkt2' './home/big/go/src/net/pkt2' does not exist
--- FAIL: TestInterfaceAddrs (0.00s)
    interface_test.go:87: route ip+net: open pkt2/addr: 'pkt2' './home/big/go/src/net/pkt2' does not exist
--- FAIL: TestInterfaceUnicastAddrs (0.00s)
    interface_test.go:106: route ip+net: open pkt2/addr: 'pkt2' './home/big/go/src/net/pkt2' does not exist
--- FAIL: TestInterfaceMulticastAddrs (0.00s)
    interface_test.go:133: route ip+net: open pkt2/addr: 'pkt2' './home/big/go/src/net/pkt2' does not exist
FAIL
exit status: 'net.test 11992: 1'
FAIL	net	40.497s

@gopherbot
Copy link

Change https://golang.org/cl/240259 mentions this issue: net: handle more interface types without a hardware address on Plan 9

@golang golang locked and limited conversation to collaborators Jun 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Plan9
Projects
None yet
Development

No branches or pull requests

2 participants