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

v4.09-9451-beta

This commit is contained in:
dnobori
2014-06-09 11:57:10 +09:00
parent ea38eef377
commit f75a2c2a12
279 changed files with 303 additions and 272 deletions

View File

@ -120,10 +120,10 @@
// Version number
#define CEDAR_VER 408
#define CEDAR_VER 409
// Build Number
#define CEDAR_BUILD 9449
#define CEDAR_BUILD 9451
// Beta number
//#define BETA_NUMBER 3
@ -144,10 +144,10 @@
// Specifies the build date
#define BUILD_DATE_Y 2014
#define BUILD_DATE_M 6
#define BUILD_DATE_D 8
#define BUILD_DATE_HO 14
#define BUILD_DATE_MI 8
#define BUILD_DATE_SE 9
#define BUILD_DATE_D 9
#define BUILD_DATE_HO 1
#define BUILD_DATE_MI 54
#define BUILD_DATE_SE 55
// Tolerable time difference
#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000)

View File

@ -4417,6 +4417,16 @@ bool NatTransactTcp(VH *v, NAT_ENTRY *n)
// Successful transmission
ReadFifo(n->RecvFifo, NULL, sent_size);
n->SendAckNext = true;
if (false)
{
IP ip;
n->test_TotalSent += sent_size;
UINTToIP(&ip, n->DestIp);
Debug("TCP %u: %r:%u %u\n", n->Id, &ip, n->DestPort, (UINT)n->test_TotalSent);
}
}
}
@ -4445,6 +4455,11 @@ bool NatTransactTcp(VH *v, NAT_ENTRY *n)
// Communication has been disconnected
n->TcpFinished = true;
v->NatDoCancelFlag = true;
if (n->TcpDisconnected == false)
{
Disconnect(n->Sock);
n->TcpDisconnected = true;
}
break;
}
else if (recv_size == SOCK_LATER)
@ -4720,7 +4735,7 @@ void PollingNatTcp(VH *v, NAT_ENTRY *n)
case NAT_TCP_SEND_RESET: // Reset the connection
// Send a RST
if (n->TcpFinished == false)
if (n->TcpFinished == false || n->TcpForceReset)
{
SendTcp(v, n->DestIp, n->DestPort, n->SrcIp, n->SrcPort,
(UINT)(n->SendSeq + n->SendSeqInit),
@ -4742,6 +4757,7 @@ void PollingNatTcp(VH *v, NAT_ENTRY *n)
TCP_ACK | TCP_FIN, 0,
0, NULL, 0);
n->FinSentTime = v->Now;
n->FinSentSeq = (UINT)(n->SendSeq + n->SendSeqInit);
n->FinSentCount++;
if (n->FinSentCount >= NAT_FIN_SEND_MAX_COUNT)
{
@ -4959,6 +4975,16 @@ void TcpRecvForInternet(VH *v, UINT src_ip, UINT src_port, UINT dest_ip, UINT de
switch (n->TcpStatus)
{
case NAT_TCP_SEND_RESET: // Disconnect the connection by sending a RST
if ((tcp->Flag & TCP_ACK) && ((tcp->Flag & TCP_SYN) == false))
{
if (n->FinSentCount >= 1)
{
if (ack == (n->FinSentSeq + 1))
{
n->TcpForceReset = true;
}
}
}
break;
case NAT_TCP_CONNECTED: // Socket connection completion: SYN + ACK, ACK processing

View File

@ -310,6 +310,7 @@ struct NAT_ENTRY
UINT64 SendSeq; // Send sequence number
UINT64 RecvSeqInit; // Initial receive sequence number
UINT64 RecvSeq; // Receive sequence number
UINT FinSentSeq; // Sequence number with the last FIN
bool CurrentSendingMission; // Burst transmission ongoing
UINT SendMissionSize; // Transmission size of this time
@ -320,8 +321,12 @@ struct NAT_ENTRY
UINT64 CalcRTTStartValue; // RTT measurement start value
bool TcpFinished; // Data communication end flag of TCP
bool TcpDisconnected; // TCP Disconnect flag
bool TcpForceReset; // TCP connection force reset flag
UINT64 FinSentTime; // Time which the FIN was sent last
UINT FinSentCount; // Number of FIN transmissions
UINT64 test_TotalSent;
};