diff --git a/overlay/route.go b/overlay/route.go index 467e362..64c624c 100644 --- a/overlay/route.go +++ b/overlay/route.go @@ -22,6 +22,8 @@ type Route struct { Install bool } +// Equal determines if a route that could be installed in the system route table is equal to another +// Via is ignored since that is only consumed within nebula itself func (r Route) Equal(t Route) bool { if !r.Cidr.IP.Equal(t.Cidr.IP) { return false @@ -35,6 +37,9 @@ func (r Route) Equal(t Route) bool { if r.MTU != t.MTU { return false } + if r.Install != t.Install { + return false + } return true } diff --git a/overlay/tun.go b/overlay/tun.go index dc09e33..cedd7fe 100644 --- a/overlay/tun.go +++ b/overlay/tun.go @@ -49,6 +49,8 @@ func getAllRoutesFromConfig(c *config.C, cidr *net.IPNet, initial bool) (bool, [ return true, routes, nil } +// findRemovedRoutes will return all routes that are not present in the newRoutes list and would affect the system route table. +// Via is not used to evaluate since it does not affect the system route table. func findRemovedRoutes(newRoutes, oldRoutes []Route) []Route { var removed []Route has := func(entry Route) bool {