From 9ce7fe2e3fbd72e24da88441236e4508160c3554 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 21 Apr 2019 20:56:12 -0500 Subject: [PATCH] fix tun/tap CIDR notation so things work on linux, may break other platforms for all I know --- src/tuntap/tun.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tuntap/tun.go b/src/tuntap/tun.go index d9e0e77e..912998ce 100644 --- a/src/tuntap/tun.go +++ b/src/tuntap/tun.go @@ -5,6 +5,7 @@ package tuntap import ( "encoding/hex" "errors" + "fmt" "net" "sync" "time" @@ -124,8 +125,9 @@ func (tun *TunAdapter) Start() error { tun.mtu = tun.config.Current.IfMTU ifname := tun.config.Current.IfName iftapmode := tun.config.Current.IfTAPMode + addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(address.GetPrefix())-1) if ifname != "none" { - if err := tun.setup(ifname, iftapmode, net.IP(tun.addr[:]).String(), tun.mtu); err != nil { + if err := tun.setup(ifname, iftapmode, addr, tun.mtu); err != nil { return err } }