cope with errors during route traversal

Fixes #1909.
This commit is contained in:
Matthias Radestock committed 2016-01-19 15:28:31 +00:00
1 parent c391092ea6
commit 0caa9dd652
2 files changed
+8 -7

No files matched your search

+1 -2
View File
@@ -57,8 +57,7 @@ func EnsureInterfaceAndMcastRoute(ifaceName string) (*net.Interface, error) {
return iface, err
}
for update := range ch {
link, _ := netlink.LinkByIndex(update.Route.LinkIndex)
if link.Attrs().Name == ifaceName && update.Route.Dst.IP.Equal(dest) {
if update.Route.LinkIndex == iface.Index && update.Route.Dst.IP.Equal(dest) {
break
}
}
+7 -5
View File
@@ -41,12 +41,14 @@ func forEachRoute(ignoreIfaceNames map[string]struct{}, check func(name string,
}
for _, route := range routes {
link, err := netlink.LinkByIndex(route.LinkIndex)
if err == nil {
if _, found := ignoreIfaceNames[link.Attrs().Name]; found {
continue
}
if err != nil {
continue
}
if err := check(link.Attrs().Name, route); err != nil {
ifaceName := link.Attrs().Name
if _, found := ignoreIfaceNames[ifaceName]; found {
continue
}
if err := check(ifaceName, route); err != nil {
return err
}
}