-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rust server & libev client: UDP does not work #855
Comments
At least tell everybody how to reproduce. |
Case 1:
Client: libev 3.3.5
My router is with full cone NAT. with this setup:
Note: it can't be network issue since case2 work fine with UDP. I test with dota2 server. Case 1 cannot ping any server while case 2, case 3, case 4 can. I also test whether UDP works with nslookup and as you can see, case 1 does not work.
When UDP works (case2):
|
What did you see when using Case1 in |
case 1:Server: rust 1.15.0-alpha.4 a computer beneath router:
Server
xx.xx.xx.xx is the WAN ip of my router. case 2:Server: rust 1.15.0-alpha.4 a computer beneath router:
Server
xx.xx.xx.xx is the WAN ip of my router. case 3 & case 4I can confirm nslookup works. Since the server is libev not rust, it's not the focus of the issue. Differencein case 1, ssserver logs 1 record It looks like in case 1:
It's some interoperability issue. |
You should try to enable higher log level, for example The line So if you can see 2 lines of logs, then there must be 2 individual clients (or sockets) were created and send 2 UDP packets to And yes,
You should add |
Here you are: case 1:CLIENT -> libev ss-redir -> rust ssserver -> 8.8.8.8
case 2:CLIENT -> rust sslocal redir mode -> rust ssserver -> 8.8.8.8 rust sslocal redir mode setting:
xx.xx.xx.xx is my WAN IP. |
Ok, I know why. shadowsocks-rust uses IPv6 sockets for outbound, so the received address is always an IPv6 address. As you can see in the logs, shadowsocks-libev would then create a IPv6 socket and bind to The There are 2 possible solutions for this:
|
Glad you found the root cause. Yes, I've not enabled IPv6 on my local network but my proxy server has it enabled. So there's a mismatch. We should probably support IPv4 and IPv6 mixed scenarios. |
Did you actually see |
Sorry, I've not enabled log for libev. |
redir local will always use IPv6 sockets for sending back UDP packets. server will convert IPv4-mapped-IPv6 to IPv4 for maximum compatibilty. ref #855
These commits should fix this issue. |
any test build so I can help verify? |
ref shadowsocks/shadowsocks-rust#855 When receiving UDP packets from remote servers, Redir will have to create transparent sockets to bind() on those target addresses and then relay data back to the local client. Target addresses may be IPv4 or IPv6 addresses, so we may have to create that transprent sockets based on the target addresses' family. The most simpliest and easiest way is to always create IPv6 sockets and converts IPv4 binding addresses and peer addresses to IPv4-mapped-IPv6.
I can confirm the latest nightly build fixed case 1. Thanks for your hard work. |
ref shadowsocks/shadowsocks-rust#855 When receiving UDP packets from remote servers, Redir will have to create transparent sockets to bind() on those target addresses and then relay data back to the local client. Target addresses may be IPv4 or IPv6 addresses, so we may have to create that transprent sockets based on the target addresses' family. The most simpliest and easiest way is to always create IPv6 sockets and converts IPv4 binding addresses and peer addresses to IPv4-mapped-IPv6.
Case 1:
Server: rust 1.15.0-alpha.4
Client: libev 3.3.5
udp does not work
Case 2
Server: rust 1.15.0-alpha.4
Client: rust 1.14.3
udp works
Case 3:
Server: libev 3.3.5
Client: libev 3.3.5
udp works
Case 4:
Server: libev 3.3.5
Client: rust 1.14.3
udp works
The text was updated successfully, but these errors were encountered: