Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailscale endpoint with detour option causes immediate panic during startup in 1.12.0-alpha.7 #2588

Open
4 of 5 tasks
rizutazu opened this issue Feb 13, 2025 · 1 comment
Open
4 of 5 tasks
Labels
bug Something isn't working

Comments

@rizutazu
Copy link

Operating system

Linux

System version

Linux localhost 6.13.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Sun, 02 Feb 2025 01:02:29 +0000 x86_64 GNU/Linux

Installation type

Original sing-box Command Line

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

No response

Version

sing-box version 1.12.0-alpha.7

Environment: go1.24.0 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_ech,with_utls,with_reality_server,with_acme,with_clash_api,with_tailscale
Revision: ba41c54d92708a18444517190367ee8152c77b6e
CGO: disabled

Description

Non-empty detour option (no matter whether it is a valid outbound) under tailscale endpoint causes immediate panic.

Reproduction

minimal reproduction configuration

{
    "dns": {
        "servers": [
            {
                "type": "tls",
                "tag": "dns-direct",
                "server": "223.5.5.5",
                "detour": "direct"
            },
            {
                "type": "tailscale",
                "tag": "ts-dns",
                "endpoint": "ts-ep",
                "accept_default_resolvers": true
            }
        ],
        "rules": [
        ]
    },
    "inbounds": [
        {
            "type": "tun",
            "tag": "tun-in",
            "address": "172.19.0.1/30",
            "auto_route": true
        }
    ],
    "outbounds": [
        {
            "type": "direct",
            "tag": "direct"
        }
    ],
    "endpoints": [
        {
            "type": "tailscale",
            "tag": "ts-ep",
            "state_directory": ".tailscale_test",
            "auth_key": "",
            "detour": "ww",
            "domain_resolver": "dns-direct"
        }
    ]
}

cmd: sing-box run -c config.json

Logs

