Skip to content

多网卡环境下,永久路由网关不可达时,auto_detect_interface 首次启动失败且无 fallback 机制 #4143

@ygao9999

Description

@ygao9999

Operating system

Windows

System version

7.22

Installation type

Third-party graphical clients that advertise themselves as using sing-box (Windows)

If you are using a graphical client, please provide the version of the client.

No response

Version

Description

sing-box Bug 总结
环境:

Windows 10
多网卡环境:有线网卡(断开)+ USB热点网卡
有一条永久路由指向不可达网关 192.168.20.1
实际出口是移动热点(无默认网关)
V2RayN 7.22.1 + sing-box,启用 TUN 模式,auto_detect_interface: true

Reproduction

Bug 现象:
第一次启动 TUN 必定失败:
ERROR network: missing default interface
FATAL: start inbound/tun[tun-in]: configure tun interface: Cannot create a file when that file already exists.
第二次启动成功。

根本原因:
auto_detect_interface 探测默认接口时,找到了永久路由指向的不可达网关 192.168.20.1,探测失败后直接退出,没有 fallback 到其他可用接口。
第二次成功是因为第一次失败后 TUN 接口文件已残留,第二次启动直接使用残留接口,绕过了有问题的探测逻辑。

期望行为:
auto_detect_interface 应该遍历所有网络接口,跳过不可达的,选择实际可用的接口,而不是遇到第一个失败就退出。

Logs

Supporter

Integrity requirements

  • I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
  • I confirm that I have provided the server and client configuration files and process that can be reproduced locally, instead of a complicated client configuration file that has been stripped of sensitive data.
  • I confirm that I have provided the simplest configuration that can be used to reproduce the error I reported, instead of depending on remote servers, TUN, graphical interface clients, or other closed-source software.
  • I confirm that I have provided the complete configuration files and logs, rather than just providing parts I think are useful out of confidence in my own intelligence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions