aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 19:23:44 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-14 19:33:35 +0200
commit28c7eb43358df44ab010f6b7ace2849647d9126c (patch)
tree27c070bfde2bd67472ee7ff4eb82e04006e66ba7
parentMask IPs when showing from trie (diff)
downloadwireguard-go-28c7eb43358df44ab010f6b7ace2849647d9126c.tar.xz
wireguard-go-28c7eb43358df44ab010f6b7ace2849647d9126c.zip
Print utun name on darwin
Diffstat (limited to '')
-rw-r--r--allowedips.go2
-rw-r--r--tun_darwin.go6
2 files changed, 6 insertions, 2 deletions
diff --git a/allowedips.go b/allowedips.go
index 5b1565e..92a6f1d 100644
--- a/allowedips.go
+++ b/allowedips.go
@@ -184,7 +184,7 @@ func (node *trieEntry) entriesForPeer(p *Peer, results []net.IPNet) []net.IPNet
mask := net.CIDRMask(int(node.cidr), len(node.bits)*8)
results = append(results, net.IPNet{
Mask: mask,
- IP: node.bits.Mask(mask),
+ IP: node.bits.Mask(mask),
})
}
results = node.child[0].entriesForPeer(p, results)
diff --git a/tun_darwin.go b/tun_darwin.go
index 8f9a5d5..ed055b2 100644
--- a/tun_darwin.go
+++ b/tun_darwin.go
@@ -12,6 +12,7 @@ import (
"fmt"
"golang.org/x/net/ipv6"
"golang.org/x/sys/unix"
+ "io/ioutil"
"net"
"os"
"time"
@@ -104,7 +105,10 @@ func CreateTUN(name string) (TUNDevice, error) {
tun, err := CreateTUNFromFile(os.NewFile(uintptr(fd), ""))
if err == nil && name == "utun" {
- fmt.Printf("OS assigned interface: %s\n", tun.(*NativeTun).name)
+ fname := os.Getenv("WG_DARWIN_UTUN_NAME_FILE")
+ if fname != "" {
+ ioutil.WriteFile(fname, []byte(tun.(*NativeTun).name+"\n"), 0400)
+ }
}
return tun, err