shadowsocks / shadowsocks/shadowsocks-rust
UDP relay fails with "Operation not permitted (os error 1)" when sending response back to client
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 10.9k
- Forks
- 1.5k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 5
Description
UDP relay fails with "Operation not permitted (os error 1)" when sending response back to client
Describe the Bug
TCP works normally, but UDP relay does not.
The server successfully receives UDP packets from clients and also receives responses from upstream servers (for example DNS responses from 1.0.0.1:53), but fails when sending the UDP response back to the client.
The log repeatedly shows:
WARN udp failed to send back 43 bytes to client [::ffff:122.96.37.88]:40906, from target 1.0.0.1:53, error: Operation not permitted (os error 1)
From the log, it appears that:
- Client → Server UDP traffic succeeds.
- Server → Upstream UDP traffic succeeds.
- Upstream → Server UDP response succeeds.
- Server → Client UDP response fails with EPERM.
TCP traffic works normally.
Steps to reproduce
- Start
ssserverwith UDP enabled. - Connect using a Shadowsocks client with UDP enabled.
- Send DNS queries or any UDP traffic through the proxy.
- Observe server logs.
Expected behavior
UDP relay should work normally.
The server should forward UDP responses back to the client instead of reporting:
Operation not permitted (os error 1)
Actual behavior
The server receives upstream responses successfully but fails to send them back to the client.
Logs
INFO shadowsocks server 1.24.0
INFO shadowsocks tcp server listening on [::]:9999
INFO shadowsocks udp server listening on [::]:9999
WARN udp failed to send back 43 bytes to client [::ffff:122.96.37.88]:40906, from target 1.0.0.1:53, error: Operation not permitted (os error 1)
WARN udp failed to send back 43 bytes to client [::ffff:122.96.37.88]:13104, from target 1.0.0.1:53, error: Operation not permitted (os error 1)
WARN udp failed to send back 43 bytes to client [::ffff:122.96.37.88]:13105, from target 1.0.0.1:53, error: Operation not permitted (os error 1)
Environment
- shadowsocks-rust 1.24.0
- Linux 6.6.110
- OpenWrt / ImmortalWrt 24.10.4
- Server mode: TCP + UDP
- Cipher: chacha20-ietf-poly1305
Configuration:
{
"server": "::",
"server_port": 9999,
"mode": "tcp_and_udp",
"method": "chacha20-ietf-poly1305"
}
Also tested with:
{
"server": "0.0.0.0"
}
but the issue remains.
Additional Information
Verified:
- TCP works correctly.
- UDP requests reach the server.
- Upstream DNS responses are received successfully.
- The process has full capabilities (CAP_NET_ADMIN present).
- Changing listen address from
::to0.0.0.0does not help. - Restarting the service does not help.
The issue seems to happen only when ssserver attempts to send the UDP response back to the client.
Is this a known issue with UDP relay on Linux/OpenWrt, or could additional debugging information help identify the cause?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the UDP relay failure with the provided ssserver configuration on Linux/OpenWrt, then trace the relay path from the upstream response to the client send and inspect the IPv4-mapped client address; done means UDP responses reach the client without EPERM and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100