2018-11-05 16:40:47 +00:00
|
|
|
package yggdrasil
|
|
|
|
|
|
|
|
import (
|
2018-11-06 14:28:57 +00:00
|
|
|
"bytes"
|
2018-11-05 16:40:47 +00:00
|
|
|
"encoding/hex"
|
|
|
|
"errors"
|
2018-11-05 17:03:58 +00:00
|
|
|
"fmt"
|
2018-11-05 16:40:47 +00:00
|
|
|
"net"
|
|
|
|
"sort"
|
2019-01-14 17:41:08 +00:00
|
|
|
"sync"
|
2018-12-15 02:49:18 +00:00
|
|
|
|
|
|
|
"github.com/yggdrasil-network/yggdrasil-go/src/address"
|
|
|
|
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
|
2018-11-05 16:40:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// This module implements crypto-key routing, similar to Wireguard, where we
|
|
|
|
// allow traffic for non-Yggdrasil ranges to be routed over Yggdrasil.
|
|
|
|
|
|
|
|
type cryptokey struct {
|
2019-01-14 17:41:08 +00:00
|
|
|
core *Core
|
|
|
|
enabled bool
|
|
|
|
reconfigure chan chan error
|
|
|
|
ipv4routes []cryptokey_route
|
|
|
|
ipv6routes []cryptokey_route
|
|
|
|
ipv4cache map[address.Address]cryptokey_route
|
|
|
|
ipv6cache map[address.Address]cryptokey_route
|
|
|
|
ipv4sources []net.IPNet
|
|
|
|
ipv6sources []net.IPNet
|
|
|
|
mutexenabled sync.RWMutex // protects enabled
|
|
|
|
mutexroutes sync.RWMutex // protects ipv4routes, ipv6routes
|
|
|
|
mutexcache sync.RWMutex // protects ipv4cache, ipv6cache
|
|
|
|
mutexsources sync.RWMutex // protects ipv4sources, ipv6sources
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type cryptokey_route struct {
|
|
|
|
subnet net.IPNet
|
2018-12-15 02:49:18 +00:00
|
|
|
destination crypto.BoxPubKey
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Initialise crypto-key routing. This must be done before any other CKR calls.
|
2018-11-05 16:40:47 +00:00
|
|
|
func (c *cryptokey) init(core *Core) {
|
|
|
|
c.core = core
|
2019-01-14 17:41:08 +00:00
|
|
|
c.reconfigure = make(chan chan error, 1)
|
|
|
|
go func() {
|
|
|
|
for {
|
|
|
|
select {
|
|
|
|
case e := <-c.reconfigure:
|
|
|
|
e <- nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
c.mutexroutes.Lock()
|
2018-11-05 16:40:47 +00:00
|
|
|
c.ipv4routes = make([]cryptokey_route, 0)
|
|
|
|
c.ipv6routes = make([]cryptokey_route, 0)
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexroutes.Unlock()
|
|
|
|
|
|
|
|
c.mutexcache.Lock()
|
2018-12-15 02:49:18 +00:00
|
|
|
c.ipv4cache = make(map[address.Address]cryptokey_route, 0)
|
|
|
|
c.ipv6cache = make(map[address.Address]cryptokey_route, 0)
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexcache.Unlock()
|
|
|
|
|
|
|
|
c.mutexsources.Lock()
|
2018-11-05 23:59:41 +00:00
|
|
|
c.ipv4sources = make([]net.IPNet, 0)
|
|
|
|
c.ipv6sources = make([]net.IPNet, 0)
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexsources.Unlock()
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Enable or disable crypto-key routing.
|
2018-11-06 12:32:16 +00:00
|
|
|
func (c *cryptokey) setEnabled(enabled bool) {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexenabled.Lock()
|
|
|
|
defer c.mutexenabled.Unlock()
|
2018-11-06 12:32:16 +00:00
|
|
|
c.enabled = enabled
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Check if crypto-key routing is enabled.
|
2018-11-05 16:40:47 +00:00
|
|
|
func (c *cryptokey) isEnabled() bool {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexenabled.RLock()
|
|
|
|
defer c.mutexenabled.RUnlock()
|
2018-11-05 16:40:47 +00:00
|
|
|
return c.enabled
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Check whether the given address (with the address length specified in bytes)
|
|
|
|
// matches either the current node's address, the node's routed subnet or the
|
|
|
|
// list of subnets specified in IPv4Sources/IPv6Sources.
|
2018-12-15 02:49:18 +00:00
|
|
|
func (c *cryptokey) isValidSource(addr address.Address, addrlen int) bool {
|
2018-11-06 20:49:19 +00:00
|
|
|
ip := net.IP(addr[:addrlen])
|
2018-11-05 23:59:41 +00:00
|
|
|
|
2018-11-06 20:49:19 +00:00
|
|
|
if addrlen == net.IPv6len {
|
|
|
|
// Does this match our node's address?
|
|
|
|
if bytes.Equal(addr[:16], c.core.router.addr[:16]) {
|
|
|
|
return true
|
|
|
|
}
|
2018-11-05 23:59:41 +00:00
|
|
|
|
2018-11-06 20:49:19 +00:00
|
|
|
// Does this match our node's subnet?
|
|
|
|
if bytes.Equal(addr[:8], c.core.router.subnet[:8]) {
|
|
|
|
return true
|
|
|
|
}
|
2018-11-05 23:59:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Does it match a configured CKR source?
|
2018-11-06 11:11:57 +00:00
|
|
|
if c.isEnabled() {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexsources.RLock()
|
|
|
|
defer c.mutexsources.RUnlock()
|
|
|
|
|
2018-11-06 20:49:19 +00:00
|
|
|
// Build our references to the routing sources
|
|
|
|
var routingsources *[]net.IPNet
|
|
|
|
|
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if addrlen == net.IPv6len {
|
|
|
|
routingsources = &c.ipv6sources
|
|
|
|
} else if addrlen == net.IPv4len {
|
|
|
|
routingsources = &c.ipv4sources
|
|
|
|
} else {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, subnet := range *routingsources {
|
2018-11-06 11:11:57 +00:00
|
|
|
if subnet.Contains(ip) {
|
|
|
|
return true
|
|
|
|
}
|
2018-11-05 23:59:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Doesn't match any of the above
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Adds a source subnet, which allows traffic with these source addresses to
|
|
|
|
// be tunnelled using crypto-key routing.
|
2018-11-05 23:59:41 +00:00
|
|
|
func (c *cryptokey) addSourceSubnet(cidr string) error {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexsources.Lock()
|
|
|
|
defer c.mutexsources.Unlock()
|
|
|
|
|
2018-11-05 23:59:41 +00:00
|
|
|
// Is the CIDR we've been given valid?
|
|
|
|
_, ipnet, err := net.ParseCIDR(cidr)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2018-11-06 20:04:49 +00:00
|
|
|
// Get the prefix length and size
|
|
|
|
_, prefixsize := ipnet.Mask.Size()
|
|
|
|
|
|
|
|
// Build our references to the routing sources
|
|
|
|
var routingsources *[]net.IPNet
|
|
|
|
|
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if prefixsize == net.IPv6len*8 {
|
|
|
|
routingsources = &c.ipv6sources
|
|
|
|
} else if prefixsize == net.IPv4len*8 {
|
|
|
|
routingsources = &c.ipv4sources
|
|
|
|
} else {
|
|
|
|
return errors.New("Unexpected prefix size")
|
|
|
|
}
|
|
|
|
|
2018-11-05 23:59:41 +00:00
|
|
|
// Check if we already have this CIDR
|
2018-11-06 20:04:49 +00:00
|
|
|
for _, subnet := range *routingsources {
|
2018-11-05 23:59:41 +00:00
|
|
|
if subnet.String() == ipnet.String() {
|
|
|
|
return errors.New("Source subnet already configured")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add the source subnet
|
2018-11-06 20:04:49 +00:00
|
|
|
*routingsources = append(*routingsources, *ipnet)
|
2018-11-06 11:56:32 +00:00
|
|
|
c.core.log.Println("Added CKR source subnet", cidr)
|
2018-11-05 23:59:41 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Adds a destination route for the given CIDR to be tunnelled to the node
|
|
|
|
// with the given BoxPubKey.
|
2018-11-05 16:40:47 +00:00
|
|
|
func (c *cryptokey) addRoute(cidr string, dest string) error {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexroutes.Lock()
|
|
|
|
defer c.mutexroutes.Unlock()
|
|
|
|
|
2018-11-05 16:40:47 +00:00
|
|
|
// Is the CIDR we've been given valid?
|
2018-11-05 17:03:58 +00:00
|
|
|
ipaddr, ipnet, err := net.ParseCIDR(cidr)
|
2018-11-05 16:40:47 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the prefix length and size
|
2018-11-05 17:03:58 +00:00
|
|
|
_, prefixsize := ipnet.Mask.Size()
|
2018-11-05 16:40:47 +00:00
|
|
|
|
2018-11-06 20:04:49 +00:00
|
|
|
// Build our references to the routing table and cache
|
|
|
|
var routingtable *[]cryptokey_route
|
2018-12-15 02:49:18 +00:00
|
|
|
var routingcache *map[address.Address]cryptokey_route
|
2018-11-06 20:04:49 +00:00
|
|
|
|
2018-11-05 16:40:47 +00:00
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if prefixsize == net.IPv6len*8 {
|
2018-11-06 20:04:49 +00:00
|
|
|
routingtable = &c.ipv6routes
|
|
|
|
routingcache = &c.ipv6cache
|
|
|
|
} else if prefixsize == net.IPv4len*8 {
|
|
|
|
routingtable = &c.ipv4routes
|
|
|
|
routingcache = &c.ipv4cache
|
|
|
|
} else {
|
|
|
|
return errors.New("Unexpected prefix size")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Is the route an Yggdrasil destination?
|
2018-12-15 02:49:18 +00:00
|
|
|
var addr address.Address
|
|
|
|
var snet address.Subnet
|
2018-11-06 20:04:49 +00:00
|
|
|
copy(addr[:], ipaddr)
|
|
|
|
copy(snet[:], ipnet.IP)
|
2018-12-15 02:49:18 +00:00
|
|
|
if addr.IsValid() || snet.IsValid() {
|
2018-11-06 20:04:49 +00:00
|
|
|
return errors.New("Can't specify Yggdrasil destination as crypto-key route")
|
|
|
|
}
|
|
|
|
// Do we already have a route for this subnet?
|
|
|
|
for _, route := range *routingtable {
|
|
|
|
if route.subnet.String() == ipnet.String() {
|
|
|
|
return errors.New(fmt.Sprintf("Route already exists for %s", cidr))
|
2018-11-05 17:03:58 +00:00
|
|
|
}
|
2018-11-06 20:04:49 +00:00
|
|
|
}
|
|
|
|
// Decode the public key
|
2018-11-23 03:30:56 +00:00
|
|
|
if bpk, err := hex.DecodeString(dest); err != nil {
|
2018-11-06 20:04:49 +00:00
|
|
|
return err
|
2018-12-15 02:49:18 +00:00
|
|
|
} else if len(bpk) != crypto.BoxPubKeyLen {
|
2018-11-23 03:30:56 +00:00
|
|
|
return errors.New(fmt.Sprintf("Incorrect key length for %s", dest))
|
2018-11-06 20:04:49 +00:00
|
|
|
} else {
|
|
|
|
// Add the new crypto-key route
|
2018-12-15 02:49:18 +00:00
|
|
|
var key crypto.BoxPubKey
|
2018-11-21 06:10:20 +00:00
|
|
|
copy(key[:], bpk)
|
2018-11-06 20:04:49 +00:00
|
|
|
*routingtable = append(*routingtable, cryptokey_route{
|
|
|
|
subnet: *ipnet,
|
2018-11-21 06:10:20 +00:00
|
|
|
destination: key,
|
2018-11-06 20:04:49 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
// Sort so most specific routes are first
|
|
|
|
sort.Slice(*routingtable, func(i, j int) bool {
|
|
|
|
im, _ := (*routingtable)[i].subnet.Mask.Size()
|
|
|
|
jm, _ := (*routingtable)[j].subnet.Mask.Size()
|
|
|
|
return im > jm
|
|
|
|
})
|
|
|
|
|
|
|
|
// Clear the cache as this route might change future routing
|
|
|
|
// Setting an empty slice keeps the memory whereas nil invokes GC
|
|
|
|
for k := range *routingcache {
|
|
|
|
delete(*routingcache, k)
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
2018-11-05 17:31:10 +00:00
|
|
|
|
2018-11-06 20:04:49 +00:00
|
|
|
c.core.log.Println("Added CKR destination subnet", cidr)
|
|
|
|
return nil
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-06 22:57:53 +00:00
|
|
|
// Looks up the most specific route for the given address (with the address
|
|
|
|
// length specified in bytes) from the crypto-key routing table. An error is
|
|
|
|
// returned if the address is not suitable or no route was found.
|
2018-12-15 02:49:18 +00:00
|
|
|
func (c *cryptokey) getPublicKeyForAddress(addr address.Address, addrlen int) (crypto.BoxPubKey, error) {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexroutes.RLock()
|
|
|
|
c.mutexcache.RLock()
|
|
|
|
defer c.mutexroutes.RUnlock()
|
|
|
|
defer c.mutexcache.RUnlock()
|
|
|
|
|
2018-11-05 23:12:26 +00:00
|
|
|
// Check if the address is a valid Yggdrasil address - if so it
|
|
|
|
// is exempt from all CKR checking
|
2018-12-15 02:49:18 +00:00
|
|
|
if addr.IsValid() {
|
|
|
|
return crypto.BoxPubKey{}, errors.New("Cannot look up CKR for Yggdrasil addresses")
|
2018-11-05 23:12:26 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 20:04:49 +00:00
|
|
|
// Build our references to the routing table and cache
|
|
|
|
var routingtable *[]cryptokey_route
|
2018-12-15 02:49:18 +00:00
|
|
|
var routingcache *map[address.Address]cryptokey_route
|
2018-11-06 20:04:49 +00:00
|
|
|
|
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if addrlen == net.IPv6len {
|
|
|
|
routingtable = &c.ipv6routes
|
|
|
|
routingcache = &c.ipv6cache
|
|
|
|
} else if addrlen == net.IPv4len {
|
|
|
|
routingtable = &c.ipv4routes
|
|
|
|
routingcache = &c.ipv4cache
|
|
|
|
} else {
|
2018-12-15 02:49:18 +00:00
|
|
|
return crypto.BoxPubKey{}, errors.New("Unexpected prefix size")
|
2018-11-06 20:04:49 +00:00
|
|
|
}
|
|
|
|
|
2018-11-05 17:31:10 +00:00
|
|
|
// Check if there's a cache entry for this addr
|
2018-11-06 20:04:49 +00:00
|
|
|
if route, ok := (*routingcache)[addr]; ok {
|
2018-11-21 06:10:20 +00:00
|
|
|
return route.destination, nil
|
2018-11-05 17:31:10 +00:00
|
|
|
}
|
2018-11-05 16:40:47 +00:00
|
|
|
|
2018-11-05 17:31:10 +00:00
|
|
|
// No cache was found - start by converting the address into a net.IP
|
2018-11-06 20:04:49 +00:00
|
|
|
ip := make(net.IP, addrlen)
|
|
|
|
copy(ip[:addrlen], addr[:])
|
|
|
|
|
|
|
|
// Check if we have a route. At this point c.ipv6routes should be
|
|
|
|
// pre-sorted so that the most specific routes are first
|
|
|
|
for _, route := range *routingtable {
|
|
|
|
// Does this subnet match the given IP?
|
|
|
|
if route.subnet.Contains(ip) {
|
2018-12-10 22:19:08 +00:00
|
|
|
// Check if the routing cache is above a certain size, if it is evict
|
|
|
|
// a random entry so we can make room for this one. We take advantage
|
|
|
|
// of the fact that the iteration order is random here
|
2018-12-10 22:30:31 +00:00
|
|
|
for k := range *routingcache {
|
|
|
|
if len(*routingcache) < 1024 {
|
2018-12-10 22:19:08 +00:00
|
|
|
break
|
|
|
|
}
|
2018-12-10 22:30:31 +00:00
|
|
|
delete(*routingcache, k)
|
2018-12-10 22:19:08 +00:00
|
|
|
}
|
|
|
|
|
2018-11-06 20:04:49 +00:00
|
|
|
// Cache the entry for future packets to get a faster lookup
|
|
|
|
(*routingcache)[addr] = route
|
|
|
|
|
|
|
|
// Return the boxPubKey
|
2018-11-21 06:10:20 +00:00
|
|
|
return route.destination, nil
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
|
|
|
}
|
2018-11-05 17:31:10 +00:00
|
|
|
|
|
|
|
// No route was found if we got to this point
|
2018-12-15 02:49:18 +00:00
|
|
|
return crypto.BoxPubKey{}, errors.New(fmt.Sprintf("No route to %s", ip.String()))
|
2018-11-05 16:40:47 +00:00
|
|
|
}
|
2018-11-23 03:30:56 +00:00
|
|
|
|
|
|
|
// Removes a source subnet, which allows traffic with these source addresses to
|
|
|
|
// be tunnelled using crypto-key routing.
|
|
|
|
func (c *cryptokey) removeSourceSubnet(cidr string) error {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexsources.Lock()
|
|
|
|
defer c.mutexsources.Unlock()
|
|
|
|
|
2018-11-23 03:30:56 +00:00
|
|
|
// Is the CIDR we've been given valid?
|
|
|
|
_, ipnet, err := net.ParseCIDR(cidr)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the prefix length and size
|
|
|
|
_, prefixsize := ipnet.Mask.Size()
|
|
|
|
|
|
|
|
// Build our references to the routing sources
|
|
|
|
var routingsources *[]net.IPNet
|
|
|
|
|
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if prefixsize == net.IPv6len*8 {
|
|
|
|
routingsources = &c.ipv6sources
|
|
|
|
} else if prefixsize == net.IPv4len*8 {
|
|
|
|
routingsources = &c.ipv4sources
|
|
|
|
} else {
|
|
|
|
return errors.New("Unexpected prefix size")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if we already have this CIDR
|
|
|
|
for idx, subnet := range *routingsources {
|
|
|
|
if subnet.String() == ipnet.String() {
|
|
|
|
*routingsources = append((*routingsources)[:idx], (*routingsources)[idx+1:]...)
|
|
|
|
c.core.log.Println("Removed CKR source subnet", cidr)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return errors.New("Source subnet not found")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Removes a destination route for the given CIDR to be tunnelled to the node
|
|
|
|
// with the given BoxPubKey.
|
|
|
|
func (c *cryptokey) removeRoute(cidr string, dest string) error {
|
2019-01-14 17:41:08 +00:00
|
|
|
c.mutexroutes.Lock()
|
|
|
|
c.mutexcache.Lock()
|
|
|
|
defer c.mutexroutes.Unlock()
|
|
|
|
defer c.mutexcache.Unlock()
|
|
|
|
|
2018-11-23 03:30:56 +00:00
|
|
|
// Is the CIDR we've been given valid?
|
|
|
|
_, ipnet, err := net.ParseCIDR(cidr)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the prefix length and size
|
|
|
|
_, prefixsize := ipnet.Mask.Size()
|
|
|
|
|
|
|
|
// Build our references to the routing table and cache
|
|
|
|
var routingtable *[]cryptokey_route
|
2018-12-15 02:49:18 +00:00
|
|
|
var routingcache *map[address.Address]cryptokey_route
|
2018-11-23 03:30:56 +00:00
|
|
|
|
|
|
|
// Check if the prefix is IPv4 or IPv6
|
|
|
|
if prefixsize == net.IPv6len*8 {
|
|
|
|
routingtable = &c.ipv6routes
|
|
|
|
routingcache = &c.ipv6cache
|
|
|
|
} else if prefixsize == net.IPv4len*8 {
|
|
|
|
routingtable = &c.ipv4routes
|
|
|
|
routingcache = &c.ipv4cache
|
|
|
|
} else {
|
|
|
|
return errors.New("Unexpected prefix size")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Decode the public key
|
|
|
|
bpk, err := hex.DecodeString(dest)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2018-12-15 02:49:18 +00:00
|
|
|
} else if len(bpk) != crypto.BoxPubKeyLen {
|
2018-11-23 03:30:56 +00:00
|
|
|
return errors.New(fmt.Sprintf("Incorrect key length for %s", dest))
|
|
|
|
}
|
|
|
|
netStr := ipnet.String()
|
|
|
|
|
|
|
|
for idx, route := range *routingtable {
|
|
|
|
if bytes.Equal(route.destination[:], bpk) && route.subnet.String() == netStr {
|
|
|
|
*routingtable = append((*routingtable)[:idx], (*routingtable)[idx+1:]...)
|
|
|
|
for k := range *routingcache {
|
|
|
|
delete(*routingcache, k)
|
|
|
|
}
|
2018-11-23 03:41:16 +00:00
|
|
|
c.core.log.Printf("Removed CKR destination subnet %s via %s\n", cidr, dest)
|
2018-11-23 03:30:56 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return errors.New(fmt.Sprintf("Route does not exists for %s", cidr))
|
|
|
|
}
|