diff options
author | dnobori <da.git@softether.co.jp> | 2015-04-03 23:58:09 +0300 |
---|---|---|
committer | dnobori <da.git@softether.co.jp> | 2015-04-03 23:58:09 +0300 |
commit | 983c19c043ae80ac528c3efb19668c0049817fec (patch) | |
tree | 7650d511ffd102d37954e7ae855e0b94f54138e1 /src/Cedar | |
parent | 18b120e5f747a84d26302ec706f6c1c91d642ace (diff) |
v4.15-9539-beta
Diffstat (limited to 'src/Cedar')
-rw-r--r-- | src/Cedar/Cedar.h | 13 | ||||
-rw-r--r-- | src/Cedar/Client.c | 14 | ||||
-rw-r--r-- | src/Cedar/Client.h | 1 | ||||
-rw-r--r-- | src/Cedar/Session.c | 39 | ||||
-rw-r--r-- | src/Cedar/Session.h | 6 | ||||
-rw-r--r-- | src/Cedar/VLanWin32.c | 2 |
6 files changed, 69 insertions, 6 deletions
diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h index 5c453329..550777ab 100644 --- a/src/Cedar/Cedar.h +++ b/src/Cedar/Cedar.h @@ -138,7 +138,7 @@ #define CEDAR_VER 415
// Build Number
-#define CEDAR_BUILD 9538
+#define CEDAR_BUILD 9539
// Beta number
//#define BETA_NUMBER 3
@@ -158,11 +158,11 @@ // Specifies the build date
#define BUILD_DATE_Y 2015
-#define BUILD_DATE_M 3
-#define BUILD_DATE_D 27
-#define BUILD_DATE_HO 19
-#define BUILD_DATE_MI 32
-#define BUILD_DATE_SE 50
+#define BUILD_DATE_M 4
+#define BUILD_DATE_D 4
+#define BUILD_DATE_HO 0
+#define BUILD_DATE_MI 11
+#define BUILD_DATE_SE 55
// Tolerable time difference
#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000)
@@ -941,6 +941,7 @@ #define ERR_VPNGATE_CLIENT 145 // Operation on VPN Gate Client is not available
#define ERR_VPNGATE_INCLIENT_CANT_STOP 146 // Can not be stopped if operating within VPN Client mode
#define ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE 147 // It is a feature that is not supported in the open source version
+#define ERR_SUSPENDING 148 // System is suspending
////////////////////////////
diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c index 622c57d5..77cc045c 100644 --- a/src/Cedar/Client.c +++ b/src/Cedar/Client.c @@ -10590,6 +10590,13 @@ CLIENT *CiNewClient() ci_num_active_sessions = 0;
}
+#ifdef OS_WIN32
+ if (MsIsWindows7())
+ {
+ c->MsSuspendHandler = MsNewSuspendHandler();
+ }
+#endif // OS_WIN32
+
c->CmSetting = ZeroMalloc(sizeof(CM_SETTING));
@@ -10811,6 +10818,13 @@ void CiCleanupClient(CLIENT *c) Free(c->CmSetting);
+#ifdef OS_WIN32
+ if (c->MsSuspendHandler != NULL)
+ {
+ MsFreeSuspendHandler(c->MsSuspendHandler);
+ }
+#endif // OS_WIN32
+
Free(c);
#ifdef OS_WIN32
diff --git a/src/Cedar/Client.h b/src/Cedar/Client.h index 5b23c4cd..771b2b69 100644 --- a/src/Cedar/Client.h +++ b/src/Cedar/Client.h @@ -503,6 +503,7 @@ struct CLIENT bool NoSaveLog; // Do not save the log
bool NoSaveConfig; // Do not save the settings
INTERNET_SETTING CommonProxySetting; // Common proxy settings
+ void *MsSuspendHandler; // MS suspend handler
};
diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c index 601a635f..6669ade3 100644 --- a/src/Cedar/Session.c +++ b/src/Cedar/Session.c @@ -144,6 +144,7 @@ void SessionMain(SESSION *s) {
return;
}
+
Debug("SessionMain: %s\n", s->Name);
Notify(s, CLIENT_NOTIFY_ACCOUNT_CHANGED);
@@ -161,6 +162,19 @@ void SessionMain(SESSION *s) policy = s->Policy;
// Initialize the packet adapter
+#ifdef OS_WIN32
+ if (s->IsVPNClientAndVLAN_Win32)
+ {
+ MsBeginVLanCard();
+
+ if (MsIsVLanCardShouldStop())
+ {
+ err = ERR_SUSPENDING;
+ goto CLEANUP;
+ }
+ }
+#endif // OS_WIN32
+
pa = s->PacketAdapter;
if (pa->Init(s) == false)
{
@@ -358,6 +372,18 @@ void SessionMain(SESSION *s) pa_fail = true;
}
+#ifdef OS_WIN32
+ if (s->IsVPNClientAndVLAN_Win32)
+ {
+ if (MsIsVLanCardShouldStop())
+ {
+ // System is suspending
+ err = ERR_SUSPENDING;
+ pa_fail = true;
+ }
+ }
+#endif // OS_WIN32
+
// Pass the received block to the PacketAdapter
if (lock_receive_blocks_queue)
{
@@ -707,6 +733,13 @@ CLEANUP: pa->Free(s);
}
+#ifdef OS_WIN32
+ if (s->IsVPNClientAndVLAN_Win32)
+ {
+ MsEndVLanCard();
+ }
+#endif // OS_WIN32
+
if (s->ServerMode == false)
{
// Cancel to make all additional connection
@@ -1972,11 +2005,17 @@ SESSION *NewClientSessionEx(CEDAR *cedar, CLIENT_OPTION *option, CLIENT_AUTH *au // Hold whether the virtual LAN card is used in client mode
s->ClientModeAndUseVLan = (StrLen(s->ClientOption->DeviceName) == 0) ? false : true;
+
if (s->ClientOption->NoRoutingTracking)
{
s->ClientModeAndUseVLan = false;
}
+ if (pa->Id == PACKET_ADAPTER_ID_VLAN_WIN32)
+ {
+ s->IsVPNClientAndVLAN_Win32 = true;
+ }
+
if (StrLen(option->DeviceName) == 0)
{
// NAT mode
diff --git a/src/Cedar/Session.h b/src/Cedar/Session.h index 7820fc54..fbf55269 100644 --- a/src/Cedar/Session.h +++ b/src/Cedar/Session.h @@ -167,8 +167,13 @@ struct PACKET_ADAPTER PA_PUTPACKET *PutPacket;
PA_FREE *Free;
void *Param;
+ UINT Id;
};
+// Packet Adapter IDs
+#define PACKET_ADAPTER_ID_VLAN_WIN32 1
+
+
// Session structure
struct SESSION
{
@@ -262,6 +267,7 @@ struct SESSION UINT64 CurrentConnectionEstablishTime; // Completion time of this connection
UINT NumConnectionsEatablished; // Number of connections established so far
UINT AdjustMss; // MSS adjustment value
+ bool IsVPNClientAndVLAN_Win32; // Is the VPN Client session with a VLAN card (Win32)
bool IsRUDPSession; // Whether R-UDP session
UINT RUdpMss; // The value of the MSS should be applied while the R-UDP is used
diff --git a/src/Cedar/VLanWin32.c b/src/Cedar/VLanWin32.c index d723ab99..81c5fac1 100644 --- a/src/Cedar/VLanWin32.c +++ b/src/Cedar/VLanWin32.c @@ -1269,6 +1269,8 @@ PACKET_ADAPTER *VLanGetPacketAdapter() return NULL;
}
+ pa->Id = PACKET_ADAPTER_ID_VLAN_WIN32;
+
return pa;
}
|