Pre-match `drop` action breaks on `1.14.0-beta.13`
Operating system
Linux
System version
Fedora Linux 44.20260819.0 (Silverblue)
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.14.0-beta.13
Environment: go1.26.5 linux/amd64
Tags: with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale,with_ccm,with_ocm,with_cloudflared,with_naive_outbound,with_usbip,with_openvpn,with_openconnect,badlinkname,tfogo_checklinkname0,with_purego
Revision: 2dea956ea11ed9fdc47dc69fba56bea71c69ea9b
CGO: disabled
Description
So basically what's going on is: I'm using pre-match to make sure Happy Eyeballs works in an IPv4 only network. Everything works till 1.14.0-beta.12, however, starting from 1.14.0-beta.13, the rule no longer works.
Reproduction
Use the following configuration file:
config.json:
{
"log": {
"disabled": false,
"level": "trace",
"output": "box.log",
"timestamp": true
},
"dns": {
"servers": [
{
"tag": "local",
"type": "udp",
"server": "223.5.5.5"
}
],
"final": "local",
"strategy": "prefer_ipv4",
"disable_cache": false,
"disable_expire": false,
"reverse_mapping": true
},
"inbounds": [
{
"type": "tun",
"tag": "Tun-In",
"address": [
"172.19.0.1/30",
"fdfe:dcba:9876::1/126"
],
"auto_redirect": true,
"auto_route": true,
"strict_route": false
}
],
"outbounds": [
{
"type": "direct",
"tag": "direct"
}
],
"route": {
"rules": [
{
"type": "logical",
"mode": "and",
"rules": [
{
"ip_version": 6
},
{
"default_interface_address": [
"2000::/3"
],
"invert": true
}
],
"action": "reject",
"method": "drop"
},
{
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"ip_is_private": true,
"outbound": "direct"
}
],
"final": "direct",
"auto_detect_interface": true,
"override_android_vpn": false,
"find_process": true,
"default_domain_resolver": "local"
},
"experimental": {
"cache_file": {
"enabled": true
},
"clash_api": {
"external_controller": "127.0.0.1:9090",
"secret": "1145141919810"
}
}
}
With sing-box 1.14.0-beta.12:
❯ curl -I -v https://example.com
* Host example.com:443 was resolved.
* IPv6: 2606:4700:10::ac42:93f3, 2606:4700:10::6814:179a
* IPv4: 104.20.23.154, 172.66.147.243
* Trying [2606:4700:10::ac42:93f3]:443...
* Trying 104.20.23.154:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL Trust Anchors:
* CAfile: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519MLKEM768 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
* subject: CN=example.com
* start date: Jul 29 22:10:08 2026 GMT
* expire date: Oct 27 22:17:21 2026 GMT
* issuer: C=US; O=SSL Corporation; CN=Cloudflare TLS Issuing ECC CA 3
* Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA256
* Certificate level 1: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
* Certificate level 2: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* Certificate level 3: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* subjectAltName: "example.com" matches cert's "example.com"
* SSL certificate verified via OpenSSL.
* Established connection to example.com (104.20.23.154 port 443) from 192.168.1.233 port 46638
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://example.com/
* [HTTP/2] [1] [:method: HEAD]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: example.com]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.18.0]
* [HTTP/2] [1] [accept: */*]
> HEAD / HTTP/2
> Host: example.com
> User-Agent: curl/8.18.0
> Accept: */*
>
* Request completely sent off
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 200
HTTP/2 200
< content-type: text/html
content-type: text/html
< server: cloudflare
server: cloudflare
< last-modified: Tue, 18 Aug 2026 20:06:42 GMT
last-modified: Tue, 18 Aug 2026 20:06:42 GMT
< allow: GET, HEAD
allow: GET, HEAD
< accept-ranges: bytes
accept-ranges: bytes
<
* Connection #0 to host example.com:443 left intact
With sing-box 1.14.0-beta.13:
> curl -I -v https://example.com
* Host example.com:443 was resolved.
* IPv6: 2606:4700:10::6814:179a, 2606:4700:10::ac42:93f3
* IPv4: 172.66.147.243, 104.20.23.154
* Trying [2606:4700:10::6814:179a]:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL Trust Anchors:
* CAfile: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
* Recv failure: Connection reset by peer
* TLS connect error: error:00000000:lib(0)::reason(0)
* OpenSSL SSL_connect: Connection reset by peer in connection to example.com:443
* closing connection #0
curl: (35) Recv failure: Connection reset by peer
In the log section, 1.14.0-beta.13 shows match instead of pre-match in 1.14.0-beta.12.
Logs
With sing-box 1.14.0-beta.12:
+0000 2026-08-19 06:07:39 INFO network: updated default interface eno1, index 2
+0000 2026-08-19 06:07:39 TRACE inbound/tun[Tun-In]: creating stack
+0000 2026-08-19 06:07:39 INFO inbound/tun[Tun-In]: started at tun0
+0000 2026-08-19 06:07:39 INFO clash-api: restful api listening at 127.0.0.1:9090
+0000 2026-08-19 06:07:39 INFO sing-box started (0.03s)
+0000 2026-08-19 06:07:40 INFO [3141715309 0ms] inbound/tun[Tun-In]: inbound DNS packet from 172.19.0.1:41157
+0000 2026-08-19 06:07:40 DEBUG [3141715309 0ms] dns: exchange example.com. IN AAAA
+0000 2026-08-19 06:07:40 INFO [409588617 0ms] inbound/tun[Tun-In]: inbound DNS packet from 172.19.0.1:42391
+0000 2026-08-19 06:07:40 DEBUG [409588617 0ms] dns: exchange example.com. IN A
+0000 2026-08-19 06:07:40 DEBUG [3141715309 10ms] dns: exchanged example.com NOERROR 28
+0000 2026-08-19 06:07:40 INFO [3141715309 10ms] dns: exchanged AAAA example.com. 28 IN AAAA 2606:4700:10::ac42:93f3
+0000 2026-08-19 06:07:40 INFO [3141715309 10ms] dns: exchanged AAAA example.com. 28 IN AAAA 2606:4700:10::6814:179a
+0000 2026-08-19 06:07:40 INFO [3141715309 10ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 4096
+0000 2026-08-19 06:07:40 DEBUG [409588617 10ms] dns: exchanged example.com NOERROR 5
+0000 2026-08-19 06:07:40 INFO [409588617 10ms] dns: exchanged A example.com. 5 IN A 172.66.147.243
+0000 2026-08-19 06:07:40 INFO [409588617 10ms] dns: exchanged A example.com. 5 IN A 104.20.23.154
+0000 2026-08-19 06:07:40 INFO [409588617 10ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 4096
+0000 2026-08-19 06:07:41 INFO [3455252794 10ms] router: found process path: /usr/bin/curl, user: null
+0000 2026-08-19 06:07:41 DEBUG [3455252794 10ms] router: pre-match[0] ip_version=6 && !(default_interface_address=2000::/3) => reject(drop)
+0000 2026-08-19 06:07:41 INFO [3115130641 10ms] router: found process path: /usr/bin/curl, user: null
+0000 2026-08-19 06:07:41 DEBUG [3115130641 10ms] router: found reserve mapped domain: example.com
+0000 2026-08-19 06:07:41 DEBUG [3115130641 10ms] router: pre-match[1] => sniff
+0000 2026-08-19 06:07:41 INFO [3619210706 1ms] router: found process path: /usr/bin/curl, user: null
+0000 2026-08-19 06:07:41 DEBUG [3619210706 1ms] router: pre-match[1] => sniff
+0000 2026-08-19 06:07:41 INFO [582893369 0ms] inbound/tun[Tun-In]: inbound redirect connection from 192.168.1.233:46564
+0000 2026-08-19 06:07:41 INFO [582893369 0ms] inbound/tun[Tun-In]: inbound connection to 172.66.147.243:443
+0000 2026-08-19 06:07:41 INFO [582893369 0ms] router: found process path: /usr/bin/curl, user: null
+0000 2026-08-19 06:07:41 DEBUG [582893369 0ms] router: found reserve mapped domain: example.com
+0000 2026-08-19 06:07:41 DEBUG [582893369 0ms] router: match[1] => sniff
+0000 2026-08-19 06:07:41 DEBUG [582893369 1ms] router: sniffed protocol: tls, domain: example.com
+0000 2026-08-19 06:07:41 INFO [582893369 1ms] outbound/direct[direct]: outbound connection to 172.66.147.243:443
+0000 2026-08-19 06:07:44 DEBUG inbound/tun[Tun-In]: updating local address set to [127.0.0.1/8, ::1/128, 192.168.1.233/24]
+0000 2026-08-19 06:07:44 TRACE close http-client
+0000 2026-08-19 06:07:44 TRACE [814276110 5.17s] connection: connection upload closed
+0000 2026-08-19 06:07:44 TRACE close http-client completed (0.00s)
+0000 2026-08-19 06:07:44 TRACE [814276110 5.17s] connection: connection download closed
With sing-box 1.14.0-beta.13:
+0000 2026-08-19 06:07:02 INFO network: updated default interface eno1, index 2
+0000 2026-08-19 06:07:02 TRACE inbound/tun[Tun-In]: creating stack
+0000 2026-08-19 06:07:02 INFO inbound/tun[Tun-In]: started at tun0
+0000 2026-08-19 06:07:02 INFO clash-api: restful api listening at 127.0.0.1:9090
+0000 2026-08-19 06:07:02 INFO sing-box started (0.03s)
+0000 2026-08-19 06:07:06 INFO [3148386000 0ms] inbound/tun[Tun-In]: inbound DNS packet from 172.19.0.1:40391
+0000 2026-08-19 06:07:06 INFO [3148386000 2ms] router: found process path: /usr/lib/systemd/systemd-resolved, user id: 990
+0000 2026-08-19 06:07:06 DEBUG [3148386000 2ms] dns: exchange example.com. IN AAAA
+0000 2026-08-19 06:07:06 INFO [1412663479 0ms] inbound/tun[Tun-In]: inbound DNS packet from 172.19.0.1:39261
+0000 2026-08-19 06:07:06 INFO [1412663479 0ms] router: found process path: /usr/lib/systemd/systemd-resolved, user id: 990
+0000 2026-08-19 06:07:06 DEBUG [1412663479 0ms] dns: exchange example.com. IN A
+0000 2026-08-19 06:07:06 DEBUG [3148386000 13ms] dns: exchanged example.com NOERROR 62
+0000 2026-08-19 06:07:06 INFO [3148386000 13ms] dns: exchanged AAAA example.com. 62 IN AAAA 2606:4700:10::6814:179a
+0000 2026-08-19 06:07:06 INFO [3148386000 13ms] dns: exchanged AAAA example.com. 62 IN AAAA 2606:4700:10::ac42:93f3
+0000 2026-08-19 06:07:06 INFO [3148386000 13ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 4096
+0000 2026-08-19 06:07:06 DEBUG [1412663479 11ms] dns: exchanged example.com NOERROR 40
+0000 2026-08-19 06:07:06 INFO [1412663479 11ms] dns: exchanged A example.com. 40 IN A 172.66.147.243
+0000 2026-08-19 06:07:06 INFO [1412663479 11ms] dns: exchanged A example.com. 40 IN A 104.20.23.154
+0000 2026-08-19 06:07:06 INFO [1412663479 11ms] dns: exchanged OPT OPT PSEUDOSECTION: EDNS: version 0 flags: udp: 4096
+0000 2026-08-19 06:07:06 INFO [2431569118 0ms] inbound/tun[Tun-In]: inbound redirect connection from [fdfe:dcba:9876::1]:59338
+0000 2026-08-19 06:07:06 INFO [2431569118 0ms] inbound/tun[Tun-In]: inbound connection to [2606:4700:10::6814:179a]:443
+0000 2026-08-19 06:07:06 INFO [2431569118 9ms] router: found process path: /usr/bin/curl, user: null
+0000 2026-08-19 06:07:06 DEBUG [2431569118 9ms] router: found reserve mapped domain: example.com
+0000 2026-08-19 06:07:06 DEBUG [2431569118 9ms] router: match[0] ip_version=6 && !(default_interface_address=2000::/3) => reject(drop)
+0000 2026-08-19 06:07:06 DEBUG [2431569118 9ms] router: connection closed: rejected
+0000 2026-08-19 06:07:10 TRACE [3953504068 6.68s] connection: packet upload closed
+0000 2026-08-19 06:07:10 TRACE [3953504068 6.68s] connection: packet download closed
+0000 2026-08-19 06:07:10 DEBUG inbound/tun[Tun-In]: updating local address set to [127.0.0.1/8, ::1/128, 192.168.1.233/24]
+0000 2026-08-19 06:07:10 TRACE close http-client
+0000 2026-08-19 06:07:10 TRACE close http-client completed (0.00s)
+0000 2026-08-19 06:07:10 TRACE [302970380 7.56s] connection: connection download closed
+0000 2026-08-19 06:07:10 TRACE [302970380 7.56s] connection: connection upload closed
Supporter
- [ ] I am a sponsor
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.
~~Seems related #4463~~ Unrelated
I think this can be narrowed down much further.
The beta.12 → beta.13 regression window contains an especially useful dependency change:
v1.14.0-beta.12:
github.com/sagernet/sing-tun
v0.8.12-0.20260805001200-da24acaf4de3
v1.14.0-beta.13:
github.com/sagernet/sing-tun
v0.8.12-0.20260810013717-909ab10ad507
Those sing-tun revisions differ by exactly one commit:
909ab10ad507c93f3024554d6e6d1f81dd7aff0f
Fix nfqueue pre-match chain priorities and missing exclude rules
I think this is the regression point.
Why this looks like an interception-layer regression, not a route-rule regression
The reporter's beta.12 log contains:
pre-match[0] ... => reject(drop)
while beta.13 no longer shows that pre-match result.
Instead the flow reaches the TUN path and the same rule later matches as:
match[0] ... => reject(drop)
That distinction is important.
The actual route rule is therefore still valid.
Router.PreMatch() also still handles a matched:
*RuleActionReject
with ErrDrop as:
return adapter.PreMatchResult{
Action: adapter.PreMatchDrop,
}
So the semantic change occurs before normal routing: the local TCP SYN is no longer reaching the same pre-match/NFQUEUE path early enough.
The relevant sing-tun change
Before 909ab10, local output pre-match was installed at:
Priority:
nftables.ChainPriorityRef(
*nftables.ChainPriorityMangle - 1,
)
After 909ab10 it became:
Priority:
nftables.ChainPriorityRef(
*nftables.ChainPriorityMangle + 1,
)
At the same time the normal output redirect chain was moved from roughly:
mangle + 1
to:
mangle + 2
So pre-match still precedes sing-tun's own redirect chain, but it now runs on the other side of the standard mangle priority boundary.
That is a meaningful behavioral change for locally generated traffic.
The new output_prematch also starts with:
meta oifname == <tun interface>
=> return
so any routing/marking state visible after crossing that boundary can make the flow leave pre-match before reaching NFQUEUE.
That fits the observed transition:
beta.12
local IPv6 SYN
↓
OUTPUT pre-match
↓
NFQUEUE
↓
Router.PreMatch()
↓
reject(drop)
↓
no TUN connection
↓
curl/Happy-Eyeballs tries IPv4
versus:
beta.13
local IPv6 SYN
↓
early NFQUEUE path skipped
↓
auto_redirect / TUN path
↓
normal Router.matchRule()
↓
reject(drop)
↓
existing connection gets closed/reset
which explains why the same logical rule produces very different behavior.
The other changes in 909ab10 do not seem to explain this config
The commit also:
- adds exclude rules to the pre-match chains;
- changes the TCP SYN filtering layout;
- conditionally creates OUTPUT pre-match in mark mode;
- adds disabled-family filtering.
But for this reproducer:
- sing-box enables
AutoRedirectMarkModeon Linux whenauto_redirectis used; - both IPv4 and IPv6 are configured on the TUN;
- there are no UID/interface/route-exclude conditions explaining this destination;
- for an initial TCP SYN, the old and new TCP flag predicates are logically equivalent.
That leaves the OUTPUT pre-match ordering change as the important semantic difference for this case.
68037e9d in sing-box itself looks adjacent but not causal
beta.13 also contains:
68037e9d612ec5d88496b5cd6fa9b214e649c8b9
Fix process and neighbor rules not matched in pre-match
which changes Router.PreMatch() to run:
prepareMatchMetadata()
including process/neighbor lookup.
I initially suspected that commit, but I don't think it explains this issue.
prepareMatchMetadata() still sets:
metadata.IPVersion = 6
for an IPv6 destination, and DefaultInterfaceAddressItem.Match() does not depend on process metadata.
More importantly, the rule successfully matches later as normal match[0].
So the evidence points to the pre-match callback not being reached, rather than the rule becoming false inside Router.PreMatch().
Current testing
I also checked current sing-tun.
output_prematch is still installed at:
ChainPriorityMangle + 1
so I do not see the OUTPUT-side behavior reverted in current source.
There was a later correction for PREROUTING ordering:
1bd9bb8b83e8b239d220ba41ac333756367db31c
Fix prerouting pre-match chain evaluated after DNAT
which moves PREROUTING pre-match back before the NAT destination priority.
That does not change the OUTPUT pre-match priority involved here.
Suggested regression test
This should be reproducible without DNS complexity.
Use:
Linux
auto_route = true
auto_redirect = true
local TCP client
public IPv6 destination
with a rule whose pre-match conditions require no payload:
{
"type": "logical",
"mode": "and",
"rules": [
{
"ip_version": 6
},
{
"default_interface_address": [
"2000::/3"
],
"invert": true
}
],
"action": "reject",
"method": "drop"
}
Then assert:
initial local SYN
-> NFQUEUE JudgeFlow / Router.PreMatch
-> PreMatchDrop
-> no TUN connection created
A useful low-level confirmation on an affected machine would also be to compare the counters in:
output_prematch
especially:
oifname == tun => return
TCP SYN => queue
between the two versions.
If the first counter increments on beta.13 while the NFQUEUE counter does not, that would directly confirm where the local flow is escaping pre-match.
So my current classification is:
sing-tun 909ab10 changes the Linux nftables OUTPUT pre-match ordering; local reject(drop) rules that previously act on the initial SYN can miss NFQUEUE and only execute later after the connection has entered the TUN routing path.
I reproduced a similar issue with reject + no_drop: true: on an IPv4-only network with auto_redirect enabled, IPv6 TCP connections complete the local handshake before being reset.
The oif=TUN early-return rule skips prematch, which also skips bypass evaluation. Separately, NFQUEUE does not handle the ActionFlow verdict used by bridge, suggesting related L3 forwarding issues. The impact may therefore extend beyond reject(drop).
Fixed in 1.15.0-alpha.3. Closing.