Fix backpressure issue when TUN is disabled

This commit is contained in:
Neil Alexander
2025-11-23 22:06:25 +00:00
parent b43e213c32
commit bde65aa239
2 changed files with 5 additions and 2 deletions

View File

@@ -41,9 +41,11 @@ func (tun *TunAdapter) queue() {
tun.log.Errorln("Exiting TUN writer due to core read error:", err)
return
}
if tun.ch != nil {
tun.ch <- p[:n]
}
}
}
func (tun *TunAdapter) write() {
vs := cap(tun.ch)

View File

@@ -125,8 +125,9 @@ func (tun *TunAdapter) _start() error {
if tun.config.name == "none" || tun.config.name == "dummy" {
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
tun.isEnabled = false
// Need to keep the queue goroutine running to stop underlying
// layers from getting blocked.
go tun.queue()
go tun.write()
return nil
}
mtu := uint64(tun.config.mtu)