Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

[Probably fixed] server mode UDP relay not working #176

Open
andronoob opened this issue Mar 16, 2018 · 3 comments
Open

[Probably fixed] server mode UDP relay not working #176

andronoob opened this issue Mar 16, 2018 · 3 comments

Comments

@andronoob
Copy link

andronoob commented Mar 16, 2018

OS: Windows 7 SP1 x86
Running shadowsocks-libqss in server mode.
The client (a OpenWrt router) is using following iptables rule to redirect UDP packets (sent by hosts in LAN) to ss-redir:

iptables -t mangle -A PREROUTING -p udp -s [LAN IP RANGE] -p udp -j TPROXY --on-ip 0.0.0.0 --on-port [ss-redir listening port]

But, it didn't work. I got some error messages from ss-redir like this:

 2018-03-11 20:12:35 ERROR: [udp] remote_recv_bind: Address family not supported by protocol

ss-tunnel seemed to work (with a DNAT rule redirecting DNS requests to ss-tunnel), but, if I recalled correctly, it still had some weird problems, which were similar to the description on this post: https://www.v2ex.com/t/436361

shadowsocks-android didn't work, either, unless the "Enable UDP relay" feature was un-ticked.

Although I'm not a professional programmer, I've tried to skim over the code. After that, I thought the problem might be relevant to here:
https://github.com/shadowsocks/libQtShadowsocks/blob/master/lib/network/udprelay.cpp#L175
I then tried to replace Common::packAddress(r_addr, r_port) by destAddr (lambda captures are modified as well), then the re-compiled program seemed to work!

@ZhensJoke
Copy link

这是修复了UDP可用性的问题吗?

@librehat
Copy link
Contributor

librehat commented Apr 8, 2018

I haven't looked into the issue myself yet, can you compare the code of shadowsocks-libev or the python version? I might have implemented it wrong in the first place so it'd be great if that's the case and this can fix the UDP issue

@andronoob
Copy link
Author

@librehat To be honest, this "fix" is not perfect, too. It seemed that the server didn't release UDP sockets in time, which made the clients suffer from DNS timeouts.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants