Browse Source

freebsd routes

Matthew R. Kasun 3 years ago
parent
commit
c41042ff06
1 changed files with 8 additions and 2 deletions
  1. 8 2
      netclient/local/routes_freebsd.go

+ 8 - 2
netclient/local/routes_freebsd.go

@@ -1,7 +1,9 @@
 package local
 package local
 
 
 import (
 import (
+	"fmt"
 	"net"
 	"net"
+	"strings"
 
 
 	"github.com/c-robinson/iplib"
 	"github.com/c-robinson/iplib"
 	"github.com/gravitl/netmaker/logger"
 	"github.com/gravitl/netmaker/logger"
@@ -35,8 +37,12 @@ func GetDefaultRoute() (string, string, error) {
 }
 }
 
 
 func setRoute(iface string, addr *net.IPNet, address string) error {
 func setRoute(iface string, addr *net.IPNet, address string) error {
-	var err error
-	_, _ = ncutils.RunCmd("route add -net "+addr.String()+" -interface "+iface, false)
+	_, err := ncutils.RunCmd("route add -net "+addr.String()+" -interface "+iface, false)
+	return err
+}
+
+func SetExplicitRoute(iface string, destination *net.IPNet, gateway string) error {
+	_, err := ncutils.RunCmd("route add "+destination.String()+" "+gateway, false)
 	return err
 	return err
 }
 }