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
path: root/src/Cedar
diff options
context:
space:
mode:
authordnobori <da.git@softether.co.jp>2014-06-09 06:57:10 +0400
committerdnobori <da.git@softether.co.jp>2014-06-09 06:57:10 +0400
commitf75a2c2a128b1b36b29b760f6f47f1f2499e3127 (patch)
tree11d0d2719e12c42f85e9ace6ae5568815c8f6e45 /src/Cedar
parentea38eef377a2161347c864f42f85f24af9134a89 (diff)
v4.09-9451-beta
Diffstat (limited to 'src/Cedar')
-rw-r--r--src/Cedar/Cedar.h12
-rw-r--r--src/Cedar/Virtual.c28
-rw-r--r--src/Cedar/Virtual.h5
3 files changed, 38 insertions, 7 deletions
diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h
index d529d7d8..f353be52 100644
--- a/src/Cedar/Cedar.h
+++ b/src/Cedar/Cedar.h
@@ -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)
diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c
index 00a735dc..89711a15 100644
--- a/src/Cedar/Virtual.c
+++ b/src/Cedar/Virtual.c
@@ -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
diff --git a/src/Cedar/Virtual.h b/src/Cedar/Virtual.h
index aed5d825..38dd3351 100644
--- a/src/Cedar/Virtual.h
+++ b/src/Cedar/Virtual.h
@@ -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;
};