Merge pull request #20 from libp2p/osx-ignore-error

ignore the error on the RouteMessage on Darwin
This commit is contained in:
Marten Seemann
2022-01-15 07:21:56 -08:00
committed by GitHub
+3 -4
View File
@@ -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
@@ -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 {
@@ -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 {