diff --git a/adapter/outbound/easytier.go b/adapter/outbound/easytier.go index b42fc239d..23962e6f9 100644 --- a/adapter/outbound/easytier.go +++ b/adapter/outbound/easytier.go @@ -315,9 +315,21 @@ func (e *EasyTier) init() error { return err } log.Infoln("[EasyTier](%s) instance %s running", e.Name(), instance.ID()) + go e.drainHostPackets(instance) return nil } +// The outbound uses the core's netstack, not a host TUN device. Drain unused +// raw IP packets so the bounded host packet queue cannot stall the data plane. +// ReceivePacket unblocks when the instance closes or the adapter is canceled. +func (e *EasyTier) drainHostPackets(instance *corehost.Instance) { + for { + if _, err := instance.ReceivePacket(e.ctx); err != nil { + return + } + } +} + func (e *EasyTier) currentInstance() (*corehost.Instance, error) { e.mu.Lock() defer e.mu.Unlock()