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

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)