Skip to content

Conversation

@CatMe0w
Copy link

@CatMe0w CatMe0w commented Dec 23, 2025

When a deprecated feature is used after its scheduled removal, sing-box used to panic with an internal name (e.g. invalid deprecated note: bad-match-source), which confused end users.

This change makes the panic message match the deprecation notice style, so users immediately know what to change.

Full log, using sing-box version 1.12.13:

panic: invalid deprecated note: bad-match-source

goroutine 1 [running]:
github.com/sagernet/sing-box/experimental/deprecated.Note.Impending({{0x1c553b8, 0x10}, {0x1c75793, 0x1d}, {0x1c44371, 0x6}, {0x1c44377, 0x6}, {0x1c553c8, 0x10}, ...})
        github.com/sagernet/sing-box/experimental/deprecated/constants.go:33 +0x245
github.com/sagernet/sing-box/experimental/deprecated.(*stderrManager).ReportDeprecated(0xc0002c0798, {{0x1c553b8, 0x10}, {0x1c75793, 0x1d}, {0x1c44371, 0x6}, {0x1c44377, 0x6}, {0x1c553c8, ...}, ...})
        github.com/sagernet/sing-box/experimental/deprecated/stderr.go:27 +0x9c
github.com/sagernet/sing-box/experimental/deprecated.Report({0x1fb0138?, 0xc000394370?}, {{0x1c553b8, 0x10}, {0x1c75793, 0x1d}, {0x1c44371, 0x6}, {0x1c44377, 0x6}, ...})
        github.com/sagernet/sing-box/experimental/deprecated/manager.go:18 +0x59
github.com/sagernet/sing-box/route/rule.NewDefaultRule({_, _}, {_, _}, {{{0xc0003a00b0, 0x1, 0x1}, 0x0, {0x0, 0x0, ...}, ...}, ...})
        github.com/sagernet/sing-box/route/rule/rule_default.go:257 +0x4565
github.com/sagernet/sing-box/route/rule.NewRule({_, _}, {_, _}, {{0x1c45c45, 0x7}, {{{0xc0003a00b0, 0x1, 0x1}, 0x0, ...}, ...}, ...}, ...)
        github.com/sagernet/sing-box/route/rule/rule_default.go:28 +0x359
github.com/sagernet/sing-box/route.(*Router).Initialize(0xc0003a2240, {0xc00039a008?, 0x4, 0x1fc3fb8?}, {0xc00030a900, 0x2, 0x2?})
        github.com/sagernet/sing-box/route/router.go:66 +0xfe
github.com/sagernet/sing-box.New({{{0xc000331000, 0x86d, 0xe00}, {0x0, 0x0}, 0xc00033f4a0, 0xc0002c8780, 0x0, 0x0, {0x0, ...}, ...}, ...})
        github.com/sagernet/sing-box/box.go:196 +0x1605
main.create()
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:137 +0x1f8
main.run()
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:174 +0x105
main.init.func26(0xc00030a100?, {0x1c4241f?, 0x4?, 0x1c42423?})
        github.com/sagernet/sing-box/cmd/sing-box/cmd_run.go:30 +0x17
github.com/spf13/cobra.(*Command).execute(0x2e849e0, {0xc0002d37c0, 0x4, 0x4})
        github.com/spf13/cobra@v1.9.1/command.go:1019 +0xae7
github.com/spf13/cobra.(*Command).ExecuteC(0x2e7fce0)
        github.com/spf13/cobra@v1.9.1/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.9.1/command.go:1071
main.main()
        github.com/sagernet/sing-box/cmd/sing-box/main.go:8 +0x1e

Zephyruso and others added 30 commits December 21, 2025 22:54
We mistakenly believed that `libresolv`'s `search` function worked correctly in NetworkExtension, but it seems only `getaddrinfo` does.

This commit changes the behavior of the `local` DNS server in NetworkExtension to prefer DHCP, falling back to `getaddrinfo` if DHCP servers are unavailable.

It's worth noting that `prefer_go` does not disable DHCP since it respects Dial Fields, but `getaddrinfo` does the opposite. The new behavior only applies to NetworkExtension, not to all scenarios (primarily command-line binaries) as it did previously.

In addition, this commit also improves the DHCP DNS server to use the same robust query logic as `local`.
We do not have the `com.apple.developer.networking.multicast` entitlement and are unable to obtain it for non-technical reasons.
@nekohasekai nekohasekai force-pushed the dev-next branch 16 times, most recently from e6856a6 to be2635b Compare December 30, 2025 19:20
@nekohasekai nekohasekai force-pushed the dev-next branch 6 times, most recently from fae949a to 1ee0b39 Compare January 7, 2026 10:46
@nekohasekai nekohasekai force-pushed the dev-next branch 6 times, most recently from 643057e to 5f4eee9 Compare January 15, 2026 02:42
@nekohasekai nekohasekai force-pushed the dev-next branch 2 times, most recently from 1a353ba to 5ae7436 Compare January 16, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants