fix(tun): verify TUN interface up before marking ready (win32)#327
Merged
Conversation
Windows TUN 模式起核后正向验证 flowz-tun0 适配器出现,替代此前仅探测 管理 API 端口的就绪判定。修 dododook#324:sing-box 进程存活、mixed 代理正常但 TUN 网卡从未创建时,旧逻辑落入无限「正在自动重试」死循环。 - A1 起核后验适配器出现(waitForAdapterPresent,每腿独立验证),缺失= 本腿失败;probe 自身失败 fail-open;grace 轮询注入 isSuperseded,被 接管抛 CoreStartSupersededError、绝不 stopCore(守 dododook#176 纪律) - A2 就绪窗内并行 sticky 观测,重试预算耗尽且全程未见适配器→ CoreStartTunPersistentError 终态诊断,停误导性无限重试 - 仅 win32+TUN,macOS/Linux 零改动 真机验证 pending(Windows)。 Refs dododook#324
Collaborator
Author
|
本 PR 不关闭 #324。修复范围仅限 FlowZ 就绪判定缺口——TUN 未起来时旧逻辑落入误导性无限重试,改为正确检测 + 可操作诊断,并守 #176 双 TUN 释放竞态。 reporter 环境侧「TUN 起不来」的主因(wintun 加载失败 / 残留 flowz-tun0 适配器 / 冲突 VPN / 可能的 alpha 核回归)不在本 PR 修复范围。 关闭 #324 需先定位主因:请 reporter 在 设置 → 日志 → 诊断 开启诊断采集(logLevel 拉到 debug)复现后重导,抓 singbox.log 中 wintun / tun-in 错误行。内核已升级至 1.14.0-beta.1(#326)作候选缓解,待真机验证。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题(#324)
Windows 10 下 TUN 无法开启,
sing-box 启动期退出(TUN 初始化未完成),正在自动重试每 ~6s 无限循环、永不成功。诊断报告实证:sing-box 进程存活且 mixed 代理正常(youtube/cloudflare 经节点建连成功),但全程无
inbound/tun[tun-in]: started——TUN 网卡(flowz-tun0 / wintun)从未创建。旧就绪门只探管理 API 端口(非 TUN 接口真存在),无法区分「真起来」与「进程活但 TUN 没起」,落入误导性无限重试。改动
flowz-tun0适配器出现(waitForAdapterPresent,每腿独立验证),缺失=本腿失败;probe 自身失败(PowerShell 缺 / 被杀软拦)fail-open 放行;grace 轮询注入 isSuperseded,被接管抛CoreStartSupersededError、绝不 stopCore(守 [Bug] 新版本偶发性singbox进程重启新日志 #176 双 TUN 释放纪律)。CoreStartTunPersistentError终态诊断,停「正在自动重试」误导,给可操作提示(wintun / 杀软 / 冲突 VPN)。验证
本 PR 修的是 FlowZ 侧设计缺口(就绪门不验 TUN 接口 + 持续性失败当瞬态无限重试),把「假连接 / 误导性死循环」变成「正确检测 + 可操作诊断」。
但 reporter 实际 TUN 起不来的主因在其机器(wintun.dll 被杀软隔离 / 残留 adapter / 冲突 VPN / 或 alpha 核回归),本 PR 不直接修复该主因——需 reporter 开诊断采集(debug)重导抓 wintun 错误行确认。故暂不 Closes #324,待真机确认失败模式改善 + 主因定位后再定 issue 去留。
Refs #324