Skip to content

Commit

Permalink
Evaluate install as part of diffing routes to remove
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrownus committed Feb 27, 2024
1 parent 01f7d84 commit 4e8d3e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions overlay/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions overlay/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4e8d3e0

Please sign in to comment.