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

remove full iface access assumption [linux/bsd] #9

Merged
merged 3 commits into from
Mar 31, 2020
Merged

Conversation

willscott
Copy link
Contributor

fix #8

@Stebalien
Copy link
Member

Ok, well, upgrading something along the way has exposed the actual error. We're getting an index out of bounds error.

@Stebalien
Copy link
Member

Failed
=== RUN   TestRoute
--- FAIL: TestRoute (0.00s)
panic: runtime error: index out of range [4619] with length 2 [recovered]
	panic: runtime error: index out of range [4619] with length 2

goroutine 6 [running]:
testing.tRunner.func1.1(0x5447e0, 0xc000016920)
	/usr/local/go/src/testing/testing.go:941 +0x3d0
testing.tRunner.func1(0xc000022240)
	/usr/local/go/src/testing/testing.go:944 +0x3f9
panic(0x5447e0, 0xc000016920)
	/usr/local/go/src/runtime/panic.go:967 +0x166
github.com/libp2p/go-netroute.(*router).RouteWithSrc(0xc0000ac1e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00001a3d0, 0x10, 0x10, ...)
	/home/circleci/project/common.go:103 +0x7e2
github.com/libp2p/go-netroute.(*router).Route(0xc0000ac1e0, 0xc00001a3d0, 0x10, 0x10, 0x10, 0x10, 0x1, 0x0, 0xc0000ea358, 0x4, ...)
	/home/circleci/project/common.go:82 +0x96
github.com/libp2p/go-netroute.TestRoute(0xc000022240)
	/home/circleci/project/netroute_test.go:51 +0x4af
testing.tRunner(0xc000022240, 0x55ff40)
	/usr/local/go/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1043 +0x357

@Stebalien
Copy link
Member

We probably need to use a map instead of an array.

@willscott
Copy link
Contributor Author

tests passing is good. I'll merge & cut a release now to not block your downstream work. Take a look and confirm when you get a chance.

@willscott willscott merged commit 29d70d1 into master Mar 31, 2020
@willscott willscott deleted the bug/ifaceperm branch March 31, 2020 02:14
@@ -23,6 +22,8 @@ import (

func New() (routing.Router, error) {
rtr := &router{}
rtr.ifaces = make(map[int]net.Interface)
rtr.addrs = make(map[int]ipAddrs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We should probably pre-allocate these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We shouldn't make assumptions about interface indices
2 participants