Skip to content

Commit

Permalink
Filter out default route in interface monitor.
Browse files Browse the repository at this point in the history
This used to get filtered out by the nil check, but
the netlink library now synthesizes a zero CIDR when reading
the default route.
  • Loading branch information
fasaxc committed Jul 11, 2024
1 parent da91dbf commit 47311d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions felix/ifacemonitor/iface_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ func (m *InterfaceMonitor) handleNetlinkRouteUpdate(update netlink.RouteUpdate)
if update.Dst == nil {
return
}
if update.Dst.IP.IsUnspecified() {
if ones, _ := update.Dst.Mask.Size(); ones == 0 {
// Default route, ignore. These used to be filtered out by the
// nil check above, but the netlink library was changed to return
// an explicit unspecified CIDR in that case.
return
}
}

addr := update.Dst.IP.String()
exists := update.Type == unix.RTM_NEWROUTE
Expand Down

0 comments on commit 47311d4

Please sign in to comment.