mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-29 23:41: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:
parent
5dada3952c
commit
9ce7fe2e3f
@ -5,6 +5,7 @@ package tuntap
|
|||||||
import (
|
import (
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -124,8 +125,9 @@ func (tun *TunAdapter) Start() error {
|
|||||||
tun.mtu = tun.config.Current.IfMTU
|
tun.mtu = tun.config.Current.IfMTU
|
||||||
ifname := tun.config.Current.IfName
|
ifname := tun.config.Current.IfName
|
||||||
iftapmode := tun.config.Current.IfTAPMode
|
iftapmode := tun.config.Current.IfTAPMode
|
||||||
|
addr := fmt.Sprintf("%s/%d", net.IP(tun.addr[:]).String(), 8*len(address.GetPrefix())-1)
|
||||||
if ifname != "none" {
|
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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user