INFO[0000] network: updated default interface wlp0s20f3, index 2
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] using fake (no-op) tun device
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] using fake (no-op) OS network configurator
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] using fake (no-op) DNS configurator
TRACE[0000] endpoint/tailscale[ts-ep]: dns: using dns.noopManager
TRACE[0000] endpoint/tailscale[ts-ep]: link state: interfaces.State{defaultRoute=wlp0s20f3 ifs={tun0:[172.19.0.1/30 llu6] wlp0s20f3:[192.168.10.110/24 llu6]} v4=true v6=false}
TRACE[0000] endpoint/tailscale[ts-ep]: onPortUpdate(port=45707, network=udp6)
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] warning: fakeRouter.UpdateMagicsockPort: not implemented.
TRACE[0000] endpoint/tailscale[ts-ep]: magicsock: [warning] failed to force-set UDP read buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE[0000] endpoint/tailscale[ts-ep]: magicsock: [warning] failed to force-set UDP write buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE[0000] endpoint/tailscale[ts-ep]: onPortUpdate(port=39245, network=udp4)
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] warning: fakeRouter.UpdateMagicsockPort: not implemented.
TRACE[0000] endpoint/tailscale[ts-ep]: magicsock: [warning] failed to force-set UDP read buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE[0000] endpoint/tailscale[ts-ep]: magicsock: [warning] failed to force-set UDP write buffer size to 7340032: operation not permitted; using kernel default values (impacts throughput only)
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE[0000] endpoint/tailscale[ts-ep]: magicsock: disco key = <>
TRACE[0000] endpoint/tailscale[ts-ep]: Creating WireGuard device...
TRACE[0000] endpoint/tailscale[ts-ep]: Bringing WireGuard device up...
TRACE[0000] endpoint/tailscale[ts-ep]: wg: [v2] UDP bind has been updated
TRACE[0000] endpoint/tailscale[ts-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - started
TRACE[0000] endpoint/tailscale[ts-ep]: wg: [v2] Routine: receive incoming mkReceiveFunc - started
TRACE[0000] endpoint/tailscale[ts-ep]: wg: [v2] Routine: receive incoming receiveDERP - started
TRACE[0000] endpoint/tailscale[ts-ep]: wg: [v2] Interface state was Down, requested Up, now Up
TRACE[0000] endpoint/tailscale[ts-ep]: Bringing router up...
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] warning: fakeRouter.Up: not implemented.
TRACE[0000] endpoint/tailscale[ts-ep]: Clearing router settings...
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] warning: fakeRouter.Set: not implemented.
TRACE[0000] endpoint/tailscale[ts-ep]: Starting network monitor...
TRACE[0000] endpoint/tailscale[ts-ep]: Engine created.
DEBUG[0000] endpoint/tailscale[ts-ep]: tsnet running state path /home/user/Documents/.tailscale_test/tailscaled.state
TRACE[0000] endpoint/tailscale[ts-ep]: pm: migrating "_daemon" profile to new format
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] netmap packet filter: (not ready yet)
DEBUG[0000] endpoint/tailscale[ts-ep]: tsnet starting with hostname "localhost", varRoot "/home/user/Documents/.tailscale_test"
TRACE[0000] endpoint/tailscale[ts-ep]: Start
TRACE[0000] endpoint/tailscale[ts-ep]: [vJSON]1{"Hostinfo":{"IPNVersion":"sing-box 1.12.0-alpha.7","BackendLogID":"0522b8c2d9beb47d2e1b8f56610f6a9dba478016dce9810f2817fb1abd4df68f","OS":"linux","OSVersion":"6.13.1-arch1-1","Container":false,"Distro":"arch","DistroVersion":"Arch Linux","Desktop":true,"Hostname":"localhost","Machine":"x86_64","GoArch":"amd64","GoArchVar":"v1","GoVersion":"go1.24.0","Userspace":true,"UserspaceRouter":true,"AppConnector":false}}
TRACE[0000] endpoint/tailscale[ts-ep]: generating new machine key
TRACE[0000] endpoint/tailscale[ts-ep]: machine key written to store
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] netmap packet filter: (not ready yet)
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] HostInfo: {"IPNVersion":"sing-box 1.12.0-alpha.7","BackendLogID":"0522b8c2d9beb47d2e1b8f56610f6a9dba478016dce9810f2817fb1abd4df68f","OS":"linux","OSVersion":"6.13.1-arch1-1","Container":false,"Distro":"arch","DistroVersion":"Arch Linux","Desktop":true,"Hostname":"localhost","Machine":"x86_64","GoArch":"amd64","GoArchVar":"v1","GoVersion":"go1.24.0","Userspace":true,"UserspaceRouter":true,"AppConnector":false}
TRACE[0000] endpoint/tailscale[ts-ep]: Backend: logs: be:0522b8c2d9beb47d2e1b8f56610f6a9dba478016dce9810f2817fb1abd4df68f fe:
TRACE[0000] endpoint/tailscale[ts-ep]: Switching ipn state NoState -> NeedsLogin (WantRunning=true, nm=false)
TRACE[0000] endpoint/tailscale[ts-ep]: blockEngineUpdates(true)
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] authRoutine: state:new; goal=nil paused=false
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] magicsock: peermtu: peer MTU status is false
TRACE[0000] endpoint/tailscale[ts-ep]: health(warnable=is-using-unstable-version): error: This is an unstable version of Tailscale meant for testing and development purposes. Please report any issues to Tailscale.
TRACE[0000] endpoint/tailscale[ts-ep]: wgengine: Reconfig: configuring userspace WireGuard config (with 0/0 peers)
TRACE[0000] endpoint/tailscale[ts-ep]: health(warnable=warming-up): error: Tailscale is starting. Please wait.
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] mapRoutine: state:new
TRACE[0000] endpoint/tailscale[ts-ep]: wgengine: Reconfig: configuring router
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] warning: fakeRouter.Set: not implemented.
TRACE[0000] endpoint/tailscale[ts-ep]: wgengine: Reconfig: configuring DNS
TRACE[0000] endpoint/tailscale[ts-ep]: dns: Set: {DefaultResolvers:[] Routes:{} SearchDomains:[] Hosts:0}
TRACE[0000] endpoint/tailscale[ts-ep]: dns: Resolvercfg: {Routes:{} Hosts:0 LocalDomains:[]}
TRACE[0000] endpoint/tailscale[ts-ep]: dns: OScfg: {}
TRACE[0000] endpoint/tailscale[ts-ep]: [v1] wgengine: Reconfig done
DEBUG[0000] endpoint/tailscale[ts-ep]: LocalBackend state is NeedsLogin; running StartLoginInteractive...
TRACE[0000] endpoint/tailscale[ts-ep]: StartLoginInteractiveAs(""): url=false
TRACE[0000] endpoint/tailscale[ts-ep]: control: client.Login(10)
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] mapRoutine: context done.
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] mapRoutine: state:new
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] authRoutine: context done.
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] authRoutine: state:new; wantLoggedIn=true
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] direct.TryLogin(flags=10)
TRACE[0000] endpoint/tailscale[ts-ep]: control: LoginInteractive -> regen=true
TRACE[0000] endpoint/tailscale[ts-ep]: control: doLogin(regen=true, hasUrl=false)
TRACE[0000] endpoint/tailscale[ts-ep]: control: client.Shutdown ...
TRACE[0000] endpoint/tailscale[ts-ep]: control: updateRoutine: exiting
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] mapRoutine: context done.
TRACE[0000] endpoint/tailscale[ts-ep]: control: [v1] TryLogin: fetch control key: Get "https://controlplane.tailscale.com/key?v=109": context canceled
TRACE[0000] endpoint/tailscale[ts-ep]: control: authRoutine: exiting
TRACE[0000] endpoint/tailscale[ts-ep]: control: mapRoutine: exiting
panic: interface conversion: *dialer.DetourDialer is not dialer.ResolveDialer: missing method QueryOptions

        runtime/debug.Stack()
                runtime/debug/stack.go:26 +0x5e
        github.com/sagernet/tailscale/util/singleflight.newPanicError({0x1a0d180, 0xc000459800})
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:49 +0x25
        github.com/sagernet/tailscale/util/singleflight.(*Group[...]).doCall.func2.1()
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:290 +0x34
        panic({0x1a0d180?, 0xc000459800?})
                runtime/panic.go:787 +0x132
        github.com/sagernet/sing-box/protocol/tailscale.NewEndpoint.func3({0x20659e8, 0xc0004082a0}, {0xc000052260, 0x1a})
                github.com/sagernet/sing-box/protocol/tailscale/endpoint.go:145 +0xb9
        github.com/sagernet/tailscale/net/dnscache.(*Resolver).lookupIP(0xc00023a780, {0x2065978, 0xc000486140}, {0xc000052260, 0x1a})
                github.com/sagernet/[email protected]/net/dnscache/dnscache.go:290 +0x198
        github.com/sagernet/tailscale/net/dnscache.(*Resolver).LookupIP.func1({0x2065978?, 0xc000486140?})
                github.com/sagernet/[email protected]/net/dnscache/dnscache.go:219 +0x5f
        github.com/sagernet/tailscale/util/singleflight.(*Group[...]).DoChanContext.func1()
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:195 +0x49
        github.com/sagernet/tailscale/util/singleflight.(*Group[...]).doCall.func2(0xc000452aa0, 0x14, 0x149bb00?)
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:295 +0x6e
        github.com/sagernet/tailscale/util/singleflight.(*Group[...]).doCall(0xc00017a420?, 0xc00029d380?, {0xc000052260?, 0xc0001423d0?}, 0x0?)
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:297 +0xa5
        created by github.com/sagernet/tailscale/util/singleflight.(*Group[...]).DoChanContext in goroutine 225
                github.com/sagernet/[email protected]/util/singleflight/singleflight.go:194 +0x45f


goroutine 228 [running]:
github.com/sagernet/tailscale/util/singleflight.(*Group[...]).doCall.func1.gowrap2()
        github.com/sagernet/[email protected]/util/singleflight/singleflight.go:264 +0x25
created by github.com/sagernet/tailscale/util/singleflight.(*Group[...]).doCall.func1 in goroutine 226
        github.com/sagernet/[email protected]/util/singleflight/singleflight.go:264 +0x2d8

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.
@nekohasekai nekohasekai added the bug Something isn't working label Feb 14, 2025
@drove5065
Copy link

udp 流量(如hysteria)也无法正常通过Tailscale到达另一台设备。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants