From eccdcee07305dd425a5b94547883687c5334f76d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 11 Jul 2026 15:27:57 +0800 Subject: [PATCH] Fix probe GSO --- tun_linux.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tun_linux.go b/tun_linux.go index 071c2fc..46ee465 100644 --- a/tun_linux.go +++ b/tun_linux.go @@ -289,6 +289,17 @@ func (t *NativeTun) Name() (string, error) { } func (t *NativeTun) Start() error { + if t.options.FileDescriptor == 0 { + if !t.options.EXP_ExternalConfiguration { + t.options.InterfaceMonitor.RegisterMyInterface(t.options.Name) + } + err := t.start() + if err != nil { + return err + } + } + // The kernel rejects writes with EIO while the device is not up (tun_get_user), + // so the probe must run after LinkSetUp. if t.vnetHdr && t.gro.canTCPGRO() { err := t.probeTCPGRO() if err != nil { @@ -299,12 +310,10 @@ func (t *NativeTun) Start() error { } } } - if t.options.FileDescriptor != 0 { - return nil - } - if !t.options.EXP_ExternalConfiguration { - t.options.InterfaceMonitor.RegisterMyInterface(t.options.Name) - } + return nil +} + +func (t *NativeTun) start() error { tunLink, err := netlink.LinkByName(t.options.Name) if err != nil { return E.Cause(err, "find tun interface")