Skip to content

fix(client): restore startup with sing-box 1.14 and VPN-routed nodes - #673

Open
coolsnowwolf wants to merge 2 commits into
immortalwrt:masterfrom
coolsnowwolf:fix/singbox-1.14-client-startup
Open

coolsnowwolf wants to merge 2 commits into
immortalwrt:masterfrom
coolsnowwolf:fix/singbox-1.14-client-startup

Conversation

@coolsnowwolf

Copy link
Copy Markdown

Problem

After upgrading to sing-box 1.14.2, HomeProxy fails its client configuration check because it still generates legacy inbound sniff and sniff_override_destination fields. These fields were removed in sing-box 1.13.

After fixing configuration decoding, a second startup failure was reproduced with a SOCKS node reachable through a VPN. Automatic interface detection binds outgoing connections to the default WAN interface instead of following the more specific VPN route. Initial remote rule-set downloads then time out and sing-box exits, even though the same node works through the system routing table.

Change

Two commits address the independently reproduced failures:

  • Move sniffing to a route action immediately after the DNS hijack rule, remove obsolete DNS cache options and their unused UCI reads, and remove invalid action fields from default_domain_resolver.
  • Skip automatic interface binding when self_mark already exempts outgoing sockets from interception, allowing system routes to reach VPN-hosted nodes. Explicit interface selection and automatic detection without a self mark remain available.

The configuration migration was informed by #671. Its override_destination field was tested on the installed sing-box 1.14.2 and rejected with route.rules[1].override_destination: json: unknown field "override_destination". This PR therefore uses the supported route sniff action with a 300 ms timeout. Sniffed metadata remains available for routing, but the old destination-override behavior is not retained. Server ACME migration and Snell support are outside this client startup fix.

Validation

Tested on an AX5 running QSDK/OpenWrt with sing-box 1.14.2, using bypass_mainland_china, redirect_tproxy, and a SOCKS node reached over a VPN.

  • Reproduced the original configuration rejection and the subsequent rule-set download timeout.
  • Confirmed that connecting to the node while bound to WAN times out, while connecting through its VPN interface succeeds.
  • Generated the client configuration with ucode and passed sing-box check.
  • Started HomeProxy through its init script and verified the actual sing-box instance remains running under procd, with DNS, mixed, redirect and TProxy listeners present.
  • Resolved domestic and overseas domains through the router's DNS service.
  • Received HTTP 204 from Google's connectivity endpoint through HomeProxy's SOCKS listener and through transparent proxying from both the router and a LAN client.
  • Verified that the HomeProxy UCI configuration checksum is unchanged.
  • Ran the exact PR generator on the router: it produces the same configuration checksum as the deployed fix and passes sing-box check.
  • Passed git diff --check.

The upstream generator at edece28 is identical to the tested downstream baseline. Validation covers the active client configuration; custom routing, TUN modes, server configurations, reboot behavior and a full upstream firmware build were not tested. Existing 1.16 deprecation warnings are not addressed by this fix.

Replace legacy inbound sniff fields with a route sniff action after DNS hijacking. Remove obsolete DNS cache options and invalid action fields from the default domain resolver.

Keep sniffing for routing without destination override: the installed sing-box 1.14.2 rejects override_destination in a sniff action.

Signed-off-by: coolsnowwolf <coolsnowwolf@gmail.com>
Automatic interface detection binds outgoing connections to the default WAN interface. This prevents reaching a proxy node through a more specific VPN route and can make initial remote rule-set downloads fail.

Skip automatic interface binding when self_mark already exempts outgoing sockets from interception. Preserve explicit interface selection and automatic detection when no self mark is configured.

Signed-off-by: coolsnowwolf <coolsnowwolf@gmail.com>
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.

2 participants