wgengine/router/router_userspace_bsd: on Mac the route program syntax expects delete not del -- this had caused router reconfig to fail in some cases. Fixes #673

Signed-off-by: Mike Kramlich <groglogic@gmail.com>
This commit is contained in:
Mike Kramlich 2020-08-11 11:04:07 -06:00 committed by Brad Fitzpatrick
parent 95a18f815c
commit 6fa7a9a055

View File

@ -16,6 +16,7 @@
"github.com/tailscale/wireguard-go/tun" "github.com/tailscale/wireguard-go/tun"
"inet.af/netaddr" "inet.af/netaddr"
"tailscale.com/types/logger" "tailscale.com/types/logger"
"tailscale.com/version"
"tailscale.com/wgengine/router/dns" "tailscale.com/wgengine/router/dns"
) )
@ -114,8 +115,12 @@ func (r *userspaceBSDRouter) Set(cfg *Config) error {
net := route.IPNet() net := route.IPNet()
nip := net.IP.Mask(net.Mask) nip := net.IP.Mask(net.Mask)
nstr := fmt.Sprintf("%v/%d", nip, route.Bits) nstr := fmt.Sprintf("%v/%d", nip, route.Bits)
del := "del"
if version.OS() == "macOS" {
del = "delete"
}
routedel := []string{"route", "-q", "-n", routedel := []string{"route", "-q", "-n",
"del", "-inet", nstr, del, "-inet", nstr,
"-iface", r.tunname} "-iface", r.tunname}
out, err := cmd(routedel...).CombinedOutput() out, err := cmd(routedel...).CombinedOutput()
if err != nil { if err != nil {