ignore the error on the RouteMessage on Darwin #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On OSX we're seeing that routes are missing. For example, when asking for a route to 127.0.0.1, this package wouldn't give us a 127.0.0.1 source, but some other address, e.g. a 192.168. address.
The reason seems to be that a lot of the
route.RouteMessage
s on OSX have theErr
field set, and we therefore ignore them:go-netroute/netroute_bsd.go
Lines 83 to 85 in 64e978a
For example, these are the v4 routes that are currently returned on my system (IPs blanked for privacy):
All routes with a non-
nil
error would be ignored by our current code.For reference, this is the output of
netstat -rna -f inet
:Note that the number of routes is roughly the same (the exact number fluctuates from minute to minute), which might be an indication that ignoring the error would be the right thing to do.