sing-box icon indicating copy to clipboard operation
sing-box copied to clipboard

1.12.3 DHCP bug

Open OneOhCloud opened this issue 1 year ago • 1 comments

Operating system

macOS

System version

15.6.1 (24G90)

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 unknown

Environment: go1.24.1 darwin/arm64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale
Revision: abf69fefbacf6b1234350cd2662d10c7c1af5415
CGO: enabled

Description

编译的版本是 51c1629da23753751796ca3666a6120d4112b49f ,

使用 dhcp 时候,在多次重启 sing-box 进程会遇到错误,ERROR[0000] dns/dhcp[system]: fetch DNS servers: listen udp4 0.0.0.0:68: bind: address already in use, 并且结束进程后可能需要等待很长一段时间才能恢复正常。

Reproduction

使用 ./sing-box run config.json 运行后等待1-2s 使用 Control + c 终止进程,快速循环此步骤多次即可复现。

{
    "log": {
        "disabled": false,
        "level": "info",
        "timestamp": false
    },
    "dns": {
        "servers": [
            {
                "tag": "system",
                "type": "dhcp"
            }
        ],
        "rules": [
            {
                "query_type": [
                    "HTTPS",
                    "SVCB",
                    "PTR"
                ],
                "action": "reject"
            }
        ],
        "strategy": "prefer_ipv4",
        "final": "system"
    },
    "inbounds": [
        {
            "tag": "mixed",
            "type": "mixed",
            "listen": "127.0.0.1",
            "listen_port": 6789,
            "sniff": true,
            "reuse_addr": true,
            "tcp_fast_open": true,
            "set_system_proxy": true
        }
    ],
    "route": {
        "rules": [
            {
                "action": "sniff"
            },
            {
                "type": "logical",
                "mode": "or",
                "rules": [
                    {
                        "protocol": "dns"
                    },
                    {
                        "port": 53
                    }
                ],
                "action": "hijack-dns"
            },
            {
                "protocol": "quic",
                "action": "reject"
            },
            {
                "ip_is_private": true,
                "outbound": "direct"
            }
        ],
        "final": "direct",
        "auto_detect_interface": true,
        "rule_set": []
    },
    "outbounds": [
        {
            "tag": "direct",
            "type": "direct",
            "domain_resolver": "system"
        }
    ]
}

Logs

INFO[0000] network: updated default interface en0, index 11
INFO[0000] dns/dhcp[system]: dhcp: query DNS servers on en0
ERROR[0000] dns/dhcp[system]: fetch DNS servers: listen udp4 0.0.0.0:68: bind: address already in use
INFO[0000] inbound/mixed[mixed]: tcp server started at 127.0.0.1:6789
INFO[0000] sing-box started (0.99s)
INFO[0009] [3817072852 0ms] inbound/mixed[mixed]: inbound connection from 127.0.0.1:54438
INFO[0009] [3817072852 0ms] inbound/mixed[mixed]: inbound connection to alive.github.com:443
INFO[0009] [3817072852 1ms] outbound/direct[direct]: outbound connection to alive.github.com:443
INFO[0009] dns/dhcp[system]: dhcp: query DNS servers on en0
INFO[0009] dns/dhcp[system]: dhcp: query DNS servers on en0
ERROR[0009] [3817072852 1ms] connection: open connection to alive.github.com:443 using outbound/direct[direct]: lookup alive.github.com: (exchange6: listen udp4 0.0.0.0:68: bind: address already in use | exchange4: listen udp4 0.0.0.0:68: bind: address already in use)

Supporter

Integrity requirements

  • [x] 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.
  • [x] 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.
  • [x] 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.
  • [x] 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.

OneOhCloud avatar Aug 27 '25 10:08 OneOhCloud

无法重现。

nekohasekai avatar Aug 27 '25 10:08 nekohasekai