mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
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:
parent
48c47f5841
commit
f60ed2b36d
3 changed files with 40 additions and 4 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue