5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-29 21:21:35 +00:00

fix tun/tap CIDR notation so things work on linux, may break other platforms for all I know

This commit is contained in:
Arceliar 2019-04-21 20:56:12 -05:00
parent 5dada3952c
commit 9ce7fe2e3f

View File

@ -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
}
}