Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/SoftEtherVPN_Stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-11-18 06:05:48 +0300
committerdnobori <da.git@softether.co.jp>2014-11-18 06:05:48 +0300
commit75f9836ce5f0a1dea2c3fe304bbc26c962ee64bf (patch)
tree2cb9d8360aa6f5fb7dd38eb9938aa24a2df3bfeb /src/Cedar/UdpAccel.c
parent2b3a4d0b757e3c46f175c0a0df66a84ffbe2b39c (diff)
v4.12-9514-beta
Diffstat (limited to 'src/Cedar/UdpAccel.c')
-rw-r--r--src/Cedar/UdpAccel.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Cedar/UdpAccel.c b/src/Cedar/UdpAccel.c
index ccdc8e02..0e592e81 100644
--- a/src/Cedar/UdpAccel.c
+++ b/src/Cedar/UdpAccel.c
@@ -1034,6 +1034,11 @@ UDP_ACCEL *NewUdpAccel(CEDAR *cedar, IP *ip, bool client_mode, bool random_port,
a->IsIPv6 = IsIP6(ip);
+ if (a->IsIPv6)
+ {
+ a->NoNatT = true;
+ }
+
a->RecvBlockQueue = NewQueue();
Rand(a->NextIv, sizeof(a->NextIv));
@@ -1088,6 +1093,8 @@ void NatT_GetIpThread(THREAD *thread, void *param)
{
UDP_ACCEL *a;
char hostname[MAX_SIZE];
+ static IP dummy_ip = {0};
+ UINT num_retry = 0;
// Validate arguments
if (thread == NULL || param == NULL)
{
@@ -1096,11 +1103,17 @@ void NatT_GetIpThread(THREAD *thread, void *param)
a = (UDP_ACCEL *)param;
- RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), NULL);
+ if (IsZeroIP(&dummy_ip))
+ {
+ SetIP(&dummy_ip, 11, Rand8(), Rand8(), Rand8());
+ }
+
+ RUDPGetRegisterHostNameByIP(hostname, sizeof(hostname), &dummy_ip);
while (a->NatT_Halt == false)
{
IP ip;
+ UINT wait_time = UDP_NAT_T_GET_IP_INTERVAL;
// Get the IP address
bool ret = GetIP4Ex(&ip, hostname, 0, &a->NatT_Halt);
@@ -1125,7 +1138,11 @@ void NatT_GetIpThread(THREAD *thread, void *param)
}
// Fail to get
- Wait(a->NatT_HaltEvent, UDP_NAT_T_GET_IP_INTERVAL);
+ num_retry++;
+
+ wait_time = (UINT)(MIN((UINT64)UDP_NAT_T_GET_IP_INTERVAL * (UINT64)num_retry, (UINT64)UDP_NAT_T_GET_IP_INTERVAL_MAX));
+
+ Wait(a->NatT_HaltEvent, wait_time);
}
}