Open siwliu-kernel opened 1 year ago
I've verified that openvpn works back fine after changing the above lines of code as indicated. I haven't checked if the other client for e.g. Windows, iOS or Android has similar issue. I'd leave it to @ssrlive to decide.
The ideal solution is to get the corresponding source address for the UDP response packet from the ssr-server, though. A target server could be multi-homed that the UDP response packet may not neccessarily come from the orginal IP address the UDP request was sent to.
A openvpn client has the following config in /etc/openvpn/client/client.conf:
Launch this openvpn client over SSRoT ends up with below error:
UDP socket 127.0.0.1:57477 was opened by openvpn client to get the response from openvpn server 111.111.111.111:1194 through ssr-client's udp relay:
The error reported by openvpn is because _udp_relay_senddata() doesn't fill _targetaddr to the DST.ADDR field (techinicallly it would be the source address for the original UDP packet where ssr-server had gotten in the first place) in udp relay header per the SOCKS5 RFC spec.
https://github.com/ShadowsocksR-Live/shadowsocksr-native/blob/81a95452ae681a90e672979905b80767e7e2c8f3/src/client/client.c#L1481-L1491
_targetaddr can be passed in _udp_relay_senddata() to replace s5addr: https://github.com/ShadowsocksR-Live/shadowsocksr-native/blob/b39d0cfe760232fa1cfc7824917b8373fc86acc6/src/udprelay.c#L600
_uv_udpsend() should still use _srcaddr as is: https://github.com/ShadowsocksR-Live/shadowsocksr-native/blob/b39d0cfe760232fa1cfc7824917b8373fc86acc6/src/udprelay.c#L605