Skip to content

Commit b09e032

Browse files
committed
Fix compatibility with MPTCP
1 parent 609bd63 commit b09e032

File tree

6 files changed

+43
-3
lines changed

6 files changed

+43
-3
lines changed

docs/configuration/inbound/tun.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
icon: material/new-box
33
---
44

5+
!!! quote "Changes in sing-box 1.13.0"
6+
7+
:material-plus: [exclude_mptcp](#exclude_mptcp)
8+
59
!!! quote "Changes in sing-box 1.12.0"
610

711
:material-plus: [loopback_address](#loopback_address)
@@ -63,6 +67,7 @@ icon: material/new-box
6367
"auto_redirect": true,
6468
"auto_redirect_input_mark": "0x2023",
6569
"auto_redirect_output_mark": "0x2024",
70+
"exclude_mptcp": false,
6671
"loopback_address": [
6772
"10.7.0.1"
6873
],
@@ -278,6 +283,20 @@ Connection output mark used by `auto_redirect`.
278283

279284
`0x2024` is used by default.
280285

286+
#### exclude_mptcp
287+
288+
!!! question "Since sing-box 1.13.0"
289+
290+
!!! quote ""
291+
292+
Only supported on Linux with nftables and requires `auto_route` and `auto_redirect` enabled.
293+
294+
MPTCP cannot be transparently proxied due to protocol limitations.
295+
296+
Such traffic is usually created by Apple systems.
297+
298+
When enabled, MPTCP connections will bypass sing-box and connect directly, otherwise, will be rejected to avoid errors by default.
299+
281300
#### loopback_address
282301

283302
!!! question "Since sing-box 1.12.0"

docs/configuration/inbound/tun.zh.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
icon: material/new-box
33
---
44

5+
!!! quote "sing-box 1.13.0 中的更改"
6+
7+
:material-plus: [exclude_mptcp](#exclude_mptcp)
8+
59
!!! quote "sing-box 1.12.0 中的更改"
610

711
:material-plus: [loopback_address](#loopback_address)
@@ -63,6 +67,7 @@ icon: material/new-box
6367
"auto_redirect": true,
6468
"auto_redirect_input_mark": "0x2023",
6569
"auto_redirect_output_mark": "0x2024",
70+
"exclude_mptcp": false,
6671
"loopback_address": [
6772
"10.7.0.1"
6873
],
@@ -277,6 +282,20 @@ tun 接口的 IPv6 前缀。
277282

278283
默认使用 `0x2024`
279284

285+
#### exclude_mptcp
286+
287+
!!! question "自 sing-box 1.13.0 起"
288+
289+
!!! quote ""
290+
291+
仅支持 Linux,且需要 nftables,`auto_route` 和 `auto_redirect` 已启用。
292+
293+
由于协议限制,MPTCP 无法被透明代理。
294+
295+
此类流量通常由 Apple 系统创建。
296+
297+
启用时,MPTCP 连接将绕过 sing-box 直接连接,否则,将被拒绝以避免错误。
298+
280299
#### loopback_address
281300

282301
!!! question "自 sing-box 1.12.0 起"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ require (
3333
github.com/sagernet/sing-shadowsocks v0.2.8
3434
github.com/sagernet/sing-shadowsocks2 v0.2.1
3535
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
36-
github.com/sagernet/sing-tun v0.8.0-beta.10
36+
github.com/sagernet/sing-tun v0.8.0-beta.10.0.20251017082645-b49e63f8efdb
3737
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1
3838
github.com/sagernet/smux v1.5.34-mod.2
3939
github.com/sagernet/tailscale v1.86.5-sing-box-1.13-mod.4

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnq
171171
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
172172
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
173173
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
174-
github.com/sagernet/sing-tun v0.8.0-beta.10 h1:sHqSXTvzKPDF67AwZdoBV5FA91tFdWGfA1AbenIbpA4=
175-
github.com/sagernet/sing-tun v0.8.0-beta.10/go.mod h1:eWETzl4AwaxGKiZTpDIDVJLTBz9cfIdoZwaZY1jlSjg=
174+
github.com/sagernet/sing-tun v0.8.0-beta.10.0.20251017082645-b49e63f8efdb h1:iHbtERRIZ8Tf2uzghiDioc13LYfxhZcjKtNn9zh2DRo=
175+
github.com/sagernet/sing-tun v0.8.0-beta.10.0.20251017082645-b49e63f8efdb/go.mod h1:eWETzl4AwaxGKiZTpDIDVJLTBz9cfIdoZwaZY1jlSjg=
176176
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1 h1:aSwUNYUkVyVvdmBSufR8/nRFonwJeKSIROxHcm5br9o=
177177
github.com/sagernet/sing-vmess v0.2.8-0.20250909125414-3aed155119a1/go.mod h1:P11scgTxMxVVQ8dlM27yNm3Cro40mD0+gHbnqrNGDuY=
178178
github.com/sagernet/smux v1.5.34-mod.2 h1:gkmBjIjlJ2zQKpLigOkFur5kBKdV6bNRoFu2WkltRQ4=

option/tun.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ type TunInboundOptions struct {
2020
AutoRedirect bool `json:"auto_redirect,omitempty"`
2121
AutoRedirectInputMark FwMark `json:"auto_redirect_input_mark,omitempty"`
2222
AutoRedirectOutputMark FwMark `json:"auto_redirect_output_mark,omitempty"`
23+
ExcludeMPTCP bool `json:"exclude_mptcp,omitempty"`
2324
LoopbackAddress badoption.Listable[netip.Addr] `json:"loopback_address,omitempty"`
2425
StrictRoute bool `json:"strict_route,omitempty"`
2526
RouteAddress badoption.Listable[netip.Prefix] `json:"route_address,omitempty"`

protocol/tun/inbound.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
203203
IPRoute2RuleIndex: ruleIndex,
204204
AutoRedirectInputMark: inputMark,
205205
AutoRedirectOutputMark: outputMark,
206+
ExcludeMPTCP: options.ExcludeMPTCP,
206207
Inet4LoopbackAddress: common.Filter(options.LoopbackAddress, netip.Addr.Is4),
207208
Inet6LoopbackAddress: common.Filter(options.LoopbackAddress, netip.Addr.Is6),
208209
StrictRoute: options.StrictRoute,

0 commit comments

Comments
 (0)