mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Fix TAP mode
This commit is contained in:
parent
912c181581
commit
e8272926a4
4 changed files with 88 additions and 53 deletions
|
@ -14,7 +14,6 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gologme/log"
|
||||
"github.com/yggdrasil-network/water"
|
||||
|
@ -152,21 +151,6 @@ func (tun *TunAdapter) Start() error {
|
|||
tun.send = make(chan []byte, 32) // TODO: is this a sensible value?
|
||||
tun.reconfigure = make(chan chan error)
|
||||
tun.mutex.Unlock()
|
||||
if iftapmode {
|
||||
go func() {
|
||||
for {
|
||||
if _, ok := tun.icmpv6.peermacs[tun.addr]; ok {
|
||||
break
|
||||
}
|
||||
request, err := tun.icmpv6.CreateNDPL2(tun.addr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
tun.send <- request
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
e := <-tun.reconfigure
|
||||
|
@ -177,6 +161,9 @@ func (tun *TunAdapter) Start() error {
|
|||
go tun.reader()
|
||||
go tun.writer()
|
||||
tun.icmpv6.Init(tun)
|
||||
if iftapmode {
|
||||
go tun.icmpv6.Solicit(tun.addr)
|
||||
}
|
||||
tun.ckr.init(tun)
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue