mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
Unsafe route reload (#1083)
This commit is contained in:
parent
8b68a08723
commit
bbb15f8cb1
13 changed files with 1088 additions and 317 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package overlay
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
|
|
@ -21,6 +22,35 @@ 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
|
||||
}
|
||||
if !bytes.Equal(r.Cidr.Mask, t.Cidr.Mask) {
|
||||
return false
|
||||
}
|
||||
if r.Metric != t.Metric {
|
||||
return false
|
||||
}
|
||||
if r.MTU != t.MTU {
|
||||
return false
|
||||
}
|
||||
if r.Install != t.Install {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (r Route) String() string {
|
||||
s := r.Cidr.String()
|
||||
if r.Metric != 0 {
|
||||
s += fmt.Sprintf(" metric: %v", r.Metric)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func makeRouteTree(l *logrus.Logger, routes []Route, allowMTU bool) (*cidr.Tree4[iputil.VpnIp], error) {
|
||||
routeTree := cidr.NewTree4[iputil.VpnIp]()
|
||||
for _, r := range routes {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue