-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Operating system
Windows
System version
Windows 11 26100.2454
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.11.0-beta.8
Environment: go1.23.4 windows/amd64
Tags: with_gvisor,with_dhcp,with_clash_api,with_quic,with_utls
Revision: 8a138e34ccac59295e90a3885e8225631aa26311
CGO: disabled
Description
Since the route refactoring of v1.11, SOCKS5 UDP can't be route correctly. Previously only scenario in #1370 is affected, but this gets worse since version 1.11.
https://github.com/SagerNet/sing/blob/809d8eca139712f6c833cea813674a1cb1154ba5/protocol/socks/handshake.go#L270
A line of destination = request.Destination
is missing. However, this violated related RFCs, and a correct fix should always fill the destination with 0.0.0.0:0
as described in #1370.
Lines 464 to 475 in 8a138e3
if !preMatch && metadata.Destination.Addr.IsUnspecified() { | |
newBuffer, newPacketBuffers, newErr := r.actionSniff(ctx, metadata, &rule.RuleActionSniff{}, inputConn, inputPacketConn) | |
if newErr != nil { | |
fatalErr = newErr | |
return | |
} | |
if newBuffer != nil { | |
buffers = append(buffers, newBuffer) | |
} else if len(newPacketBuffers) > 0 { | |
packetBuffers = append(packetBuffers, newPacketBuffers...) | |
} | |
} |
These lines are for handling 0.0.0.0:0
, but they should be moved to a location before :match
.
Line 368 in 8a138e3
match: |
Reproduction
Use software that support SOCKS5 UDP ASSOCIATE to test. e.g. configure NATTypeTester to use SOCKS5 proxy 127.0.0.1:1080
and do UDP STUN test.
{
"log": {
"level": "debug"
},
"inbounds": [
{
"type": "socks",
"listen": "127.0.0.1",
"listen_port": 1080,
}
],
"outbounds": [
{
"type": "direct"
}
],
"route": {
"rules": [
{
"ip_cidr": [
"0.0.0.0/0"
],
"action": "reject"
}
]
}
}
Logs
>sing-box.exe run -c config.json
INFO[0000] network: updated default interface WLAN, index 15
INFO[0000] inbound/socks[0]: tcp server started at 127.0.0.1:1080
INFO[0000] sing-box started (0.11s)
INFO[0021] [4133872565 0ms] inbound/socks[0]: inbound connection from 127.0.0.1:62351
INFO[0021] [4133872565 15ms] inbound/socks[0]: inbound packet connection to :0
INFO[0021] [4133872565 15ms] outbound/direct[0]: outbound packet connection
INFO[0043] [564257197 0ms] inbound/socks[0]: inbound connection from 127.0.0.1:62470
INFO[0043] [564257197 14ms] inbound/socks[0]: inbound packet connection to :0
INFO[0043] [564257197 14ms] outbound/direct[0]: outbound packet connection
Supporter
- I am a sponsor
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.