Skip to content

Commit bde65aa

Browse files
committed
Fix backpressure issue when TUN is disabled
1 parent b43e213 commit bde65aa

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/tun/iface.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ func (tun *TunAdapter) queue() {
4141
tun.log.Errorln("Exiting TUN writer due to core read error:", err)
4242
return
4343
}
44-
tun.ch <- p[:n]
44+
if tun.ch != nil {
45+
tun.ch <- p[:n]
46+
}
4547
}
4648
}
4749

src/tun/tun.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ func (tun *TunAdapter) _start() error {
125125
if tun.config.name == "none" || tun.config.name == "dummy" {
126126
tun.log.Debugln("Not starting TUN as ifname is none or dummy")
127127
tun.isEnabled = false
128+
// Need to keep the queue goroutine running to stop underlying
129+
// layers from getting blocked.
128130
go tun.queue()
129-
go tun.write()
130131
return nil
131132
}
132133
mtu := uint64(tun.config.mtu)

0 commit comments

Comments
 (0)