1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 08:14:58 +03:00

Cedar: Make use of IP address reported by NAT-T server for UDP acceleration

Before this commit, the IP address reported by the NAT-T server was immediately discarded.
That's because the peer should be accessible via the IP address used to establish the TCP connection.

User "domosekai" (https://www.domosekai.com) pointed out that the NAT-T IP address should be taken into account.
In his case it's required due to his broadband carrier's NAT causing TCP and UDP to have different external IPs.

Co-authored-by: domosekai <54519668+domosekai@users.noreply.github.com>
This commit is contained in:
Davide Beatrici
2021-04-14 19:49:30 +02:00
parent 192083e7c4
commit d4d15b66d3
4 changed files with 172 additions and 114 deletions

View File

@ -3001,7 +3001,7 @@ bool ServerAccept(CONNECTION *c)
if (UdpAccelInitServer(s->UdpAccel,
s->UdpAccel->Version == 2 ? udp_acceleration_client_key_v2 : udp_acceleration_client_key,
&udp_acceleration_client_ip, udp_acceleration_client_port, &c->FirstSock->RemoteIP) == false)
&c->FirstSock->RemoteIP, &udp_acceleration_client_ip, udp_acceleration_client_port) == false)
{
Debug("UdpAccelInitServer Failed.\n");
s->UseUdpAcceleration = false;
@ -4987,8 +4987,8 @@ REDIRECTED:
if (UdpAccelInitClient(sess->UdpAccel,
sess->UdpAccel->Version == 2 ? udp_acceleration_server_key_v2 : udp_acceleration_server_key,
&udp_acceleration_server_ip, udp_acceleration_server_port,
server_cookie, client_cookie, &remote_ip) == false)
&remote_ip, &udp_acceleration_server_ip, udp_acceleration_server_port,
server_cookie, client_cookie) == false)
{
Debug("UdpAccelInitClient failed.\n");
}