Skip to content

Conversation

@hurricanehrndz
Copy link

On Unix systems specifically Darwin the wrong interface would be returned when multiple candidates for a specific route existed. The Gateway was correct, but the accuracy of the interface returned was not dependable.

https://github.com/libp2p/go-netroute/blob/master/common.go#L57

Instead of dumping the routing table and using IsMoreSpecThan to
determine the route of a destination. Use the routing socket to query
the route for destination. This approach is similar to using `route
get`.
For some reason on FreeBSD, the preferredSrc for route to one of the
local address is 127.0.0.1.

[0] RouteMessage: ver=5, type=4, flags=0x100845, idx=2, id=2124, seq=0, err=<nil>
    dst = 192.168.64.7
    gateway = [LinkAddr idx=1 name="" addr=]
    IFP = [LinkAddr idx=2 name="lo0" addr=]
    IFA = 127.0.0.
@hurricanehrndz hurricanehrndz changed the title Fix/route on bsd Fix Interface return from Route on Unix OSes Feb 12, 2025
@hurricanehrndz hurricanehrndz changed the title Fix Interface return from Route on Unix OSes Fix Interface returned from Route on Unix OSes Feb 14, 2025
@hurricanehrndz hurricanehrndz closed this by deleting the head repository Mar 20, 2025
},
}

func TestToRoueAddr(t *testing.T) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
func TestToRoueAddr(t *testing.T) {
func TestToRouteAddr(t *testing.T) {

@hurricanehrndz
Copy link
Author

I fixed this upstream

@hurricanehrndz
Copy link
Author

libp2p#57

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.

2 participants