From 12d208c88ebdde8e9284ee4e21187589951b356c Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 15 Jan 2022 17:54:19 +0400 Subject: [PATCH] ignore the error on the RouteMessage on Darwin --- netroute_bsd.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/netroute_bsd.go b/netroute_bsd.go index 061dc9a..85304d9 100644 --- a/netroute_bsd.go +++ b/netroute_bsd.go @@ -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 {