libp2p/go-reuseport-transport

failing tests on OSX

Closed this issue · 1 comments

for example:

=== RUN   TestGlobalPreferenceV4
    transport_test.go:132: when listening on /ip4/127.0.0.1/tcp/0, should prefer /ip4/127.0.0.1/tcp/0 over /ip4/192.168.28.27/tcp/0
    transport_test.go:134: when listening on /ip4/127.0.0.1/tcp/0, should prefer /ip4/0.0.0.0/tcp/0 over /ip4/192.168.28.27/tcp/0
    transport_test.go:185: dialed /ip4/127.0.0.1/tcp/59250 from 127.0.0.1:59253. expected to dial from port [59251]
    transport_test.go:137: when listening on /ip4/192.168.28.27/tcp/0, should prefer /ip4/0.0.0.0/tcp/0 over /ip4/127.0.0.1/tcp/0

This seems to be caused by the netroute call:

if router, err := netroute.New(); err == nil {
if _, _, preferredSrc, err := router.Route(ip); err == nil {

Which returns the 192.168.28.27 address instead of 127.0.0.1.

Interestingly, the tests for go-netroute pass on CI, but they fail locally:

--- FAIL: TestRoute (0.00s)
    netroute_test.go:51: Did not expect gateway for 192.168.46.1->127.0.0.1: <nil>