From 9002a4fed399bc77277ceccf9633db1f4a509af7 Mon Sep 17 00:00:00 2001 From: Chikage0o0 <89348590+Chikage0o0@users.noreply.github.com> Date: Thu, 5 Nov 2026 21:41:32 +0800 Subject: [PATCH] fix: easytier drain unused host packets to prevent data-plane stalls (#3400) Consume raw host/TUN packet egress for each running instance so the bounded EasyTier packet sink cannot backpressure the data plane. Stop receiving when the instance closes or the adapter is canceled, and document packet ownership. --- adapter/outbound/easytier.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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()