SagerNet / SagerNet/sing-box

Sing-box TUN choosing wrong adapter to connect

Open
#2,107 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
38.2k
Forks
4.6k
Avg merge
19d 15h
Merged PRs (30d)
1

Description

Operating system

Windows

System version

10

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.

NekoRay fork v4.1.4 by Mahdi-zarei, this issue was always persisted even in older "original" versions

Version

No response

Description

Sing-box TUN decision on what adapter to chose to connect is based ONLY on interface metric rather than checking metric and if adapter has Connected state.

Screenshot3995

Here router will chose adapter at index 12 or 15 (just lowest metric), rather than 7 (lowest metric for adapter with Connected state).

Reproduction

Windows sometime choose strange metrics and this leads to that. You can tune metrics manually and test.

Logs

No response

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows 10 TUN adapter-selection behavior with the reported NekoRay setup, varying interface metrics and connection states. Trace the entry point that chooses the adapter, then verify that an adapter with a Connected state is selected rather than one chosen only by the lowest metric. Confirm the behavior with a minimal reproducible configuration and relevant logs.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.