overlay: fix tun.RouteFor getting *net.IP (#595)

tun.RouteFor expects the routeTree to have an iputil.VpnIp inside of it
instead of a *net.IP.
This commit is contained in:
Wade Simmons
2021-12-06 09:35:31 -05:00
committed by GitHub
parent 48c47f5841
commit f60ed2b36d
3 changed files with 40 additions and 4 deletions

View File

@@ -9,13 +9,14 @@ import (
"github.com/slackhq/nebula/cidr"
"github.com/slackhq/nebula/config"
"github.com/slackhq/nebula/iputil"
)
type Route struct {
MTU int
Metric int
Cidr *net.IPNet
Via *net.IP
Via *iputil.VpnIp
}
func makeRouteTree(routes []Route, allowMTU bool) (*cidr.Tree4, error) {
@@ -26,7 +27,7 @@ func makeRouteTree(routes []Route, allowMTU bool) (*cidr.Tree4, error) {
}
if r.Via != nil {
routeTree.AddCIDR(r.Cidr, r.Via)
routeTree.AddCIDR(r.Cidr, *r.Via)
}
}
return routeTree, nil
@@ -180,8 +181,10 @@ func parseUnsafeRoutes(c *config.C, network *net.IPNet) ([]Route, error) {
return nil, fmt.Errorf("entry %v.route in tun.unsafe_routes is not present", i+1)
}
viaVpnIp := iputil.Ip2VpnIp(nVia)
r := Route{
Via: &nVia,
Via: &viaVpnIp,
MTU: mtu,
Metric: metric,
}