Skip to content

Commit

Permalink
Merge pull request #20 from libp2p/osx-ignore-error
Browse files Browse the repository at this point in the history
ignore the error on the RouteMessage on Darwin
  • Loading branch information
marten-seemann committed Jan 15, 2022
2 parents 64e978a + 12d208c commit 07320f3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions netroute_bsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

// This is a BSD import for the routing structure initially found in
// https://github.com/google/gopacket/blob/master/routing/routing.go
//RIB parsing follows the BSD route format described in
// RIB parsing follows the BSD route format described in
// https://github.com/freebsd/freebsd/blob/master/sys/net/route.h
package netroute

Expand Down Expand Up @@ -67,6 +67,8 @@ func New() (routing.Router, error) {
var ipn *net.IPNet
for _, msg := range msgs {
m := msg.(*route.RouteMessage)
// We ignore the error (m.Err) here. It's not clear what this error actually means,
// and it makes us miss routes that _should_ be included.
routeInfo := new(rtInfo)

if m.Version < 3 || m.Version > 5 {
Expand All @@ -80,9 +82,6 @@ func New() (routing.Router, error) {
m.Flags&(RTF_REJECT|RTF_BLACKHOLE) != 0 {
continue
}
if m.Err != nil {
continue
}

dst, err := toIPAddr(m.Addrs[0])
if err == nil {
Expand Down

0 comments on commit 07320f3

Please sign in to comment.