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-03-20 00:45:05 +0400
committerdnobori <da.git@softether.co.jp>2014-03-20 00:45:05 +0400
commitcf2a6a42bce34bd0c14223cd9e86d2395d3bd01c (patch)
tree0f1d237a4b9d7343b390398ce9eecdd54c251c1e /src/Cedar
parentdcd9b943817c4420bfbe4d973b358f4cc9d737c6 (diff)
v4.06-9430-beta
Diffstat (limited to 'src/Cedar')
-rw-r--r--src/Cedar/Account.c8
-rw-r--r--src/Cedar/Account.h8
-rw-r--r--src/Cedar/Admin.c57
-rw-r--r--src/Cedar/Admin.h8
-rw-r--r--src/Cedar/AzureClient.c8
-rw-r--r--src/Cedar/AzureClient.h8
-rw-r--r--src/Cedar/AzureServer.c8
-rw-r--r--src/Cedar/AzureServer.h8
-rw-r--r--src/Cedar/Bridge.c8
-rw-r--r--src/Cedar/Bridge.h8
-rw-r--r--src/Cedar/BridgeUnix.c8
-rw-r--r--src/Cedar/BridgeUnix.h8
-rw-r--r--src/Cedar/BridgeWin32.c8
-rw-r--r--src/Cedar/BridgeWin32.h8
-rw-r--r--src/Cedar/CM.c70
-rw-r--r--src/Cedar/CM.h8
-rw-r--r--src/Cedar/CMInner.h8
-rw-r--r--src/Cedar/Cedar.c12
-rw-r--r--src/Cedar/Cedar.h24
-rw-r--r--src/Cedar/CedarPch.c8
-rw-r--r--src/Cedar/CedarPch.h8
-rw-r--r--src/Cedar/CedarType.h8
-rw-r--r--src/Cedar/Client.c8
-rw-r--r--src/Cedar/Client.h8
-rw-r--r--src/Cedar/Command.c28
-rw-r--r--src/Cedar/Command.h8
-rw-r--r--src/Cedar/Connection.c8
-rw-r--r--src/Cedar/Connection.h8
-rw-r--r--src/Cedar/Console.c8
-rw-r--r--src/Cedar/Console.h8
-rw-r--r--src/Cedar/DDNS.c16
-rw-r--r--src/Cedar/DDNS.h8
-rw-r--r--src/Cedar/Database.c8
-rw-r--r--src/Cedar/Database.h8
-rw-r--r--src/Cedar/EM.c8
-rw-r--r--src/Cedar/EM.h8
-rw-r--r--src/Cedar/EMInner.h8
-rw-r--r--src/Cedar/EtherLog.c8
-rw-r--r--src/Cedar/EtherLog.h8
-rw-r--r--src/Cedar/Hub.c118
-rw-r--r--src/Cedar/Hub.h10
-rw-r--r--src/Cedar/IPsec.c8
-rw-r--r--src/Cedar/IPsec.h8
-rw-r--r--src/Cedar/IPsec_EtherIP.c8
-rw-r--r--src/Cedar/IPsec_EtherIP.h8
-rw-r--r--src/Cedar/IPsec_IKE.c8
-rw-r--r--src/Cedar/IPsec_IKE.h8
-rw-r--r--src/Cedar/IPsec_IPC.c39
-rw-r--r--src/Cedar/IPsec_IPC.h11
-rw-r--r--src/Cedar/IPsec_IkePacket.c8
-rw-r--r--src/Cedar/IPsec_IkePacket.h8
-rw-r--r--src/Cedar/IPsec_L2TP.c8
-rw-r--r--src/Cedar/IPsec_L2TP.h8
-rw-r--r--src/Cedar/IPsec_PPP.c14
-rw-r--r--src/Cedar/IPsec_PPP.h8
-rw-r--r--src/Cedar/IPsec_Win7.c8
-rw-r--r--src/Cedar/IPsec_Win7.h8
-rw-r--r--src/Cedar/IPsec_Win7Inner.h8
-rw-r--r--src/Cedar/Interop_OpenVPN.c50
-rw-r--r--src/Cedar/Interop_OpenVPN.h8
-rw-r--r--src/Cedar/Interop_SSTP.c8
-rw-r--r--src/Cedar/Interop_SSTP.h8
-rw-r--r--src/Cedar/Layer3.c8
-rw-r--r--src/Cedar/Layer3.h8
-rw-r--r--src/Cedar/Link.c8
-rw-r--r--src/Cedar/Link.h8
-rw-r--r--src/Cedar/Listener.c8
-rw-r--r--src/Cedar/Listener.h8
-rw-r--r--src/Cedar/Logging.c799
-rw-r--r--src/Cedar/Logging.h8
-rw-r--r--src/Cedar/NM.c108
-rw-r--r--src/Cedar/NM.h8
-rw-r--r--src/Cedar/NMInner.h12
-rw-r--r--src/Cedar/Nat.c22
-rw-r--r--src/Cedar/Nat.h8
-rw-r--r--src/Cedar/NativeStack.c8
-rw-r--r--src/Cedar/NativeStack.h8
-rw-r--r--src/Cedar/NullLan.c8
-rw-r--r--src/Cedar/NullLan.h8
-rw-r--r--src/Cedar/Protocol.c169
-rw-r--r--src/Cedar/Protocol.h8
-rw-r--r--src/Cedar/Radius.c557
-rw-r--r--src/Cedar/Radius.h15
-rw-r--r--src/Cedar/Remote.c8
-rw-r--r--src/Cedar/Remote.h8
-rw-r--r--src/Cedar/SM.c68
-rw-r--r--src/Cedar/SM.h8
-rw-r--r--src/Cedar/SMInner.h9
-rw-r--r--src/Cedar/SW.c8
-rw-r--r--src/Cedar/SW.h8
-rw-r--r--src/Cedar/SWInner.h8
-rw-r--r--src/Cedar/Sam.c262
-rw-r--r--src/Cedar/Sam.h8
-rw-r--r--src/Cedar/SeLowUser.c8
-rw-r--r--src/Cedar/SeLowUser.h8
-rw-r--r--src/Cedar/SecureInfo.c8
-rw-r--r--src/Cedar/SecureInfo.h8
-rw-r--r--src/Cedar/SecureNAT.c8
-rw-r--r--src/Cedar/SecureNAT.h8
-rw-r--r--src/Cedar/Server.c273
-rw-r--r--src/Cedar/Server.h28
-rw-r--r--src/Cedar/Session.c8
-rw-r--r--src/Cedar/Session.h8
-rw-r--r--src/Cedar/UT.c8
-rw-r--r--src/Cedar/UT.h8
-rw-r--r--src/Cedar/UdpAccel.c8
-rw-r--r--src/Cedar/UdpAccel.h8
-rw-r--r--src/Cedar/VG.c8
-rw-r--r--src/Cedar/VG.h8
-rw-r--r--src/Cedar/VLan.c8
-rw-r--r--src/Cedar/VLan.h8
-rw-r--r--src/Cedar/VLanUnix.c8
-rw-r--r--src/Cedar/VLanUnix.h8
-rw-r--r--src/Cedar/VLanWin32.c8
-rw-r--r--src/Cedar/VLanWin32.h8
-rw-r--r--src/Cedar/Virtual.c32
-rw-r--r--src/Cedar/Virtual.h11
-rw-r--r--src/Cedar/WaterMark.c8
-rw-r--r--src/Cedar/WaterMark.h8
-rw-r--r--src/Cedar/WebUI.c8
-rw-r--r--src/Cedar/WebUI.h8
-rw-r--r--src/Cedar/Win32Com.cpp8
-rw-r--r--src/Cedar/Win32Com.h8
-rw-r--r--src/Cedar/WinJumpList.cpp8
-rw-r--r--src/Cedar/WinUi.c13
-rw-r--r--src/Cedar/WinUi.h8
-rw-r--r--src/Cedar/Wpc.c8
-rw-r--r--src/Cedar/Wpc.h8
128 files changed, 3462 insertions, 173 deletions
diff --git a/src/Cedar/Account.c b/src/Cedar/Account.c
index f4004d5e..29887dc4 100644
--- a/src/Cedar/Account.c
+++ b/src/Cedar/Account.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Account.c
diff --git a/src/Cedar/Account.h b/src/Cedar/Account.h
index 71e0ed97..5b841bbc 100644
--- a/src/Cedar/Account.h
+++ b/src/Cedar/Account.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Account.h
diff --git a/src/Cedar/Admin.c b/src/Cedar/Admin.c
index bb17b713..f9af5c0c 100644
--- a/src/Cedar/Admin.c
+++ b/src/Cedar/Admin.c
@@ -16,7 +16,6 @@
// - ELIN (https://github.com/el1n)
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -87,6 +86,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Admin.c
@@ -1716,7 +1722,7 @@ UINT StGetAdminMsg(ADMIN *a, RPC_MSG *t)
if (
c->Bridge == false)
{
- if (GetCurrentLangId() != SE_LANG_ENGLISH)
+ if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0)
{
UniStrCat(tmp, tmpsize, _UU("OSS_MSG"));
}
@@ -2179,6 +2185,11 @@ UINT StSetAcList(ADMIN *a, RPC_AC_LIST *t)
return ERR_NOT_SUPPORTED;
}
+ if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0 && LIST_NUM(t->o) >= 1)
+ {
+ return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE;
+ }
+
CHECK_RIGHT;
NO_SUPPORT_FOR_BRIDGE;
if (s->ServerType == SERVER_TYPE_FARM_MEMBER)
@@ -3620,6 +3631,11 @@ UINT StSetSysLog(ADMIN *a, SYSLOG_SETTING *t)
SERVER_ADMIN_ONLY;
+ if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0 && t->SaveType != SYSLOG_NONE)
+ {
+ return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE;
+ }
+
if (GetServerCapsBool(s, "b_support_syslog") == false)
{
return ERR_NOT_SUPPORTED;
@@ -5017,9 +5033,12 @@ UINT StSetUser(ADMIN *a, RPC_SET_USER *t)
CHECK_RIGHT;
- if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT)
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
{
- return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE;
+ if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT)
+ {
+ return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE;
+ }
}
if (StrCmpi(t->Name, "*") == 0)
@@ -5147,9 +5166,12 @@ UINT StCreateUser(ADMIN *a, RPC_SET_USER *t)
CHECK_RIGHT;
- if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT)
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
{
- return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE;
+ if (t->AuthType == AUTHTYPE_USERCERT || t->AuthType == AUTHTYPE_RADIUS || t->AuthType == AUTHTYPE_ROOTCERT || t->AuthType == AUTHTYPE_NT)
+ {
+ return ERR_NOT_SUPPORTED_AUTH_ON_OPENSOURCE;
+ }
}
if (t->AuthType == AUTHTYPE_USERCERT)
@@ -7254,6 +7276,7 @@ UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t)
SERVER *s = a->Server;
CEDAR *c = s->Cedar;
HUB *h;
+ char push_routes_str_old[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE];
if (IsZero(t->MacAddress, sizeof(t->MacAddress)) ||
@@ -7266,6 +7289,17 @@ UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t)
{
return ERR_INVALID_PARAMETER;
}
+ if (GetServerCapsBool(s, "b_support_securenat") == false)
+ {
+ t->ApplyDhcpPushRoutes = false;
+ }
+ if (t->ApplyDhcpPushRoutes)
+ {
+ if (NormalizeClasslessRouteTableStr(t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes), t->DhcpPushRoutes) == false)
+ {
+ return ERR_INVALID_PARAMETER;
+ }
+ }
CHECK_RIGHT;
@@ -7315,7 +7349,12 @@ UINT StSetSecureNATOption(ADMIN *a, VH_OPTION *t)
}
}
+ StrCpy(push_routes_str_old, sizeof(push_routes_str_old), h->SecureNATOption->DhcpPushRoutes);
Copy(h->SecureNATOption, t, sizeof(VH_OPTION));
+ if (t->ApplyDhcpPushRoutes == false)
+ {
+ StrCpy(h->SecureNATOption->DhcpPushRoutes, sizeof(h->SecureNATOption->DhcpPushRoutes), push_routes_str_old);
+ }
if (h->Type != HUB_TYPE_STANDALONE && h->Cedar != NULL && h->Cedar->Server != NULL &&
h->Cedar->Server->ServerType == SERVER_TYPE_FARM_CONTROLLER)
@@ -7381,6 +7420,7 @@ UINT StGetSecureNATOption(ADMIN *a, VH_OPTION *t)
Zero(t, sizeof(VH_OPTION));
StrCpy(t->HubName, sizeof(t->HubName), hubname);
Copy(t, h->SecureNATOption, sizeof(VH_OPTION));
+ t->ApplyDhcpPushRoutes = true;
ReleaseHub(h);
@@ -7617,6 +7657,11 @@ UINT StSetHubRadius(ADMIN *a, RPC_RADIUS *t)
return ERR_NOT_SUPPORTED;
}
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0 && IsEmptyStr(t->RadiusServerName) == false)
+ {
+ return ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE;
+ }
+
CHECK_RIGHT;
LockHubList(c);
diff --git a/src/Cedar/Admin.h b/src/Cedar/Admin.h
index 15ee26be..7715ba0e 100644
--- a/src/Cedar/Admin.h
+++ b/src/Cedar/Admin.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Admin.h
diff --git a/src/Cedar/AzureClient.c b/src/Cedar/AzureClient.c
index 00614d09..0ba2840f 100644
--- a/src/Cedar/AzureClient.c
+++ b/src/Cedar/AzureClient.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// AzureClient.c
diff --git a/src/Cedar/AzureClient.h b/src/Cedar/AzureClient.h
index 906c677a..d5267fbe 100644
--- a/src/Cedar/AzureClient.h
+++ b/src/Cedar/AzureClient.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// AzureClient.h
diff --git a/src/Cedar/AzureServer.c b/src/Cedar/AzureServer.c
index 1ffd2935..b185a5d3 100644
--- a/src/Cedar/AzureServer.c
+++ b/src/Cedar/AzureServer.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// AzureServer.c
diff --git a/src/Cedar/AzureServer.h b/src/Cedar/AzureServer.h
index c43d9dae..1d237107 100644
--- a/src/Cedar/AzureServer.h
+++ b/src/Cedar/AzureServer.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// AzureServer.h
diff --git a/src/Cedar/Bridge.c b/src/Cedar/Bridge.c
index 978d273e..363651f3 100644
--- a/src/Cedar/Bridge.c
+++ b/src/Cedar/Bridge.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Bridge.c
diff --git a/src/Cedar/Bridge.h b/src/Cedar/Bridge.h
index 31a996ac..011876c7 100644
--- a/src/Cedar/Bridge.h
+++ b/src/Cedar/Bridge.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Bridge.h
diff --git a/src/Cedar/BridgeUnix.c b/src/Cedar/BridgeUnix.c
index 82d23642..326c1f35 100644
--- a/src/Cedar/BridgeUnix.c
+++ b/src/Cedar/BridgeUnix.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// BridgeUnix.c
diff --git a/src/Cedar/BridgeUnix.h b/src/Cedar/BridgeUnix.h
index b7c1403d..9e7bd655 100644
--- a/src/Cedar/BridgeUnix.h
+++ b/src/Cedar/BridgeUnix.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// BridgeUnix.h
diff --git a/src/Cedar/BridgeWin32.c b/src/Cedar/BridgeWin32.c
index 0a6db392..9f07f40a 100644
--- a/src/Cedar/BridgeWin32.c
+++ b/src/Cedar/BridgeWin32.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// BridgeWin32.c
diff --git a/src/Cedar/BridgeWin32.h b/src/Cedar/BridgeWin32.h
index 99adbd38..5991bfb9 100644
--- a/src/Cedar/BridgeWin32.h
+++ b/src/Cedar/BridgeWin32.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// BridgeWin32.h
diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c
index 3181f7cb..bdbbcae6 100644
--- a/src/Cedar/CM.c
+++ b/src/Cedar/CM.c
@@ -16,7 +16,6 @@
// - ELIN (https://github.com/el1n)
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -87,6 +86,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CM.c
@@ -6847,6 +6853,17 @@ void CmEditAccountDlgUpdate(HWND hWnd, CM_ACCOUNT *a)
GetTxtA(hWnd, E_HOSTNAME, a->ClientOption->Hostname, sizeof(a->ClientOption->Hostname));
Trim(a->ClientOption->Hostname);
+ if (InStr(a->ClientOption->Hostname, "/tcp"))
+ {
+ Check(hWnd, R_DISABLE_NATT, true);
+ }
+ else
+ {
+ Check(hWnd, R_DISABLE_NATT, false);
+ }
+
+ SetEnable(hWnd, R_DISABLE_NATT, !IsEmptyStr(a->ClientOption->Hostname));
+
// Port number
a->ClientOption->Port = GetInt(hWnd, C_PORT);
@@ -7278,6 +7295,15 @@ void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a)
SetTextA(hWnd, E_HOSTNAME, a->ClientOption->Hostname);
StrCpy(a->old_server_name, sizeof(a->old_server_name), a->ClientOption->Hostname);
+ if (InStr(a->ClientOption->Hostname, "/tcp"))
+ {
+ Check(hWnd, R_DISABLE_NATT, true);
+ }
+ else
+ {
+ Check(hWnd, R_DISABLE_NATT, false);
+ }
+
// Port number
CbSetHeight(hWnd, C_PORT, 18);
CbAddStr(hWnd, C_PORT, _UU("CM_PORT_1"), 0);
@@ -7442,6 +7468,8 @@ UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, voi
NMHDR *n;
X *x;
K *k;
+ char tmp[MAX_PATH];
+ bool no_update_natt_check = false;
// Validate arguments
if (hWnd == NULL)
{
@@ -7483,6 +7511,39 @@ UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, voi
}
break;
case WM_COMMAND:
+ switch (wParam)
+ {
+ case R_DISABLE_NATT:
+ Zero(tmp, sizeof(tmp));
+ GetTxtA(hWnd, E_HOSTNAME, tmp, sizeof(tmp));
+
+ if (IsChecked(hWnd, R_DISABLE_NATT))
+ {
+ if (InStr(tmp, "/tcp") == false)
+ {
+ StrCat(tmp, sizeof(tmp), "/tcp");
+
+ SetTextA(hWnd, E_HOSTNAME, tmp);
+ }
+ }
+ else
+ {
+ if (InStr(tmp, "/tcp"))
+ {
+ UINT i = SearchStrEx(tmp, "/tcp", 0, false);
+
+ if (i != INFINITE)
+ {
+ tmp[i] = 0;
+
+ SetTextA(hWnd, E_HOSTNAME, tmp);
+ }
+ }
+ }
+
+ CmEditAccountDlgStartEnumHub(hWnd, a);
+ break;
+ }
switch (LOWORD(wParam))
{
case E_ACCOUNT_NAME:
@@ -7531,6 +7592,13 @@ UINT CmEditAccountDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, voi
break;
}
break;
+ case BN_PUSHED:
+ switch (LOWORD(wParam))
+ {
+ case R_DISABLE_NATT:
+ break;
+ }
+ break;
}
if (HIWORD(wParam) == 0)
{
diff --git a/src/Cedar/CM.h b/src/Cedar/CM.h
index 1d497442..728f8a01 100644
--- a/src/Cedar/CM.h
+++ b/src/Cedar/CM.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CM.h
diff --git a/src/Cedar/CMInner.h b/src/Cedar/CMInner.h
index 06e95196..b7388792 100644
--- a/src/Cedar/CMInner.h
+++ b/src/Cedar/CMInner.h
@@ -16,7 +16,6 @@
// - ELIN (https://github.com/el1n)
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -87,6 +86,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CMInner.h
diff --git a/src/Cedar/Cedar.c b/src/Cedar/Cedar.c
index 04d3697a..b2600e52 100644
--- a/src/Cedar/Cedar.c
+++ b/src/Cedar/Cedar.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Cedar.c
@@ -1246,6 +1252,8 @@ void CleanupCedar(CEDAR *c)
DeleteLock(c->OpenVPNPublicPortsLock);
+ DeleteLock(c->CurrentRegionLock);
+
Free(c);
}
@@ -1505,6 +1513,8 @@ CEDAR *NewCedar(X *server_x, K *server_k)
c->CedarSuperLock = NewLock();
+ c->CurrentRegionLock = NewLock();
+
#ifdef BETA_NUMBER
c->Beta = BETA_NUMBER;
#endif // BETA_NUMBER
diff --git a/src/Cedar/Cedar.h b/src/Cedar/Cedar.h
index c0f972da..b003af64 100644
--- a/src/Cedar/Cedar.h
+++ b/src/Cedar/Cedar.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Cedar.h
@@ -114,10 +120,10 @@
// Version number
-#define CEDAR_VER 405
+#define CEDAR_VER 406
// Build Number
-#define CEDAR_BUILD 9423
+#define CEDAR_BUILD 9430
// Beta number
//#define BETA_NUMBER 3
@@ -137,11 +143,11 @@
// Specifies the build date
#define BUILD_DATE_Y 2014
-#define BUILD_DATE_M 2
-#define BUILD_DATE_D 18
-#define BUILD_DATE_HO 19
-#define BUILD_DATE_MI 9
-#define BUILD_DATE_SE 44
+#define BUILD_DATE_M 3
+#define BUILD_DATE_D 20
+#define BUILD_DATE_HO 4
+#define BUILD_DATE_MI 8
+#define BUILD_DATE_SE 6
// Tolerable time difference
#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000)
@@ -1003,6 +1009,8 @@ typedef struct CEDAR
char CurrentDDnsFqdn[MAX_SIZE]; // FQDN of the current DDNS
char OpenVPNPublicPorts[MAX_SIZE]; // OpenVPN public UDP port list
LOCK *OpenVPNPublicPortsLock; // Lock of OpenVPN public UDP port list
+ LOCK *CurrentRegionLock; // Current region lock
+ char CurrentRegion[128]; // Current region
} CEDAR;
// Type of CEDAR
diff --git a/src/Cedar/CedarPch.c b/src/Cedar/CedarPch.c
index 57a239de..f6752dc9 100644
--- a/src/Cedar/CedarPch.c
+++ b/src/Cedar/CedarPch.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CedarPch.c
diff --git a/src/Cedar/CedarPch.h b/src/Cedar/CedarPch.h
index ab4803fe..ceefea80 100644
--- a/src/Cedar/CedarPch.h
+++ b/src/Cedar/CedarPch.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CedarPch.h
diff --git a/src/Cedar/CedarType.h b/src/Cedar/CedarType.h
index 8c850e1d..d02e6c14 100644
--- a/src/Cedar/CedarType.h
+++ b/src/Cedar/CedarType.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// CedarType.h
diff --git a/src/Cedar/Client.c b/src/Cedar/Client.c
index 9f57f057..17c5d9a2 100644
--- a/src/Cedar/Client.c
+++ b/src/Cedar/Client.c
@@ -16,7 +16,6 @@
// - nattoheaven (https://github.com/nattoheaven)
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -87,6 +86,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Client.c
diff --git a/src/Cedar/Client.h b/src/Cedar/Client.h
index abfd4e56..bad47c99 100644
--- a/src/Cedar/Client.h
+++ b/src/Cedar/Client.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Client.h
diff --git a/src/Cedar/Command.c b/src/Cedar/Command.c
index 972f3135..9ae8bdc3 100644
--- a/src/Cedar/Command.c
+++ b/src/Cedar/Command.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Command.c
@@ -18846,6 +18852,13 @@ UINT PsDhcpGet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
// To save the log
CtInsert(ct, _UU("CMD_SecureNatHostGet_Column_LOG"), t.SaveLog ? _UU("SEC_YES") : _UU("SEC_NO"));
+ // Push routing table
+ if (t.ApplyDhcpPushRoutes)
+ {
+ StrToUni(tmp, sizeof(tmp), t.DhcpPushRoutes);
+ CtInsert(ct, _UU("CMD_DhcpGet_Column_PUSHROUTE"), tmp);
+ }
+
CtFree(ct, c);
}
@@ -19013,6 +19026,7 @@ UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
{"DNS2", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DNS2"), CmdEvalIp, NULL},
{"DOMAIN", CmdPrompt, _UU("CMD_DhcpSet_Prompt_DOMAIN"), NULL, NULL},
{"LOG", CmdPrompt, _UU("CMD_NatSet_Prompt_LOG"), CmdEvalNotEmpty, NULL},
+ {"PUSHROUTE", NULL, _UU("CMD_DhcpSet_PUSHROUTE"), NULL, NULL},
};
// If virtual HUB is not selected, it's an error
@@ -19055,6 +19069,9 @@ UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
StrCpy(t.DhcpDomainName, sizeof(t.DhcpDomainName), GetParamStr(o, "DOMAIN"));
t.SaveLog = GetParamYes(o, "LOG");
+ StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), GetParamStr(o, "PUSHROUTE"));
+ t.ApplyDhcpPushRoutes = true;
+
if (ok == false)
{
// Parameter is invalid
@@ -19075,6 +19092,15 @@ UINT PsDhcpSet(CONSOLE *c, char *cmd_name, wchar_t *str, void *param)
FreeParamValueList(o);
return ret;
}
+
+ if (IsEmptyStr(GetParamStr(o, "PUSHROUTE")) == false)
+ {
+ if (GetCapsBool(ps->CapsList, "b_suppport_push_route") == false &&
+ GetCapsBool(ps->CapsList, "b_suppport_push_route_config"))
+ {
+ CmdPrintError(c, ERR_NOT_SUPPORTED_FUNCTION_ON_OPENSOURCE);
+ }
+ }
}
}
diff --git a/src/Cedar/Command.h b/src/Cedar/Command.h
index 68a5c27b..9b091bea 100644
--- a/src/Cedar/Command.h
+++ b/src/Cedar/Command.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Command.h
diff --git a/src/Cedar/Connection.c b/src/Cedar/Connection.c
index 29999a85..96d76568 100644
--- a/src/Cedar/Connection.c
+++ b/src/Cedar/Connection.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Connection.c
diff --git a/src/Cedar/Connection.h b/src/Cedar/Connection.h
index fdbae898..4af0843d 100644
--- a/src/Cedar/Connection.h
+++ b/src/Cedar/Connection.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Connection.h
diff --git a/src/Cedar/Console.c b/src/Cedar/Console.c
index 62104c28..fede3e4d 100644
--- a/src/Cedar/Console.c
+++ b/src/Cedar/Console.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Console.c
diff --git a/src/Cedar/Console.h b/src/Cedar/Console.h
index 7e39a81f..2ab7ef75 100644
--- a/src/Cedar/Console.h
+++ b/src/Cedar/Console.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Console.h
diff --git a/src/Cedar/DDNS.c b/src/Cedar/DDNS.c
index 13ff8ec5..7f198081 100644
--- a/src/Cedar/DDNS.c
+++ b/src/Cedar/DDNS.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// DDNS.c
@@ -652,6 +658,7 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
if (err == ERR_NO_ERROR)
{
char snat_t[MAX_SIZE];
+ char current_region[128];
// Current host name
PackGetStr(ret, "current_hostname", c->CurrentHostName, sizeof(c->CurrentHostName));
@@ -659,6 +666,7 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
PackGetStr(ret, "current_ipv4", c->CurrentIPv4, sizeof(c->CurrentIPv4));
PackGetStr(ret, "current_ipv6", c->CurrentIPv6, sizeof(c->CurrentIPv6));
PackGetStr(ret, "dns_suffix", c->DnsSuffix, sizeof(c->DnsSuffix));
+ PackGetStr(ret, "current_region", current_region, sizeof(current_region));
// SecureNAT connectivity check parameters
Zero(snat_t, sizeof(snat_t));
@@ -688,6 +696,12 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
c->CurrentHostName, c->CurrentFqdn,
c->CurrentIPv4, c->CurrentIPv6,
c->CurrentAzureIp, c->CurrentAzureTimestamp, c->CurrentAzureSignature, c->AzureCertHash);
+
+ if (IsEmptyStr(current_region) == false)
+ {
+ // Update the current region
+ SiUpdateCurrentRegion(c->Cedar, current_region, false);
+ }
}
}
Unlock(c->Lock);
diff --git a/src/Cedar/DDNS.h b/src/Cedar/DDNS.h
index e24f4f16..f1bc1579 100644
--- a/src/Cedar/DDNS.h
+++ b/src/Cedar/DDNS.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// DDNS.h
diff --git a/src/Cedar/Database.c b/src/Cedar/Database.c
index 82a6f0ef..715c0e64 100644
--- a/src/Cedar/Database.c
+++ b/src/Cedar/Database.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Database.c
diff --git a/src/Cedar/Database.h b/src/Cedar/Database.h
index 9e978940..25ae7f11 100644
--- a/src/Cedar/Database.h
+++ b/src/Cedar/Database.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Database.h
diff --git a/src/Cedar/EM.c b/src/Cedar/EM.c
index 12ed4ec0..9a9517ce 100644
--- a/src/Cedar/EM.c
+++ b/src/Cedar/EM.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// EM.c
diff --git a/src/Cedar/EM.h b/src/Cedar/EM.h
index 917d2037..04a25edd 100644
--- a/src/Cedar/EM.h
+++ b/src/Cedar/EM.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// EM.h
diff --git a/src/Cedar/EMInner.h b/src/Cedar/EMInner.h
index 07c6b404..3173664a 100644
--- a/src/Cedar/EMInner.h
+++ b/src/Cedar/EMInner.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// EMInner.h
diff --git a/src/Cedar/EtherLog.c b/src/Cedar/EtherLog.c
index 183ec64c..7429c8dc 100644
--- a/src/Cedar/EtherLog.c
+++ b/src/Cedar/EtherLog.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// EtherLog.c
diff --git a/src/Cedar/EtherLog.h b/src/Cedar/EtherLog.h
index 50656a03..af1ecbd1 100644
--- a/src/Cedar/EtherLog.h
+++ b/src/Cedar/EtherLog.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// EtherLog.h
diff --git a/src/Cedar/Hub.c b/src/Cedar/Hub.c
index 678251a6..429fa1ca 100644
--- a/src/Cedar/Hub.c
+++ b/src/Cedar/Hub.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Hub.c
@@ -572,6 +578,8 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
GetHubAdminOptionDataAndSet(ao, "BroadcastLimiterStrictMode", &o->BroadcastLimiterStrictMode);
GetHubAdminOptionDataAndSet(ao, "MaxLoggedPacketsPerMinute", &o->MaxLoggedPacketsPerMinute);
GetHubAdminOptionDataAndSet(ao, "DoNotSaveHeavySecurityLogs", &o->DoNotSaveHeavySecurityLogs);
+ GetHubAdminOptionDataAndSet(ao, "DropBroadcastsInPrivacyFilterMode", &o->DropBroadcastsInPrivacyFilterMode);
+ GetHubAdminOptionDataAndSet(ao, "DropArpInPrivacyFilterMode", &o->DropArpInPrivacyFilterMode);
}
// Convert the contents of the HUB_OPTION to data
@@ -633,6 +641,8 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
Add(aol, NewAdminOption("BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode));
Add(aol, NewAdminOption("MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute));
Add(aol, NewAdminOption("DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs));
+ Add(aol, NewAdminOption("DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode));
+ Add(aol, NewAdminOption("DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode));
Zero(ao, sizeof(RPC_ADMIN_OPTION));
@@ -775,13 +785,102 @@ char *GenerateAcStr(AC *ac)
// Calculate whether the specified IP address is rejected by the access list
bool IsIpDeniedByAcList(IP *ip, LIST *o)
{
+ UINT i;
+ // Validate arguments
+ if (ip == NULL || o == NULL)
+ {
+ return false;
+ }
+
+ if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0)
+ {
+ return false;
+ }
+
+ for (i = 0;i < LIST_NUM(o);i++)
+ {
+ AC *ac = LIST_DATA(o, i);
+
+ if (IsIpMaskedByAc(ip, ac))
+ {
+ if (ac->Deny == false)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ }
+
return false;
}
// Calculate whether the specified IP address is masked by the AC
bool IsIpMaskedByAc(IP *ip, AC *ac)
{
- return false;
+ UINT uip, net, mask;
+ // Validate arguments
+ if (ip == NULL || ac == NULL)
+ {
+ return false;
+ }
+
+ if (GetGlobalServerFlag(GSF_DISABLE_AC) != 0)
+ {
+ return false;
+ }
+
+ if (IsIP4(ip))
+ {
+ // IPv4
+ uip = IPToUINT(ip);
+ net = IPToUINT(&ac->IpAddress);
+ mask = IPToUINT(&ac->SubnetMask);
+
+ if (ac->Masked == false)
+ {
+ if (uip == net)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if ((uip & mask) == (net & mask))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ else
+ {
+ // IPv6
+ if (ac->Masked == false)
+ {
+ if (CmpIpAddr(ip, &ac->IpAddress) == 0)
+ {
+ return true;
+ }
+ }
+ else
+ {
+ IP and1, and2;
+
+ IPAnd6(&and1, ip, &ac->SubnetMask);
+ IPAnd6(&and2, &ac->IpAddress, &ac->SubnetMask);
+
+ if (CmpIpAddr(&and1, &and2) == 0)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
// Set the AC
@@ -3831,6 +3930,8 @@ void StorePacket(HUB *hub, SESSION *s, PKT *packet)
TRAFFIC traffic;
UINT64 now = Tick64();
bool no_heavy = false;
+ bool drop_broadcast_packet_privacy = false;
+ bool drop_arp_packet_privacy = false;
// Validate arguments
if (hub == NULL || packet == NULL)
{
@@ -3851,6 +3952,8 @@ void StorePacket(HUB *hub, SESSION *s, PKT *packet)
if (hub->Option != NULL)
{
no_heavy = hub->Option->DoNotSaveHeavySecurityLogs;
+ drop_broadcast_packet_privacy = hub->Option->DropBroadcastsInPrivacyFilterMode;
+ drop_arp_packet_privacy = hub->Option->DropArpInPrivacyFilterMode;
}
// Lock the entire MAC address table
@@ -4760,13 +4863,13 @@ UPDATE_FDB:
}
if (s != NULL &&
- (packet->BroadcastPacket == false &&
+ ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) &&
s->Policy->PrivacyFilter &&
dest_session->Policy->PrivacyFilter)
)
{
// Privacy filter
- if (packet->TypeL3 != L3_ARPV4)
+ if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4)
{
goto DISCARD_UNICAST_PACKET;
}
@@ -4942,13 +5045,13 @@ DISCARD_UNICAST_PACKET:
}
if (s != NULL &&
- (packet->BroadcastPacket == false &&
+ ((drop_broadcast_packet_privacy || packet->BroadcastPacket == false) &&
s->Policy->PrivacyFilter &&
dest_session->Policy->PrivacyFilter)
)
{
// Privacy filter
- if (packet->TypeL3 != L3_ARPV4)
+ if (drop_arp_packet_privacy || packet->TypeL3 != L3_ARPV4)
{
discard = true;
}
@@ -6858,6 +6961,9 @@ HUB *NewHub(CEDAR *cedar, char *HubName, HUB_OPTION *option)
h->Option->VlanTypeId = MAC_PROTO_TAGVLAN;
}
+ h->Option->DropBroadcastsInPrivacyFilterMode = true;
+ h->Option->DropArpInPrivacyFilterMode = true;
+
Rand(h->HubSignature, sizeof(h->HubSignature));
// SecureNAT related
diff --git a/src/Cedar/Hub.h b/src/Cedar/Hub.h
index 0da31bdd..30873025 100644
--- a/src/Cedar/Hub.h
+++ b/src/Cedar/Hub.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Hub.h
@@ -245,6 +251,8 @@ struct HUB_OPTION
bool BroadcastLimiterStrictMode; // Strictly broadcast packets limiting mode
UINT MaxLoggedPacketsPerMinute; // Maximum number of logging target packets per minute
bool DoNotSaveHeavySecurityLogs; // Do not take heavy security log
+ bool DropBroadcastsInPrivacyFilterMode; // Drop broadcasting packets if the both source and destination session is PrivacyFilter mode
+ bool DropArpInPrivacyFilterMode; // Drop ARP packets if the both source and destination session is PrivacyFilter mode
};
// MAC table entry
diff --git a/src/Cedar/IPsec.c b/src/Cedar/IPsec.c
index 95d37d26..766d6c67 100644
--- a/src/Cedar/IPsec.c
+++ b/src/Cedar/IPsec.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec.c
diff --git a/src/Cedar/IPsec.h b/src/Cedar/IPsec.h
index 3eabad8b..b8b98140 100644
--- a/src/Cedar/IPsec.h
+++ b/src/Cedar/IPsec.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec.h
diff --git a/src/Cedar/IPsec_EtherIP.c b/src/Cedar/IPsec_EtherIP.c
index 41ad01db..7f048395 100644
--- a/src/Cedar/IPsec_EtherIP.c
+++ b/src/Cedar/IPsec_EtherIP.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_EtherIP.c
diff --git a/src/Cedar/IPsec_EtherIP.h b/src/Cedar/IPsec_EtherIP.h
index a32846b5..757ee5ee 100644
--- a/src/Cedar/IPsec_EtherIP.h
+++ b/src/Cedar/IPsec_EtherIP.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_EtherIP.h
diff --git a/src/Cedar/IPsec_IKE.c b/src/Cedar/IPsec_IKE.c
index 8d071289..30d8e441 100644
--- a/src/Cedar/IPsec_IKE.c
+++ b/src/Cedar/IPsec_IKE.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IKE.c
diff --git a/src/Cedar/IPsec_IKE.h b/src/Cedar/IPsec_IKE.h
index 148a2da0..09d174cd 100644
--- a/src/Cedar/IPsec_IKE.h
+++ b/src/Cedar/IPsec_IKE.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IKE.h
diff --git a/src/Cedar/IPsec_IPC.c b/src/Cedar/IPsec_IPC.c
index b885d5e4..b8898b4a 100644
--- a/src/Cedar/IPsec_IPC.c
+++ b/src/Cedar/IPsec_IPC.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IPC.c
@@ -225,7 +231,7 @@ void IPCAsyncThreadProc(THREAD *thread, void *param)
UINTToIP(&subnet, cao.SubnetMask);
UINTToIP(&gw, cao.Gateway);
- IPCSetIPv4Parameters(a->Ipc, &ip, &subnet, &gw);
+ IPCSetIPv4Parameters(a->Ipc, &ip, &subnet, &gw, &cao.ClasslessRoute);
a->L3NextDhcpRenewTick = Tick64() + a->L3DhcpRenewInterval;
}
@@ -1574,7 +1580,7 @@ void IPCProcessL3EventsEx(IPC *ipc, UINT64 now)
}
// Configure IPv4 parameters
-bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw)
+bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt)
{
bool changed = false;
// Validate arguments
@@ -1616,6 +1622,16 @@ bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw)
GetBroadcastAddress4(&ipc->BroadcastAddress, ip, subnet);
+ if (rt != NULL && rt->NumExistingRoutes >= 1)
+ {
+ if (Cmp(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE)) != 0)
+ {
+ changed = true;
+
+ Copy(&ipc->ClasslessRoute, rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE));
+ }
+ }
+
return changed;
}
@@ -1626,6 +1642,7 @@ void IPCSendIPv4(IPC *ipc, void *data, UINT size)
IP ip_dst_local;
bool is_broadcast = false;
UCHAR uc;
+ DHCP_CLASSLESS_ROUTE *r = NULL;
// Validate arguments
if (ipc == NULL || data == NULL || size < 20 || size > 1500)
{
@@ -1664,11 +1681,19 @@ void IPCSendIPv4(IPC *ipc, void *data, UINT size)
// Get the IP address of the relayed destination
Copy(&ip_dst_local, &ip_dst, sizeof(IP));
- if (ip_dst.addr[0]==8)
- DoNothing();
+
if (IsInSameNetwork4(&ip_dst, &ipc->ClientIPAddress, &ipc->SubnetMask) == false)
{
- Copy(&ip_dst_local, &ipc->DefaultGateway, sizeof(IP));
+ r = GetBestClasslessRoute(&ipc->ClasslessRoute, &ip_dst);
+
+ if (r == NULL)
+ {
+ Copy(&ip_dst_local, &ipc->DefaultGateway, sizeof(IP));
+ }
+ else
+ {
+ Copy(&ip_dst_local, &r->Gateway, sizeof(IP));
+ }
}
if (CmpIpAddr(&ipc->BroadcastAddress, &ip_dst) == 0)
@@ -1709,9 +1734,11 @@ void IPCSendIPv4(IPC *ipc, void *data, UINT size)
if (IsZeroIP(&ip_dst_local))
{
+ // Unable to send
return;
}
+ // Send a unicast packet
IPCSendIPv4Unicast(ipc, data, size, &ip_dst_local);
}
diff --git a/src/Cedar/IPsec_IPC.h b/src/Cedar/IPsec_IPC.h
index 12881a68..686e618d 100644
--- a/src/Cedar/IPsec_IPC.h
+++ b/src/Cedar/IPsec_IPC.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IPC.h
@@ -187,6 +193,7 @@ struct IPC
QUEUE *IPv4RecviedQueue; // IPv4 reception queue
TUBE_FLUSH_LIST *FlushList; // Tube Flush List
UCHAR MsChapV2_ServerResponse[20]; // Server response
+ DHCP_CLASSLESS_ROUTE_TABLE ClasslessRoute; // Classless routing table
};
// MS-CHAPv2 authentication information
@@ -214,7 +221,7 @@ BLOCK *IPCRecvIPv4(IPC *ipc);
void IPCProcessInterrupts(IPC *ipc);
void IPCProcessL3Events(IPC *ipc);
void IPCProcessL3EventsEx(IPC *ipc, UINT64 now);
-bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw);
+bool IPCSetIPv4Parameters(IPC *ipc, IP *ip, IP *subnet, IP *gw, DHCP_CLASSLESS_ROUTE_TABLE *rt);
IPC_ARP *IPCNewARP(IP *ip, UCHAR *mac_address);
void IPCFreeARP(IPC_ARP *a);
int IPCCmpArpTable(void *p1, void *p2);
diff --git a/src/Cedar/IPsec_IkePacket.c b/src/Cedar/IPsec_IkePacket.c
index 5919049e..e4abb8cc 100644
--- a/src/Cedar/IPsec_IkePacket.c
+++ b/src/Cedar/IPsec_IkePacket.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IkePacket.c
diff --git a/src/Cedar/IPsec_IkePacket.h b/src/Cedar/IPsec_IkePacket.h
index cae38d79..e3ff56b2 100644
--- a/src/Cedar/IPsec_IkePacket.h
+++ b/src/Cedar/IPsec_IkePacket.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_IkePacket.h
diff --git a/src/Cedar/IPsec_L2TP.c b/src/Cedar/IPsec_L2TP.c
index 53f4afe5..17d53b56 100644
--- a/src/Cedar/IPsec_L2TP.c
+++ b/src/Cedar/IPsec_L2TP.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_L2TP.c
diff --git a/src/Cedar/IPsec_L2TP.h b/src/Cedar/IPsec_L2TP.h
index 216eb4a7..eac8c0c5 100644
--- a/src/Cedar/IPsec_L2TP.h
+++ b/src/Cedar/IPsec_L2TP.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_L2TP.h
diff --git a/src/Cedar/IPsec_PPP.c b/src/Cedar/IPsec_PPP.c
index 88ef4281..2e3000b7 100644
--- a/src/Cedar/IPsec_PPP.c
+++ b/src/Cedar/IPsec_PPP.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_PPP.c
@@ -1123,7 +1129,7 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
Zero(&cao, sizeof(cao));
- IPCSetIPv4Parameters(p->Ipc, &client_ip, &subnet, &zero);
+ IPCSetIPv4Parameters(p->Ipc, &client_ip, &subnet, &zero, NULL);
p->DhcpIpInformTried = true;
@@ -1163,7 +1169,7 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
PPPLog(p, "LP_DHCP_INFORM_NG");
}
- IPCSetIPv4Parameters(p->Ipc, &zero, &zero, &zero);
+ IPCSetIPv4Parameters(p->Ipc, &zero, &zero, &zero, NULL);
}
}
else
@@ -1251,7 +1257,7 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
UINTToIP(&res.WinsServer1, p->ClientAddressOption.WinsServer);
UINTToIP(&res.WinsServer2, p->ClientAddressOption.WinsServer2);
- if (IPCSetIPv4Parameters(p->Ipc, &res.IpAddress, &subnet, &gw))
+ if (IPCSetIPv4Parameters(p->Ipc, &res.IpAddress, &subnet, &gw, &p->ClientAddressOption.ClasslessRoute))
{
char client_ip_str[64];
char subnet_str[64], defgw_str[64];
diff --git a/src/Cedar/IPsec_PPP.h b/src/Cedar/IPsec_PPP.h
index 2a64c664..b0a08b3e 100644
--- a/src/Cedar/IPsec_PPP.h
+++ b/src/Cedar/IPsec_PPP.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_PPP.h
diff --git a/src/Cedar/IPsec_Win7.c b/src/Cedar/IPsec_Win7.c
index e92bbd32..8b176513 100644
--- a/src/Cedar/IPsec_Win7.c
+++ b/src/Cedar/IPsec_Win7.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_Win7.c
diff --git a/src/Cedar/IPsec_Win7.h b/src/Cedar/IPsec_Win7.h
index d3d4b07b..985259bd 100644
--- a/src/Cedar/IPsec_Win7.h
+++ b/src/Cedar/IPsec_Win7.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_Win7.h
diff --git a/src/Cedar/IPsec_Win7Inner.h b/src/Cedar/IPsec_Win7Inner.h
index f3e52c72..e321958e 100644
--- a/src/Cedar/IPsec_Win7Inner.h
+++ b/src/Cedar/IPsec_Win7Inner.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// IPsec_Win7.h
diff --git a/src/Cedar/Interop_OpenVPN.c b/src/Cedar/Interop_OpenVPN.c
index 3d13df9c..c3c5cf98 100644
--- a/src/Cedar/Interop_OpenVPN.c
+++ b/src/Cedar/Interop_OpenVPN.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Interop_OpenVPN.c
@@ -1926,7 +1932,7 @@ void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol)
{
if (se->IpcAsync->Ipc != NULL)
{
- char option_str[MAX_SIZE];
+ char option_str[4096];
char l3_options[MAX_SIZE];
// Successful in VPN connection
@@ -2050,6 +2056,46 @@ void OvsRecvPacket(OPENVPN_SERVER *s, LIST *recv_packet_list, UINT protocol)
IPToStr32(ip_defgw, sizeof(ip_defgw), cao->Gateway);
}
+ else
+ {
+ // If the default gateway is not specified, add the static routing table
+ // entry for the local IP subnet
+ IP local_network;
+ IP client_ip;
+ IP subnet_mask;
+
+ UINTToIP(&client_ip, cao->ClientAddress);
+ UINTToIP(&subnet_mask, cao->SubnetMask);
+
+ Zero(&local_network, sizeof(IP));
+ IPAnd4(&local_network, &client_ip, &subnet_mask);
+
+ Format(l3_options, sizeof(l3_options),
+ ",route %r %r vpn_gateway",
+ &local_network,
+ &cao->SubnetMask);
+
+ StrCat(option_str, sizeof(option_str), l3_options);
+ }
+
+ // Classless routing table
+ if (cao->ClasslessRoute.NumExistingRoutes >= 1)
+ {
+ UINT i;
+ for (i = 0;i < MAX_DHCP_CLASSLESS_ROUTE_ENTRIES;i++)
+ {
+ DHCP_CLASSLESS_ROUTE *r = &cao->ClasslessRoute.Entries[i];
+
+ if (r->Exists)
+ {
+ Format(l3_options, sizeof(l3_options),
+ ",route %r %r vpn_gateway",
+ &r->Network, &r->SubnetMask);
+
+ StrCat(option_str, sizeof(option_str), l3_options);
+ }
+ }
+ }
OvsLog(s, se, c, "LP_SET_IPV4_PARAM",
ip_client, ip_subnet_mask, ip_defgw, ip_dns1, ip_dns2, ip_wins1, ip_wins2);
diff --git a/src/Cedar/Interop_OpenVPN.h b/src/Cedar/Interop_OpenVPN.h
index 33d800fe..d5ce2686 100644
--- a/src/Cedar/Interop_OpenVPN.h
+++ b/src/Cedar/Interop_OpenVPN.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Interop_OpenVPN.h
diff --git a/src/Cedar/Interop_SSTP.c b/src/Cedar/Interop_SSTP.c
index 4ce39a3f..76521da1 100644
--- a/src/Cedar/Interop_SSTP.c
+++ b/src/Cedar/Interop_SSTP.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Interop_SSTP.c
diff --git a/src/Cedar/Interop_SSTP.h b/src/Cedar/Interop_SSTP.h
index fb08554b..0d0ac87d 100644
--- a/src/Cedar/Interop_SSTP.h
+++ b/src/Cedar/Interop_SSTP.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Interop_SSTP.h
diff --git a/src/Cedar/Layer3.c b/src/Cedar/Layer3.c
index d4bed107..3ca3b2d5 100644
--- a/src/Cedar/Layer3.c
+++ b/src/Cedar/Layer3.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Layer3.c
diff --git a/src/Cedar/Layer3.h b/src/Cedar/Layer3.h
index 6b707160..2276b409 100644
--- a/src/Cedar/Layer3.h
+++ b/src/Cedar/Layer3.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Layer3.h
diff --git a/src/Cedar/Link.c b/src/Cedar/Link.c
index a925b428..25d0af7b 100644
--- a/src/Cedar/Link.c
+++ b/src/Cedar/Link.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Link.c
diff --git a/src/Cedar/Link.h b/src/Cedar/Link.h
index 96c4f7bd..ffc6de28 100644
--- a/src/Cedar/Link.h
+++ b/src/Cedar/Link.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Link.h
diff --git a/src/Cedar/Listener.c b/src/Cedar/Listener.c
index cbd9bf77..843c4dc4 100644
--- a/src/Cedar/Listener.c
+++ b/src/Cedar/Listener.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Listener.c
diff --git a/src/Cedar/Listener.h b/src/Cedar/Listener.h
index 8f90aedc..41806ccd 100644
--- a/src/Cedar/Listener.h
+++ b/src/Cedar/Listener.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Listener.h
diff --git a/src/Cedar/Logging.c b/src/Cedar/Logging.c
index ba069fc8..21529121 100644
--- a/src/Cedar/Logging.c
+++ b/src/Cedar/Logging.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Logging.c
@@ -111,6 +117,48 @@ static char *delete_targets[] =
// Send with syslog
void SendSysLog(SLOG *g, wchar_t *str)
{
+ UCHAR *buf;
+ UINT buf_size;
+ // Validate arguments
+ if (g == NULL || str == NULL)
+ {
+ return;
+ }
+
+ buf_size = CalcUniToUtf8(str);
+ buf = ZeroMalloc(buf_size);
+ UniToUtf8(buf, buf_size, str);
+
+ if (buf_size >= 1024)
+ {
+ buf_size = 1023;
+ }
+
+ Lock(g->lock);
+ {
+ if (Tick64() >= g->NextPollIp)
+ {
+ IP ip;
+
+ if (GetIP(&ip, g->HostName))
+ {
+ g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL;
+ Copy(&g->DestIp, &ip, sizeof(IP));
+ }
+ else
+ {
+ g->NextPollIp = Tick64() + SYSLOG_POLL_IP_INTERVAL_NG;
+ }
+ }
+
+ if (g->DestPort != 0 && IsZeroIp(&g->DestIp) == false)
+ {
+ SendTo(g->Udp, &g->DestIp, g->DestPort, buf, buf_size);
+ }
+ }
+ Unlock(g->lock);
+
+ Free(buf);
}
// Release the syslog client
@@ -962,6 +1010,172 @@ void WriteSecurityLog(HUB *h, char *str)
// Take a packet log
bool PacketLog(HUB *hub, SESSION *src_session, SESSION *dest_session, PKT *packet, UINT64 now)
{
+ UINT level;
+ PKT *p;
+ PACKET_LOG *pl;
+ SERVER *s;
+ UINT syslog_setting;
+ bool no_log = false;
+ // Validate arguments
+ if (hub == NULL || src_session == NULL || packet == NULL)
+ {
+ return true;
+ }
+
+ s = hub->Cedar->Server;
+
+ if (hub->LogSetting.SavePacketLog == false)
+ {
+ // Do not take the packet log
+ return true;
+ }
+
+ if (Cmp(hub->HubMacAddr, packet->MacAddressSrc, 6) == 0 ||
+ Cmp(hub->HubMacAddr, packet->MacAddressDest, 6) == 0)
+ {
+ return true;
+ }
+
+ // Determine the logging level
+ level = CalcPacketLoggingLevel(hub, packet);
+ if (level == PACKET_LOG_NONE)
+ {
+ // Not save
+ return true;
+ }
+
+ if (hub->Option != NULL)
+ {
+ if (hub->Option->NoIPv4PacketLog && (packet->TypeL3 == L3_IPV4 || packet->TypeL3 == L3_ARPV4))
+ {
+ // Do not save any IPv4 packet log
+ return true;
+ }
+
+ if (hub->Option->NoIPv6PacketLog && packet->TypeL3 == L3_IPV6)
+ {
+ // Do not save any IPv6 packet log
+ return true;
+ }
+ }
+
+ if (hub->Option != NULL && hub->Option->MaxLoggedPacketsPerMinute != 0)
+ {
+ // Examine the maximum number of logging target packets per minute
+ if (CheckMaxLoggedPacketsPerMinute(src_session, hub->Option->MaxLoggedPacketsPerMinute, now) == false)
+ {
+ // Indicate the packet discarding without taking the packet log if exceed
+ return false;
+ }
+ }
+
+ if (true)
+ {
+ if (GetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING) != 0)
+ {
+ no_log = true;
+ }
+
+ if (hub->IsVgsHub)
+ {
+ no_log = false;
+ }
+ }
+
+ syslog_setting = SiGetSysLogSaveStatus(s);
+
+ // Clone of packet
+ p = ClonePacket(packet, level == PACKET_LOG_ALL ? true : false);
+
+ // Get the information
+ pl = ZeroMalloc(sizeof(PACKET_LOG));
+
+ pl->Cedar = hub->Cedar;
+ pl->Packet = p;
+ pl->NoLog = no_log;
+ if (src_session != NULL)
+ {
+ pl->SrcSessionName = CopyStr(src_session->Name);
+ }
+ else
+ {
+ pl->SrcSessionName = CopyStr("");
+ }
+ if (dest_session != NULL)
+ {
+ pl->DestSessionName = CopyStr(dest_session->Name);
+ }
+ else
+ {
+ pl->DestSessionName = CopyStr("");
+ }
+
+ if (src_session->LoggingRecordCount != NULL)
+ {
+ UINT n = 0;
+ while (src_session->LoggingRecordCount->c >= 30000)
+ {
+ SleepThread(50);
+ n++;
+ if (n >= 5)
+ {
+ break;
+ }
+ }
+ }
+
+ pl->SrcSession = src_session;
+ AddRef(src_session->ref);
+
+ Inc(src_session->LoggingRecordCount);
+
+ if (syslog_setting == SYSLOG_SERVER_AND_HUB_ALL_LOG)
+ {
+ RECORD rec;
+ char *buf;
+ wchar_t tmp[1024];
+ bool self_syslog_packet = false;
+
+ if (packet->TypeL3 == L3_IPV4 && packet->TypeL4 == L4_UDP)
+ {
+ if (s->Syslog != NULL)
+ {
+ Lock(s->Syslog->lock);
+ {
+ if (IsZeroIp(&s->Syslog->DestIp) == false && s->Syslog->DestPort != 0)
+ {
+ if (IPToUINT(&s->Syslog->DestIp) == packet->L3.IPv4Header->DstIP)
+ {
+ if (Endian32(packet->L4.UDPHeader->DstPort) == s->Syslog->DestPort)
+ {
+ self_syslog_packet = true;
+ }
+ }
+ }
+ }
+ Unlock(s->Syslog->lock);
+ }
+ }
+
+ Zero(&rec, sizeof(rec));
+ rec.Data = pl;
+
+ buf = PacketLogParseProc(&rec);
+ StrToUni(tmp, sizeof(tmp), buf);
+
+ if (self_syslog_packet == false)
+ {
+ SiWriteSysLog(s, "PACKET_LOG", hub->Name, tmp);
+ }
+
+ Free(buf);
+ }
+ else
+ {
+ // Insertion of packet log
+ InsertRecord(hub->PacketLogger, pl, PacketLogParseProc);
+ }
+
return true;
}
@@ -1209,7 +1423,588 @@ void MakeSafeLogStr(char *str)
// Procedure for converting a packet log entry to a string
char *PacketLogParseProc(RECORD *rec)
{
- return NULL;
+ PACKET_LOG *pl;
+ PKT *p;
+ char *s;
+ TOKEN_LIST *t;
+ char tmp[MAX_SIZE];
+ bool tcp_conn;
+ // Validate arguments
+ if (rec == NULL)
+ {
+ return NULL;
+ }
+
+ pl = (PACKET_LOG *)rec->Data;
+ p = pl->Packet;
+
+ // Generate each part
+ t = ZeroMalloc(sizeof(TOKEN_LIST));
+ t->NumTokens = 16;
+ t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens);
+
+ // Source session
+ t->Token[0] = pl->SrcSessionName;
+
+ // Destination session
+ t->Token[1] = pl->DestSessionName;
+
+ // Source MAC address
+ BinToStr(tmp, sizeof(tmp), p->MacAddressSrc, 6);
+
+ t->Token[2] = CopyStr(tmp);
+ // Destination MAC address
+ BinToStr(tmp, sizeof(tmp), p->MacAddressDest, 6);
+
+ t->Token[3] = CopyStr(tmp);
+
+ // MAC protocol
+ snprintf(tmp, sizeof(tmp), "0x%04X", Endian16(p->MacHeader->Protocol));
+ t->Token[4] = CopyStr(tmp);
+
+ // Packet size
+ ToStr(tmp, p->PacketSize);
+ t->Token[5] = CopyStr(tmp);
+
+ if (pl->NoLog == false)
+ {
+ // Type of packet
+ switch (p->TypeL3)
+ {
+ case L3_ARPV4:
+ // ARP packets
+ t->Token[6] = CopyStr("ARPv4");
+
+ switch (Endian16(p->L3.ARPv4Header->Operation))
+ {
+ case ARP_OPERATION_REQUEST:
+ // ARP request packet
+ t->Token[7] = CopyStr("Request");
+ if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET &&
+ p->L3.ARPv4Header->HardwareSize == 6 &&
+ Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 &&
+ p->L3.ARPv4Header->ProtocolSize == 4)
+ {
+ char src_mac[16];
+ char src_ip[16];
+ IP src_ip_st;
+ char dst_ip[16];
+ IP dst_ip_st;
+ BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6);
+ UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP);
+ UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP);
+ IPToStr(src_ip, sizeof(src_ip), &src_ip_st);
+ IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st);
+ snprintf(tmp, sizeof(tmp), "Who has %s? Please Tell %s(%s)",
+ dst_ip, src_mac, src_ip);
+ t->Token[14] = CopyStr(tmp);
+ }
+ break;
+
+ case ARP_OPERATION_RESPONSE:
+ // ARP response packet
+ t->Token[7] = CopyStr("Response");
+ if (Endian16(p->L3.ARPv4Header->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET &&
+ p->L3.ARPv4Header->HardwareSize == 6 &&
+ Endian16(p->L3.ARPv4Header->ProtocolType) == MAC_PROTO_IPV4 &&
+ p->L3.ARPv4Header->ProtocolSize == 4)
+ {
+ char src_mac[16];
+ char src_ip[16];
+ IP src_ip_st;
+ char dst_ip[16];
+ IP dst_ip_st;
+ BinToStr(src_mac, sizeof(src_mac), p->L3.ARPv4Header->SrcAddress, 6);
+ UINTToIP(&src_ip_st, p->L3.ARPv4Header->SrcIP);
+ UINTToIP(&dst_ip_st, p->L3.ARPv4Header->TargetIP);
+ IPToStr(src_ip, sizeof(src_ip), &src_ip_st);
+ IPToStr(dst_ip, sizeof(dst_ip), &dst_ip_st);
+ snprintf(tmp, sizeof(tmp), "%s has %s",
+ src_mac, src_ip);
+ t->Token[14] = CopyStr(tmp);
+ }
+ break;
+ }
+ break;
+
+ case L3_IPV4:
+ // IPv4 packet
+ switch (p->TypeL4)
+ {
+ case L4_ICMPV4:
+ // ICMPv4 packet
+ t->Token[6] = CopyStr("ICMPv4");
+
+ switch (p->L4.ICMPHeader->Type)
+ {
+ case ICMP_TYPE_ECHO_REQUEST:
+ // Echo request
+ t->Token[7] = CopyStr("Echo Request");
+ break;
+
+ case ICMP_TYPE_ECHO_RESPONSE:
+ // Echo response
+ t->Token[7] = CopyStr("Echo Reply");
+ break;
+ }
+ break;
+
+ case L4_TCP:
+ // TCP packet
+ tcp_conn = false;
+ if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN)
+ {
+ tcp_conn = true;
+ }
+ t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv4" : "TCP_DATAv4");
+ t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag);
+
+ t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false);
+ t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false);
+
+ ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber));
+ t->Token[12] = CopyStr(tmp);
+
+ ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber));
+ t->Token[13] = CopyStr(tmp);
+
+ snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize));
+
+ if (p->HttpLog != NULL)
+ {
+ char *tmp2;
+ UINT tmp2_size;
+ char *http_str = BuildHttpLogStr(p->HttpLog);
+
+ tmp2_size = StrLen(http_str) + 16 + StrLen(tmp);
+ tmp2 = Malloc(tmp2_size);
+
+ StrCpy(tmp2, tmp2_size, tmp);
+
+ if (IsEmptyStr(http_str) == false)
+ {
+ StrCat(tmp2, tmp2_size, " ");
+ StrCat(tmp2, tmp2_size, http_str);
+ }
+
+ Free(http_str);
+
+ t->Token[14] = tmp2;
+ }
+ else
+ {
+ t->Token[14] = CopyStr(tmp);
+ }
+ break;
+
+ case L4_UDP:
+ // UDP packet
+ t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true);
+ t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true);
+
+ switch (p->TypeL7)
+ {
+ case L7_DHCPV4:
+ // DHCP packet
+ t->Token[6] = CopyStr("DHCPv4");
+ if (p->L7.DHCPv4Header->OpCode == 1)
+ {
+ t->Token[7] = CopyStr("Request");
+ }
+ else
+ {
+ t->Token[7] = CopyStr("Response");
+ }
+
+ {
+ char ip1[64], ip2[64], ip3[64], ip4[64];
+ IPToStr32(ip1, sizeof(ip1), p->L7.DHCPv4Header->ClientIP);
+ IPToStr32(ip2, sizeof(ip2), p->L7.DHCPv4Header->YourIP);
+ IPToStr32(ip3, sizeof(ip3), p->L7.DHCPv4Header->ServerIP);
+ IPToStr32(ip4, sizeof(ip4), p->L7.DHCPv4Header->RelayIP);
+
+ snprintf(tmp, sizeof(tmp),
+ "TransactionId=%u ClientIP=%s YourIP=%s ServerIP=%s RelayIP=%s",
+ Endian32(p->L7.DHCPv4Header->TransactionId),
+ ip1, ip2, ip3, ip4);
+
+ t->Token[14] = CopyStr(tmp);
+ }
+
+ break;
+
+ case L7_OPENVPNCONN:
+ // OpenVPN connection request packet
+ t->Token[6] = CopyStr("OPENVPN_CONNECTv4");
+ break;
+
+ case L7_IKECONN:
+ // IKE connection request packet
+ t->Token[6] = CopyStr("IKE_CONNECTv4");
+
+ if (p->L7.IkeHeader != NULL)
+ {
+ if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN)
+ {
+ t->Token[7] = CopyStr("MainMode");
+ }
+ else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN)
+ {
+ t->Token[7] = CopyStr("AgressiveMode");
+ }
+
+ {
+ Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u "
+ "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u",
+ Endian64(p->L7.IkeHeader->InitiatorCookie),
+ Endian64(p->L7.IkeHeader->ResponderCookie),
+ p->L7.IkeHeader->Version,
+ p->L7.IkeHeader->ExchangeType,
+ p->L7.IkeHeader->Flag,
+ Endian32(p->L7.IkeHeader->MessageId),
+ Endian32(p->L7.IkeHeader->MessageSize));
+
+ t->Token[14] = CopyStr(tmp);
+ }
+ }
+ break;
+
+ default:
+ // Unknown Packet
+ t->Token[6] = CopyStr("UDPv4");
+ break;
+ }
+ break;
+
+ case L4_FRAGMENT:
+ // Fragment
+ snprintf(tmp, sizeof(tmp), "IPv4_Fragment(0x%02X)", p->L3.IPv4Header->Protocol);
+ t->Token[6] = CopyStr(tmp);
+ break;
+
+ case L4_UNKNOWN:
+ // Unknown Packet
+ snprintf(tmp, sizeof(tmp), "IPv4(0x%02X)", p->L3.IPv4Header->Protocol);
+ t->Token[6] = CopyStr(tmp);
+ break;
+ }
+
+ // Source IP address
+ IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->SrcIP);
+ t->Token[8] = CopyStr(tmp);
+
+ // Destination IP address
+ IPToStr32(tmp, sizeof(tmp), p->L3.IPv4Header->DstIP);
+ t->Token[10] = CopyStr(tmp);
+
+ break;
+
+ case L3_IPV6:
+ // IPv6 packet
+ switch (p->TypeL4)
+ {
+ case L4_ICMPV6:
+ {
+ char info[MAX_SIZE];
+ ICMPV6_HEADER_INFO *icmp = &p->ICMPv6HeaderPacketInfo;
+ ICMPV6_OPTION_LIST *ol = &icmp->OptionList;
+
+ Zero(info, sizeof(info));
+
+ // ICMPv6 packet
+ t->Token[6] = CopyStr("ICMPv6");
+
+ switch (icmp->Type)
+ {
+ case ICMPV6_TYPE_ECHO_REQUEST:
+ // Echo request
+ t->Token[7] = CopyStr("Echo Request");
+ snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize);
+ StrCat(info, sizeof(info), tmp);
+ break;
+
+ case ICMPV6_TYPE_ECHO_RESPONSE:
+ // Echo response
+ t->Token[7] = CopyStr("Echo Reply");
+ snprintf(tmp, sizeof(tmp), "EchoDataSize=%u ", icmp->EchoDataSize);
+ StrCat(info, sizeof(info), tmp);
+ break;
+
+ case ICMPV6_TYPE_ROUTER_SOLICIATION:
+ {
+ ICMPV6_ROUTER_SOLICIATION_HEADER *h = icmp->Headers.RouterSoliciationHeader;
+ // Router Solicitation
+ t->Token[7] = CopyStr("Router Soliciation");
+
+ if (h != NULL)
+ {
+ // No additional information
+ }
+ }
+ break;
+
+ case ICMPV6_TYPE_ROUTER_ADVERTISEMENT:
+ {
+ ICMPV6_ROUTER_ADVERTISEMENT_HEADER *h = icmp->Headers.RouterAdvertisementHeader;
+ // Router Advertisement
+ t->Token[7] = CopyStr("Router Advertisement");
+
+ if (h != NULL)
+ {
+ snprintf(tmp, sizeof(tmp), "CurHopLimit=%u "
+ "Flags=0x%02X Lifetime=%u ",
+ h->CurHopLimit, h->Flags, Endian16(h->Lifetime));
+ StrCat(info, sizeof(info), tmp);
+ }
+ }
+ break;
+
+ case ICMPV6_TYPE_NEIGHBOR_SOLICIATION:
+ {
+ ICMPV6_NEIGHBOR_SOLICIATION_HEADER *h = icmp->Headers.NeighborSoliciationHeader;
+ // Neighbor Solicitation
+ t->Token[7] = CopyStr("Neighbor Soliciation");
+
+ if (h != NULL)
+ {
+ char tmp2[MAX_SIZE];
+
+ IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress);
+
+ snprintf(tmp, sizeof(tmp), "TargetAddress=%s ",
+ tmp2);
+ StrCat(info, sizeof(info), tmp);
+ }
+ }
+ break;
+
+ case ICMPV6_TYPE_NEIGHBOR_ADVERTISEMENT:
+ {
+ ICMPV6_NEIGHBOR_ADVERTISEMENT_HEADER *h = icmp->Headers.NeighborAdvertisementHeader;
+ // Neighbor Advertisement
+ t->Token[7] = CopyStr("Neighbor Advertisement");
+
+ if (h != NULL)
+ {
+ char tmp2[MAX_SIZE];
+
+ IP6AddrToStr(tmp2, sizeof(tmp2), &h->TargetAddress);
+
+ snprintf(tmp, sizeof(tmp), "TargetAddress=%s Flags=0x%02X ",
+ tmp2, h->Flags);
+ StrCat(info, sizeof(info), tmp);
+ }
+ }
+ break;
+
+ default:
+ {
+ snprintf(tmp, sizeof(tmp), "Type=%u", icmp->Type);
+ t->Token[7] = CopyStr(tmp);
+ }
+ break;
+ }
+
+ // Option data
+ if (ol->SourceLinkLayer != NULL)
+ {
+ char tmp2[MAX_SIZE];
+ BinToStr(tmp2, sizeof(tmp2), ol->SourceLinkLayer->Address, 6);
+ snprintf(tmp, sizeof(tmp), "SourceLinkLayer=%s ", tmp2);
+ StrCat(info, sizeof(info), tmp);
+ }
+ if (ol->TargetLinkLayer != NULL)
+ {
+ char tmp2[MAX_SIZE];
+ BinToStr(tmp2, sizeof(tmp2), ol->TargetLinkLayer->Address, 6);
+ snprintf(tmp, sizeof(tmp), "TargetLinkLayer=%s ", tmp2);
+ StrCat(info, sizeof(info), tmp);
+ }
+ if (ol->Prefix != NULL)
+ {
+ char tmp2[MAX_SIZE];
+ IP6AddrToStr(tmp2, sizeof(tmp2), &ol->Prefix->Prefix);
+ snprintf(tmp, sizeof(tmp), "Prefix=%s/%u PrefixFlag=0x%02X ", tmp2,
+ ol->Prefix->SubnetLength, ol->Prefix->Flags);
+ StrCat(info, sizeof(info), tmp);
+ }
+ if (ol->Mtu != NULL)
+ {
+ snprintf(tmp, sizeof(tmp), "Mtu=%u ", Endian32(ol->Mtu->Mtu));
+ StrCat(info, sizeof(info), tmp);
+ }
+
+ Trim(info);
+
+ if (IsEmptyStr(info) == false)
+ {
+ t->Token[14] = CopyStr(info);
+ }
+ }
+ break;
+
+ case L4_TCP:
+ // TCP packet
+ tcp_conn = false;
+ if (p->L4.TCPHeader->Flag & TCP_SYN || p->L4.TCPHeader->Flag & TCP_RST || p->L4.TCPHeader->Flag & TCP_FIN)
+ {
+ tcp_conn = true;
+ }
+ t->Token[6] = CopyStr(tcp_conn ? "TCP_CONNECTv6" : "TCP_DATAv6");
+ t->Token[7] = TcpFlagStr(p->L4.TCPHeader->Flag);
+
+ t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->SrcPort), false);
+ t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.TCPHeader->DstPort), false);
+
+ ToStr(tmp, Endian32(p->L4.TCPHeader->SeqNumber));
+ t->Token[12] = CopyStr(tmp);
+
+ ToStr(tmp, Endian32(p->L4.TCPHeader->AckNumber));
+ t->Token[13] = CopyStr(tmp);
+
+ snprintf(tmp, sizeof(tmp), "WindowSize=%u", Endian16(p->L4.TCPHeader->WindowSize));
+
+ if (p->HttpLog != NULL)
+ {
+ char *tmp2;
+ UINT tmp2_size;
+ char *http_str = BuildHttpLogStr(p->HttpLog);
+
+ tmp2_size = StrLen(http_str) + 16 + StrLen(tmp);
+ tmp2 = Malloc(tmp2_size);
+
+ StrCpy(tmp2, tmp2_size, tmp);
+
+ if (IsEmptyStr(http_str) == false)
+ {
+ StrCat(tmp2, tmp2_size, " ");
+ StrCat(tmp2, tmp2_size, http_str);
+ }
+
+ Free(http_str);
+
+ t->Token[14] = tmp2;
+ }
+ else
+ {
+ t->Token[14] = CopyStr(tmp);
+ }
+ break;
+
+ case L4_UDP:
+ // UDP packet
+ t->Token[9] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->SrcPort), true);
+ t->Token[11] = PortStr(pl->Cedar, Endian16(p->L4.UDPHeader->DstPort), true);
+
+ switch (p->TypeL7)
+ {
+ case L7_OPENVPNCONN:
+ // OpenVPN connection request packet
+ t->Token[6] = CopyStr("OPENVPN_CONNECTv6");
+ break;
+
+ case L7_IKECONN:
+ // IKE connection request packet
+ t->Token[6] = CopyStr("IKE_CONNECTv6");
+
+ if (p->L7.IkeHeader != NULL)
+ {
+ if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN)
+ {
+ t->Token[7] = CopyStr("MainMode");
+ }
+ else if (p->L7.IkeHeader->ExchangeType == IKE_EXCHANGE_TYPE_MAIN)
+ {
+ t->Token[7] = CopyStr("AgressiveMode");
+ }
+
+ {
+ Format(tmp, sizeof(tmp), "InitiatorCookie=%I64u ResponderCookie=%I64u "
+ "Version=0x%x ExchangeType=0x%x Flag=0x%x MessageId=%u MessageSize=%u",
+ Endian64(p->L7.IkeHeader->InitiatorCookie),
+ Endian64(p->L7.IkeHeader->ResponderCookie),
+ p->L7.IkeHeader->Version,
+ p->L7.IkeHeader->ExchangeType,
+ p->L7.IkeHeader->Flag,
+ Endian32(p->L7.IkeHeader->MessageId),
+ Endian32(p->L7.IkeHeader->MessageSize));
+
+ t->Token[14] = CopyStr(tmp);
+ }
+ }
+ break;
+
+ default:
+ t->Token[6] = CopyStr("UDPv6");
+ break;
+ }
+ break;
+
+ case L4_FRAGMENT:
+ // Fragment packet
+ snprintf(tmp, sizeof(tmp), "IPv6_Fragment(0x%02X)", p->IPv6HeaderPacketInfo.Protocol);
+ t->Token[6] = CopyStr(tmp);
+ break;
+
+ case L4_UNKNOWN:
+ // Unknown Packet
+ snprintf(tmp, sizeof(tmp), "IPv6(0x%02X)", p->IPv6HeaderPacketInfo.Protocol);
+ t->Token[6] = CopyStr(tmp);
+ break;
+ }
+
+ // Source IP address
+ IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->SrcAddress);
+ t->Token[8] = CopyStr(tmp);
+
+ // Destination IP address
+ IP6AddrToStr(tmp, sizeof(tmp), &p->L3.IPv6Header->DestAddress);
+ t->Token[10] = CopyStr(tmp);
+
+ break;
+
+ case L3_UNKNOWN:
+ // Unknown Packet
+ snprintf(tmp, sizeof(tmp), "Proto=0x%04X", Endian16(p->MacHeader->Protocol));
+ t->Token[6] = CopyStr(tmp);
+ break;
+ }
+
+ if (p->PacketData != NULL && (pl->PurePacket == false || pl->PurePacketNoPayload == false))
+ {
+ char *data = Malloc(p->PacketSize * 2 + 1);
+ BinToStr(data, p->PacketSize * 2 + 1, p->PacketData, p->PacketSize);
+ t->Token[15] = data;
+ }
+ }
+ else
+ {
+ t->Token[6] = CopyUniToUtf(_UU("LH_PACKET_LOG_NO_LOG_OSS"));
+ }
+
+ s = GenCsvLine(t);
+ FreeToken(t);
+
+ // Discard the packet data
+ if (pl->PurePacket == false)
+ {
+ FreeClonePacket(p);
+ }
+ else
+ {
+ Free(p->PacketData);
+ FreePacket(p);
+ }
+
+ // Release the session
+ if (pl->SrcSession != NULL)
+ {
+ Dec(pl->SrcSession->LoggingRecordCount);
+ ReleaseSession(pl->SrcSession);
+ }
+ Free(pl);
+
+ return s;
}
// Convert TCP flags to a string
diff --git a/src/Cedar/Logging.h b/src/Cedar/Logging.h
index 5db70d66..bcf8c84f 100644
--- a/src/Cedar/Logging.h
+++ b/src/Cedar/Logging.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Logging.h
diff --git a/src/Cedar/NM.c b/src/Cedar/NM.c
index c934c3ce..d6f6ebbb 100644
--- a/src/Cedar/NM.c
+++ b/src/Cedar/NM.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NM.c
@@ -125,6 +131,87 @@
// Global variable
static NM *nm = NULL;
+// Dialog proc for the push routing option
+UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
+{
+ SM_HUB *r = (SM_HUB *)param;
+ char *str = NULL;
+ // Validate arguments
+ if (hWnd == NULL)
+ {
+ return 0;
+ }
+
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ SetTextA(hWnd, E_TEXT, r->CurrentPushRouteStr);
+ Focus(hWnd, E_TEXT);
+
+ SetIcon(hWnd, 0, ICO_PROTOCOL);
+ break;
+
+ case WM_COMMAND:
+ switch (wParam)
+ {
+ case IDOK:
+ str = GetTextA(hWnd, E_TEXT);
+ if (str != NULL)
+ {
+ bool ok = true;
+
+ if (CheckClasslessRouteTableStr(str) == false)
+ {
+ if (MsgBox(hWnd, MB_ICONWARNING | MB_OKCANCEL | MB_DEFBUTTON2, _UU("NM_PUSH_ROUTE_WARNING")) == IDCANCEL)
+ {
+ ok = false;
+ }
+ }
+
+ if (ok)
+ {
+ if (IsEmptyStr(r->CurrentPushRouteStr) == false)
+ {
+ if (GetCapsBool(r->p->CapsList, "b_suppport_push_route") == false)
+ {
+ MsgBox(hWnd, MB_ICONEXCLAMATION, _UU("ERR_147"));
+ }
+ }
+
+ StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), str);
+
+ EndDialog(hWnd, 1);
+ }
+
+ Free(str);
+ }
+ break;
+
+ case IDCANCEL:
+ Close(hWnd);
+ break;
+ }
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hWnd, 0);
+ break;
+ }
+
+ return 0;
+}
+
+// Edit dialog for the push routing option
+bool NmEditPushRoute(HWND hWnd, SM_HUB *r)
+{
+ // Validate arguments
+ if (r == NULL)
+ {
+ return false;
+ }
+
+ return Dialog(hWnd, D_NM_PUSH, NmEditPushRouteProc, r);
+}
// Change Password dialog
UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
@@ -745,6 +832,8 @@ void NmEditVhOptionInit(HWND hWnd, SM_HUB *r)
return;
}
+ SetIcon(hWnd, 0, ICO_ROUTER);
+
FormatText(hWnd, S_TITLE, r->HubName);
Zero(&t, sizeof(VH_OPTION));
@@ -795,6 +884,15 @@ void NmEditVhOptionInit(HWND hWnd, SM_HUB *r)
SetTextA(hWnd, E_DOMAIN, t.DhcpDomainName);
Check(hWnd, R_SAVE_LOG, t.SaveLog);
+ StrCpy(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr), t.DhcpPushRoutes);
+
+ if (GetCapsBool(r->p->CapsList, "b_suppport_push_route_config") == false)
+ {
+ Disable(hWnd, S_1);
+ Disable(hWnd, S_2);
+ Disable(hWnd, B_PUSH);
+ }
+
NmEditVhOptionUpdate(hWnd, r);
}
@@ -929,6 +1027,9 @@ void NmEditVhOptionOnOk(HWND hWnd, SM_HUB *r)
NmEditVhOptionFormToVH(hWnd, &t);
StrCpy(t.HubName, sizeof(t.HubName), r->HubName);
+ t.ApplyDhcpPushRoutes = true;
+ StrCpy(t.DhcpPushRoutes, sizeof(t.DhcpPushRoutes), r->CurrentPushRouteStr);
+
if (CALL(hWnd, ScSetSecureNATOption(r->Rpc, &t)))
{
EndDialog(hWnd, true);
@@ -996,6 +1097,10 @@ UINT NmEditVhOptionProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void
Focus(hWnd, E_DHCP_START);
}
break;
+
+ case B_PUSH:
+ NmEditPushRoute(hWnd, r);
+ break;
}
break;
@@ -1013,6 +1118,7 @@ void NmEditVhOption(HWND hWnd, SM_HUB *r)
return;
}
+ Zero(r->CurrentPushRouteStr, sizeof(r->CurrentPushRouteStr));
Dialog(hWnd, D_NM_OPTION, NmEditVhOptionProc, r);
}
diff --git a/src/Cedar/NM.h b/src/Cedar/NM.h
index 2479bf7a..6ea72fe2 100644
--- a/src/Cedar/NM.h
+++ b/src/Cedar/NM.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NM.h
diff --git a/src/Cedar/NMInner.h b/src/Cedar/NMInner.h
index 05d7e31d..4588e977 100644
--- a/src/Cedar/NMInner.h
+++ b/src/Cedar/NMInner.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NMInner.h
@@ -151,6 +157,10 @@ void NmDhcpRefresh(HWND hWnd, SM_HUB *r);
void NmDhcpInit(HWND hWnd, SM_HUB *r);
void NmChangePassword(HWND hWnd, RPC *r);
UINT NmChangePasswordProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
+bool NmEditPushRoute(HWND hWnd, SM_HUB *r);
+UINT NmEditPushRouteProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param);
+
+
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
// Department of Computer Science has dozens of overly-enthusiastic geeks.
diff --git a/src/Cedar/Nat.c b/src/Cedar/Nat.c
index 5d501a61..a3ab79bc 100644
--- a/src/Cedar/Nat.c
+++ b/src/Cedar/Nat.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Nat.c
@@ -808,6 +814,8 @@ void InVhOption(VH_OPTION *t, PACK *p)
PackGetStr(p, "DhcpDomainName", t->DhcpDomainName, sizeof(t->DhcpDomainName));
t->SaveLog = PackGetBool(p, "SaveLog");
PackGetStr(p, "RpcHubName", t->HubName, sizeof(t->HubName));
+ t->ApplyDhcpPushRoutes = PackGetBool(p, "ApplyDhcpPushRoutes");
+ PackGetStr(p, "DhcpPushRoutes", t->DhcpPushRoutes, sizeof(t->DhcpPushRoutes));
}
void OutVhOption(PACK *p, VH_OPTION *t)
{
@@ -835,6 +843,8 @@ void OutVhOption(PACK *p, VH_OPTION *t)
PackAddStr(p, "DhcpDomainName", t->DhcpDomainName);
PackAddBool(p, "SaveLog", t->SaveLog);
PackAddStr(p, "RpcHubName", t->HubName);
+ PackAddBool(p, "ApplyDhcpPushRoutes", true);
+ PackAddStr(p, "DhcpPushRoutes", t->DhcpPushRoutes);
}
// RPC_ENUM_DHCP
@@ -1465,6 +1475,15 @@ void NiLoadVhOptionEx(VH_OPTION *o, FOLDER *root)
CfgGetIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2);
CfgGetStr(dhcp, "DhcpDomainName", o->DhcpDomainName, sizeof(o->DhcpDomainName));
+ CfgGetStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes));
+
+// Test code
+// StrCpy(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes),
+// "130.158.6.0/24/192.168.9.2 130.158.80.244/255.255.255.255/192.168.9.2");
+
+ NormalizeClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), o->DhcpPushRoutes);
+ o->ApplyDhcpPushRoutes = true;
+
Trim(o->DhcpDomainName);
if (StrLen(o->DhcpDomainName) == 0)
{
@@ -1595,6 +1614,7 @@ void NiWriteVhOptionEx(VH_OPTION *o, FOLDER *root)
CfgAddIp(dhcp, "DhcpDnsServerAddress", &o->DhcpDnsServerAddress);
CfgAddIp(dhcp, "DhcpDnsServerAddress2", &o->DhcpDnsServerAddress2);
CfgAddStr(dhcp, "DhcpDomainName", o->DhcpDomainName);
+ CfgAddStr(dhcp, "DhcpPushRoutes", o->DhcpPushRoutes);
CfgAddBool(root, "SaveLog", o->SaveLog);
}
diff --git a/src/Cedar/Nat.h b/src/Cedar/Nat.h
index d29cf720..f3a5b9d5 100644
--- a/src/Cedar/Nat.h
+++ b/src/Cedar/Nat.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Nat.h
diff --git a/src/Cedar/NativeStack.c b/src/Cedar/NativeStack.c
index c4f2db52..87bdb950 100644
--- a/src/Cedar/NativeStack.c
+++ b/src/Cedar/NativeStack.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NativeStack.c
diff --git a/src/Cedar/NativeStack.h b/src/Cedar/NativeStack.h
index 475a4d54..ce9b0692 100644
--- a/src/Cedar/NativeStack.h
+++ b/src/Cedar/NativeStack.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NativeStack.h
diff --git a/src/Cedar/NullLan.c b/src/Cedar/NullLan.c
index 9e8b6770..2bcacc83 100644
--- a/src/Cedar/NullLan.c
+++ b/src/Cedar/NullLan.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NullLan.c
diff --git a/src/Cedar/NullLan.h b/src/Cedar/NullLan.h
index 2b3dd535..79eb4260 100644
--- a/src/Cedar/NullLan.h
+++ b/src/Cedar/NullLan.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// NullLan.h
diff --git a/src/Cedar/Protocol.c b/src/Cedar/Protocol.c
index bb0178bc..b421d21a 100644
--- a/src/Cedar/Protocol.c
+++ b/src/Cedar/Protocol.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Protocol.c
@@ -1111,6 +1117,28 @@ bool ServerAccept(CONNECTION *c)
goto CLEANUP;
}
+ if (GetGlobalServerFlag(GSF_DISABLE_AC) == 0)
+ {
+ if (hub->HubDb != NULL && c->FirstSock != NULL)
+ {
+ IP ip;
+
+ Copy(&ip, &c->FirstSock->RemoteIP, sizeof(IP));
+
+ if (IsIpDeniedByAcList(&ip, hub->HubDb->AcList))
+ {
+ char ip_str[64];
+ // Access denied
+ ReleaseHub(hub);
+ hub = NULL;
+ FreePack(p);
+ c->Err = ERR_IP_ADDRESS_DENIED;
+ IPToStr(ip_str, sizeof(ip_str), &ip);
+ SLog(c->Cedar, "LS_IP_DENIED", c->Name, ip_str);
+ goto CLEANUP;
+ }
+ }
+ }
Lock(hub->lock);
{
@@ -1486,7 +1514,7 @@ bool ServerAccept(CONNECTION *c)
{
// Attempt external authentication registered users
bool fail_ext_user_auth = false;
- if (true)
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
{
fail_ext_user_auth = true;
}
@@ -1502,6 +1530,36 @@ bool ServerAccept(CONNECTION *c)
}
}
+ if (auth_ret == false)
+ {
+ // Attempt external authentication asterisk user
+ bool b = false;
+ bool fail_ext_user_auth = false;
+
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
+ {
+ fail_ext_user_auth = true;
+ }
+
+ if (fail_ext_user_auth == false)
+ {
+ AcLock(hub);
+ {
+ b = AcIsUser(hub, "*");
+ }
+ AcUnlock(hub);
+
+ // If there is asterisk user, log on as the user
+ if (b)
+ {
+ auth_ret = SamAuthUserByPlainPassword(c, hub, username, plain_password, true, mschap_v2_server_response_20);
+ if (auth_ret && pol == NULL)
+ {
+ pol = SamGetUserPolicy(hub, "*");
+ }
+ }
+ }
+ }
if (pol != NULL)
{
@@ -1519,13 +1577,66 @@ bool ServerAccept(CONNECTION *c)
break;
case CLIENT_AUTHTYPE_CERT:
- // Certificate authentication is not supported in the open source version
- HLog(hub, "LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE", c->Name, username);
- Unlock(hub->lock);
- ReleaseHub(hub);
- FreePack(p);
- c->Err = ERR_AUTHTYPE_NOT_SUPPORTED;
- goto CLEANUP;
+ if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) != 0)
+ {
+ // Certificate authentication
+ cert_size = PackGetDataSize(p, "cert");
+ if (cert_size >= 1 && cert_size <= 100000)
+ {
+ cert_buf = ZeroMalloc(cert_size);
+ if (PackGetData(p, "cert", cert_buf))
+ {
+ UCHAR sign[4096 / 8];
+ UINT sign_size = PackGetDataSize(p, "sign");
+ if (sign_size <= sizeof(sign) && sign_size >= 1)
+ {
+ if (PackGetData(p, "sign", sign))
+ {
+ BUF *b = NewBuf();
+ X *x;
+ WriteBuf(b, cert_buf, cert_size);
+ x = BufToX(b, false);
+ if (x != NULL && x->is_compatible_bit &&
+ sign_size == (x->bits / 8))
+ {
+ K *k = GetKFromX(x);
+ // Verify the signature received from the client
+ if (RsaVerifyEx(c->Random, SHA1_SIZE, sign, k, x->bits))
+ {
+ // Confirmed that the client has had this certificate
+ // certainly because the signature matched.
+ // Check whether the certificate is valid.
+ auth_ret = SamAuthUserByCert(hub, username, x);
+ if (auth_ret)
+ {
+ // Copy the certificate
+ c->ClientX = CloneX(x);
+ }
+ }
+ else
+ {
+ // Authentication failure
+ }
+ FreeK(k);
+ }
+ FreeX(x);
+ FreeBuf(b);
+ }
+ }
+ }
+ Free(cert_buf);
+ }
+ }
+ else
+ {
+ // Certificate authentication is not supported in the open source version
+ HLog(hub, "LH_AUTH_CERT_NOT_SUPPORT_ON_OPEN_SOURCE", c->Name, username);
+ Unlock(hub->lock);
+ ReleaseHub(hub);
+ FreePack(p);
+ c->Err = ERR_AUTHTYPE_NOT_SUPPORTED;
+ goto CLEANUP;
+ }
break;
default:
@@ -2538,15 +2649,49 @@ bool ServerAccept(CONNECTION *c)
st.wYear, st.wMonth);
}
- tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + UniStrSize(msg) + 16000;
+ tmpsize = UniStrSize(winver_msg_client) + UniStrSize(winver_msg_server) + UniStrSize(msg) + 16000 + 3000;
tmp = ZeroMalloc(tmpsize);
if (IsURLMsg(msg, NULL, 0) == false)
{
+ if (s != NULL && s->IsRUDPSession && c != NULL && StrCmpi(hub->Name, VG_HUBNAME) != 0)
+ {
+ // Show the warning message if the connection is made by NAT-T
+ wchar_t *tmp2;
+ UINT tmp2_size = 2400;
+ char local_name[128];
+ wchar_t local_name_2[128];
+ char local_name_3[128];
+
+ Zero(local_name, sizeof(local_name));
+ Zero(local_name_2, sizeof(local_name_2));
+ Zero(local_name_3, sizeof(local_name_3));
+
+ GetMachineName(local_name, sizeof(local_name));
+
+#ifdef OS_WIN32
+ MsGetComputerNameFullEx(local_name_2, sizeof(local_name_2), true);
+
+ UniToStr(local_name_3, sizeof(local_name_3), local_name_2);
+
+ if (IsEmptyStr(local_name_3) == false)
+ {
+ StrCpy(local_name, sizeof(local_name), local_name_3);
+ }
+#endif // OS_WIN32
+
+ tmp2 = Malloc(tmp2_size);
+ UniFormat(tmp2, tmp2_size, _UU(c->ClientBuild >= 9428 ? "NATT_MSG" : "NATT_MSG2"), local_name);
+
+ UniStrCat(tmp, tmpsize, tmp2);
+
+ Free(tmp2);
+ }
+
{
- if (GetCurrentLangId() != SE_LANG_ENGLISH)
+ if (GetGlobalServerFlag(GSF_SHOW_OSS_MSG) != 0)
{
UniStrCat(tmp, tmpsize, _UU("OSS_MSG"));
}
@@ -5728,7 +5873,7 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls
// If additional_connect == true, follow the IsRUDPSession setting in this session
s = TcpIpConnectEx(host_for_direct_connection, port_for_direct_connection,
(bool *)cancel_flag, hWnd, &nat_t_err, (additional_connect ? (!is_additonal_rudp_session) : false),
- true, no_tls);
+ false, no_tls);
}
}
else
diff --git a/src/Cedar/Protocol.h b/src/Cedar/Protocol.h
index 995da896..f7c04aa3 100644
--- a/src/Cedar/Protocol.h
+++ b/src/Cedar/Protocol.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Protocol.h
diff --git a/src/Cedar/Radius.c b/src/Cedar/Radius.c
index 16107b31..5bd7ad33 100644
--- a/src/Cedar/Radius.c
+++ b/src/Cedar/Radius.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Radius.c
@@ -92,6 +98,555 @@
#include "CedarPch.h"
+// Attempts Radius authentication (with specifying retry interval and multiple server)
+bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20)
+{
+ UCHAR random[MD5_SIZE];
+ UCHAR id;
+ BUF *encrypted_password = NULL;
+ BUF *user_name = NULL;
+ //IP ip;
+ bool ret = false;
+ TOKEN_LIST *token;
+ UINT i;
+ LIST *ip_list;
+ IPC_MSCHAP_V2_AUTHINFO mschap;
+ bool is_mschap;
+ char client_ip_str[MAX_SIZE];
+ static UINT packet_id = 0;
+ // Validate arguments
+ if (server == NULL || port == 0 || (secret_size != 0 && secret == NULL) || username == NULL || password == NULL)
+ {
+ return false;
+ }
+
+ Zero(client_ip_str, sizeof(client_ip_str));
+ if (c != NULL && c->FirstSock != NULL)
+ {
+ IPToStr(client_ip_str, sizeof(client_ip_str), &c->FirstSock->RemoteIP);
+ }
+
+ // Parse the MS-CHAP v2 authentication data
+ Zero(&mschap, sizeof(mschap));
+ is_mschap = ParseAndExtractMsChapV2InfoFromPassword(&mschap, password);
+
+ // Split the server into tokens
+ token = ParseToken(server, " ,;\t");
+
+ // Get the IP address of the server
+ ip_list = NewListFast(NULL);
+ for(i = 0; i < token->NumTokens; i++)
+ {
+ IP *tmp_ip = Malloc(sizeof(IP));
+ if (GetIP(tmp_ip, token->Token[i]))
+ {
+ Add(ip_list, tmp_ip);
+ }
+ else if (GetIPEx(tmp_ip, token->Token[i], true))
+ {
+ Add(ip_list, tmp_ip);
+ }
+ else
+ {
+ Free(tmp_ip);
+ }
+ }
+
+ FreeToken(token);
+
+ if(LIST_NUM(ip_list) == 0)
+ {
+ ReleaseList(ip_list);
+ return false;
+ }
+
+ // Random number generation
+ Rand(random, sizeof(random));
+
+ // ID generation
+ id = (UCHAR)(packet_id % 254 + 1);
+ packet_id++;
+
+ if (is_mschap == false)
+ {
+ // Encrypt the password
+ encrypted_password = RadiusEncryptPassword(password, random, secret, secret_size);
+ if (encrypted_password == NULL)
+ {
+ // Encryption failure
+ ReleaseList(ip_list);
+ return false;
+ }
+ }
+
+ // Generate the user name packet
+ user_name = RadiusCreateUserName(username);
+
+ if (user_name != NULL)
+ {
+ // Generate a password packet
+ BUF *user_password = (is_mschap ? NULL : RadiusCreateUserPassword(encrypted_password->Buf, encrypted_password->Size));
+ BUF *nas_id = RadiusCreateNasId(CEDAR_SERVER_STR);
+
+ if (is_mschap || user_password != NULL)
+ {
+ UINT64 start;
+ UINT64 next_send_time;
+ UCHAR tmp[MAX_SIZE];
+ UINT recv_buf_size = 32768;
+ UCHAR *recv_buf = MallocEx(recv_buf_size, true);
+ // Generate an UDP packet
+ BUF *p = NewBuf();
+ UCHAR type = 1;
+ SOCK *sock;
+ USHORT sz = 0;
+ UINT pos = 0;
+ BOOL *finish = ZeroMallocEx(sizeof(BOOL) * LIST_NUM(ip_list), true);
+
+ Zero(tmp, sizeof(tmp));
+
+ WriteBuf(p, &type, 1);
+ WriteBuf(p, &id, 1);
+ WriteBuf(p, &sz, 2);
+ WriteBuf(p, random, 16);
+ WriteBuf(p, user_name->Buf, user_name->Size);
+
+ if (is_mschap == false)
+ {
+ UINT ui;
+ // PAP
+ WriteBuf(p, user_password->Buf, user_password->Size);
+ WriteBuf(p, nas_id->Buf, nas_id->Size);
+
+ // Service-Type
+ ui = Endian32(2);
+ RadiusAddValue(p, 6, 0, 0, &ui, sizeof(ui));
+
+ // NAS-Port-Type
+ ui = Endian32(5);
+ RadiusAddValue(p, 61, 0, 0, &ui, sizeof(ui));
+
+ // Tunnel-Type
+ ui = Endian32(1);
+ RadiusAddValue(p, 64, 0, 0, &ui, sizeof(ui));
+
+ // Tunnel-Medium-Type
+ ui = Endian32(1);
+ RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
+
+ // Calling-Station-Id
+ RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));
+
+ // Tunnel-Client-Endpoint
+ RadiusAddValue(p, 66, 0, 0, client_ip_str, StrLen(client_ip_str));
+ }
+ else
+ {
+ // MS-CHAP v2
+ static UINT session_id = 0;
+ USHORT us;
+ UINT ui;
+ char *ms_ras_version = "MSRASV5.20";
+ UCHAR ms_chapv2_response[50];
+
+ // Acct-Session-Id
+ us = Endian16(session_id % 254 + 1);
+ session_id++;
+ RadiusAddValue(p, 44, 0, 0, &us, sizeof(us));
+
+ // NAS-IP-Address
+ if (c != NULL && c->FirstSock != NULL && c->FirstSock->IPv6 == false)
+ {
+ ui = IPToUINT(&c->FirstSock->LocalIP);
+ RadiusAddValue(p, 4, 0, 0, &ui, sizeof(ui));
+ }
+
+ // Service-Type
+ ui = Endian32(2);
+ RadiusAddValue(p, 6, 0, 0, &ui, sizeof(ui));
+
+ // MS-RAS-Vendor
+ ui = Endian32(311);
+ RadiusAddValue(p, 26, 311, 9, &ui, sizeof(ui));
+
+ // MS-RAS-Version
+ RadiusAddValue(p, 26, 311, 18, ms_ras_version, StrLen(ms_ras_version));
+
+ // NAS-Port-Type
+ ui = Endian32(5);
+ RadiusAddValue(p, 61, 0, 0, &ui, sizeof(ui));
+
+ // Tunnel-Type
+ ui = Endian32(1);
+ RadiusAddValue(p, 64, 0, 0, &ui, sizeof(ui));
+
+ // Tunnel-Medium-Type
+ ui = Endian32(1);
+ RadiusAddValue(p, 65, 0, 0, &ui, sizeof(ui));
+
+ // Calling-Station-Id
+ RadiusAddValue(p, 31, 0, 0, client_ip_str, StrLen(client_ip_str));
+
+ // Tunnel-Client-Endpoint
+ RadiusAddValue(p, 66, 0, 0, client_ip_str, StrLen(client_ip_str));
+
+ // MS-RAS-Client-Version
+ RadiusAddValue(p, 26, 311, 35, ms_ras_version, StrLen(ms_ras_version));
+
+ // MS-RAS-Client-Name
+ RadiusAddValue(p, 26, 311, 34, client_ip_str, StrLen(client_ip_str));
+
+ // MS-CHAP-Challenge
+ RadiusAddValue(p, 26, 311, 11, mschap.MsChapV2_ServerChallenge, sizeof(mschap.MsChapV2_ServerChallenge));
+
+ // MS-CHAP2-Response
+ Zero(ms_chapv2_response, sizeof(ms_chapv2_response));
+ Copy(ms_chapv2_response + 2, mschap.MsChapV2_ClientChallenge, 16);
+ Copy(ms_chapv2_response + 2 + 16 + 8, mschap.MsChapV2_ClientResponse, 24);
+ RadiusAddValue(p, 26, 311, 25, ms_chapv2_response, sizeof(ms_chapv2_response));
+
+ // NAS-ID
+ WriteBuf(p, nas_id->Buf, nas_id->Size);
+ }
+
+ SeekBuf(p, 0, 0);
+
+ WRITE_USHORT(((UCHAR *)p->Buf) + 2, (USHORT)p->Size);
+
+ // Create a socket
+ sock = NewUDPEx(0, IsIP6(LIST_DATA(ip_list, pos)));
+
+ // Transmission process start
+ start = Tick64();
+ if(interval < RADIUS_RETRY_INTERVAL)
+ {
+ interval = RADIUS_RETRY_INTERVAL;
+ }
+ else if(interval > RADIUS_RETRY_TIMEOUT)
+ {
+ interval = RADIUS_RETRY_TIMEOUT;
+ }
+ next_send_time = start + (UINT64)interval;
+
+ while (true)
+ {
+ UINT server_port;
+ UINT recv_size;
+ //IP server_ip;
+ SOCKSET set;
+ UINT64 now;
+
+SEND_RETRY:
+ //SendTo(sock, &ip, port, p->Buf, p->Size);
+ SendTo(sock, LIST_DATA(ip_list, pos), port, p->Buf, p->Size);
+
+ Debug("send to host:%u\n", pos);
+
+ next_send_time = Tick64() + (UINT64)interval;
+
+RECV_RETRY:
+ now = Tick64();
+ if (next_send_time <= now)
+ {
+ // Switch the host to refer
+ pos++;
+ pos = pos % LIST_NUM(ip_list);
+
+ goto SEND_RETRY;
+ }
+
+ if ((start + RADIUS_RETRY_TIMEOUT) < now)
+ {
+ // Time-out
+ break;
+ }
+
+ InitSockSet(&set);
+ AddSockSet(&set, sock);
+ Select(&set, (UINT)(next_send_time - now), NULL, NULL);
+
+ recv_size = RecvFrom(sock, LIST_DATA(ip_list, pos), &server_port, recv_buf, recv_buf_size);
+
+ if (recv_size == 0)
+ {
+ Debug("Radius recv_size 0\n");
+ finish[pos] = TRUE;
+ for(i = 0; i < LIST_NUM(ip_list); i++)
+ {
+ if(finish[i] == FALSE)
+ {
+ // Switch the host to refer
+ pos++;
+ pos = pos % LIST_NUM(ip_list);
+ goto SEND_RETRY;
+ }
+ }
+ // Failure
+ break;
+ }
+ else if (recv_size == SOCK_LATER)
+ {
+ // Waiting
+ goto RECV_RETRY;
+ }
+ else
+ {
+ // Check such as the IP address
+ if (/*Cmp(&server_ip, &ip, sizeof(IP)) != 0 || */server_port != port)
+ {
+ goto RECV_RETRY;
+ }
+ // Success
+ if (recv_buf[0] == 2)
+ {
+ ret = true;
+
+ if (is_mschap && mschap_v2_server_response_20 != NULL)
+ {
+ // Cutting corners Zurukko
+ UCHAR signature[] = {0x1A, 0x33, 0x00, 0x00, 0x01, 0x37, 0x1A, 0x2D, 0x00, 0x53, 0x3D, };
+ UINT i = SearchBin(recv_buf, 0, recv_buf_size, signature, sizeof(signature));
+
+ if (i == INFINITE || ((i + sizeof(signature) + 40) > recv_buf_size))
+ {
+ ret = false;
+ }
+ else
+ {
+ char tmp[MAX_SIZE];
+ BUF *b;
+
+ Zero(tmp, sizeof(tmp));
+ Copy(tmp, recv_buf + i + sizeof(signature), 40);
+
+ b = StrToBin(tmp);
+
+ if (b != NULL && b->Size == 20)
+ {
+ WHERE;
+ Copy(mschap_v2_server_response_20, b->Buf, 20);
+ }
+ else
+ {
+ WHERE;
+ ret = false;
+ }
+
+ FreeBuf(b);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ Free(finish);
+
+ // Release the socket
+ ReleaseSock(sock);
+
+ FreeBuf(p);
+ FreeBuf(user_password);
+
+ Free(recv_buf);
+ }
+
+ FreeBuf(nas_id);
+ FreeBuf(user_name);
+ }
+
+ // Release the ip_list
+ for(i = 0; i < LIST_NUM(ip_list); i++)
+ {
+ IP *tmp_ip = LIST_DATA(ip_list, i);
+ Free(tmp_ip);
+ }
+ ReleaseList(ip_list);
+
+ // Release the memory
+ FreeBuf(encrypted_password);
+
+ return ret;
+}
+
+// Adding Attributes
+void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size)
+{
+ UINT len;
+ // Validate arguments
+ if (b == NULL || (data == NULL && size != 0))
+ {
+ return;
+ }
+
+ // type
+ WriteBufChar(b, t);
+
+ // length
+ len = 2 + size;
+ if (t == 26)
+ {
+ len += 6;
+ }
+ WriteBufChar(b, (UCHAR)len);
+
+ if (t != 26)
+ {
+ // value
+ WriteBuf(b, data, size);
+ }
+ else
+ {
+ // vendor
+ WriteBufInt(b, v);
+
+ // vendor type
+ WriteBufChar(b, vt);
+
+ // length2
+ len = size + 2;
+ WriteBufChar(b, (UCHAR)len);
+
+ // value
+ WriteBuf(b, data, size);
+ }
+}
+
+// Create a password attribute for Radius
+BUF *RadiusCreateUserPassword(void *data, UINT size)
+{
+ BUF *b;
+ UCHAR code, sz;
+ // Validate arguments
+ if (size != 0 && data == NULL || size >= 253)
+ {
+ return NULL;
+ }
+
+ b = NewBuf();
+ code = 2;
+ sz = 2 + (UCHAR)size;
+ WriteBuf(b, &code, 1);
+ WriteBuf(b, &sz, 1);
+ WriteBuf(b, data, size);
+
+ return b;
+}
+
+// Generate an ID attribute of Nas
+BUF *RadiusCreateNasId(char *name)
+{
+ BUF *b;
+ UCHAR code, size;
+ // Validate arguments
+ if (name == NULL)
+ {
+ return NULL;
+ }
+ if (StrLen(name) == 0 || StrLen(name) >= 128)
+ {
+ return NULL;
+ }
+
+ b = NewBuf();
+ code = 32;
+ size = 2 + (UCHAR)StrLen(name);
+ WriteBuf(b, &code, 1);
+ WriteBuf(b, &size, 1);
+ WriteBuf(b, name, StrLen(name));
+
+ return b;
+}
+
+// Create a user name attribute for Radius
+BUF *RadiusCreateUserName(wchar_t *username)
+{
+ BUF *b;
+ UCHAR code, size;
+ UCHAR utf8[254];
+ // Validate arguments
+ if (username == NULL)
+ {
+ return NULL;
+ }
+
+ // Convert the user name to a Unicode string
+ UniToStr(utf8, sizeof(utf8), username);
+ utf8[253] = 0;
+
+ b = NewBuf();
+ code = 1;
+ size = 2 + (UCHAR)StrLen(utf8);
+ WriteBuf(b, &code, 1);
+ WriteBuf(b, &size, 1);
+ WriteBuf(b, utf8, StrLen(utf8));
+
+ return b;
+}
+
+// Encrypt the password for the Radius
+BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size)
+{
+ UINT n, i;
+ BUF *buf;
+ UCHAR c[16][16]; // Result
+ UCHAR b[16][16]; // Result
+ UCHAR p[16][16]; // Password
+ // Validate arguments
+ if (password == NULL || random == NULL || (secret_size != 0 && secret == NULL))
+ {
+ return NULL;
+ }
+ if (StrLen(password) > 256)
+ {
+ // Password is too long
+ return NULL;
+ }
+
+ // Initialize
+ Zero(c, sizeof(c));
+ Zero(p, sizeof(p));
+ Zero(b, sizeof(b));
+
+ // Divide the password per 16 characters
+ Copy(p, password, StrLen(password));
+ // Calculate the number of blocks
+ n = StrLen(password) / 16;
+ if ((StrLen(password) % 16) != 0)
+ {
+ n++;
+ }
+
+ // Encryption processing
+ for (i = 0;i < n;i++)
+ {
+ // Calculation of b[i]
+ UINT j;
+ BUF *tmp = NewBuf();
+ WriteBuf(tmp, secret, secret_size);
+ if (i == 0)
+ {
+ WriteBuf(tmp, random, 16);
+ }
+ else
+ {
+ WriteBuf(tmp, c[i - 1], 16);
+ }
+ Hash(b[i], tmp->Buf, tmp->Size, false);
+ FreeBuf(tmp);
+
+ // Calculation of c[i]
+ for (j = 0;j < 16;j++)
+ {
+ c[i][j] = p[i][j] ^ b[i][j];
+ }
+ }
+
+ // Return the results
+ buf = NewBuf();
+ WriteBuf(buf, c, n * 16);
+ return buf;
+}
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
diff --git a/src/Cedar/Radius.h b/src/Cedar/Radius.h
index 25c347c1..14c6798b 100644
--- a/src/Cedar/Radius.h
+++ b/src/Cedar/Radius.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Radius.h
@@ -97,6 +103,13 @@
#define RADIUS_RETRY_INTERVAL 500 // Retransmission interval
#define RADIUS_RETRY_TIMEOUT (10 * 1000) // Time-out period
+// Function prototype
+bool RadiusLogin(CONNECTION *c, char *server, UINT port, UCHAR *secret, UINT secret_size, wchar_t *username, char *password, UINT interval, UCHAR *mschap_v2_server_response_20);
+BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size);
+BUF *RadiusCreateUserName(wchar_t *username);
+BUF *RadiusCreateUserPassword(void *data, UINT size);
+BUF *RadiusCreateNasId(char *name);
+void RadiusAddValue(BUF *b, UCHAR t, UINT v, UCHAR vt, void *data, UINT size);
#endif // RADIUS_H
diff --git a/src/Cedar/Remote.c b/src/Cedar/Remote.c
index 6d965e07..49dda2f3 100644
--- a/src/Cedar/Remote.c
+++ b/src/Cedar/Remote.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Remote.c
diff --git a/src/Cedar/Remote.h b/src/Cedar/Remote.h
index 09b9d1e5..1379a46a 100644
--- a/src/Cedar/Remote.h
+++ b/src/Cedar/Remote.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Remote.h
diff --git a/src/Cedar/SM.c b/src/Cedar/SM.c
index acf8104e..4c0093dc 100644
--- a/src/Cedar/SM.c
+++ b/src/Cedar/SM.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SM.c
@@ -702,6 +708,19 @@ UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
}
break;
+ case B_HINT2:
+ // Hint2 (for DDNS key)
+ {
+ wchar_t tmp[MAX_SIZE * 4];
+ wchar_t *keystr;
+
+ keystr = GetText(hWnd, E_KEY);
+ UniFormat(tmp, sizeof(tmp), _UU("SM_DDNS_KEY_MSG"), keystr);
+ Free(keystr);
+ OnceMsg(hWnd, _UU("SM_DDNS_KEY_TITLE"), tmp, false, ICO_DISPLAY);
+ }
+ break;
+
case B_PROXY:
// Proxy settings
if (true)
@@ -835,8 +854,45 @@ UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
return 0;
}
+
+// Get the ddns key from the server configuration file
+static UINT SmDdnsGetKey(char *key, SM_DDNS *d){
+ RPC *rpc = d->s->Rpc;
+ RPC_CONFIG config;
+ UINT err;
+ BUF *buf;
+ FOLDER *root, *ddnsfolder;
+
+ // Validate arguments
+ if(d == NULL || d->s == NULL || key == NULL){
+ return ERR_INTERNAL_ERROR;
+ }
+
+ Zero(&config, sizeof(config));
+ err = ScGetConfig(d->s->Rpc, &config);
+ if(err != ERR_NO_ERROR){
+ return err;
+ }
+
+ buf = NewBufFromMemory(config.FileData, StrLen(config.FileData));
+ FreeRpcConfig(&config);
+
+ root = CfgBufTextToFolder(buf);
+ FreeBuf(buf);
+
+ ddnsfolder = CfgGetFolder(root, "DDnsClient");
+ err = CfgGetByte(ddnsfolder, "Key", key, 20);
+
+ CfgDeleteFolder(root);
+
+ return (err == 20) ? ERR_NO_ERROR : ERR_INTERNAL_ERROR;
+}
+
void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
{
+ char key[20];
+ char encodedkey[20 * 4 + 32];
+
// Validate arguments
if (hWnd == NULL || d == NULL)
{
@@ -854,6 +910,7 @@ void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
DlgFont(hWnd, S_STATUS4, 0, true);
DlgFont(hWnd, S_STATUS5, 0, true);
DlgFont(hWnd, S_STATUS6, 0, true);
+ DlgFont(hWnd, S_STATUS8, 0, true);
SetFont(hWnd, S_SUFFIX, GetFont("Verdana", 10, false, false, false, false));
SetFont(hWnd, E_NEWHOST, GetFont("Verdana", 10, false, false, false, false));
@@ -861,6 +918,7 @@ void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
SetFont(hWnd, E_HOST, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
SetFont(hWnd, E_IPV4, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
SetFont(hWnd, E_IPV6, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 10, false, false, false, false));
+ SetFont(hWnd, E_KEY, GetFont((MsIsWinXPOrGreater() ? "Verdana" : NULL), 8, false, false, false, false));
DlgFont(hWnd, IDOK, 0, true);
@@ -871,6 +929,13 @@ void SmDDnsDlgInit(HWND hWnd, SM_DDNS *d)
Hide(hWnd, B_PROXY);
+ if(SmDdnsGetKey(key, d) == ERR_NO_ERROR){
+ encodedkey[ B64_Encode(encodedkey, key, 20) ] = 0;
+ SetTextA(hWnd, E_KEY, encodedkey);
+ }else{
+ SetText(hWnd, E_KEY, _UU("SM_DDNS_KEY_ERR"));
+ }
+
SmDDnsRefresh(hWnd, d);
}
@@ -878,6 +943,7 @@ void SmDDnsRefresh(HWND hWnd, SM_DDNS *d)
{
DDNS_CLIENT_STATUS st;
INTERNET_SETTING t;
+
// Validate arguments
if (hWnd == NULL || d == NULL)
{
diff --git a/src/Cedar/SM.h b/src/Cedar/SM.h
index 5fa56588..261c206a 100644
--- a/src/Cedar/SM.h
+++ b/src/Cedar/SM.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SM.h
diff --git a/src/Cedar/SMInner.h b/src/Cedar/SMInner.h
index 63ef0786..8f2beb33 100644
--- a/src/Cedar/SMInner.h
+++ b/src/Cedar/SMInner.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SMInner.h
@@ -209,6 +215,7 @@ typedef struct SM_HUB
SM_SERVER *p; // P
RPC *Rpc; // RPC
char *HubName; // HUB name
+ char CurrentPushRouteStr[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // Current editing push routing table string
} SM_HUB;
// Show the User list
diff --git a/src/Cedar/SW.c b/src/Cedar/SW.c
index bcbb45c8..0733391a 100644
--- a/src/Cedar/SW.c
+++ b/src/Cedar/SW.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SW.c
diff --git a/src/Cedar/SW.h b/src/Cedar/SW.h
index 668201f0..94a4479d 100644
--- a/src/Cedar/SW.h
+++ b/src/Cedar/SW.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SW.h
diff --git a/src/Cedar/SWInner.h b/src/Cedar/SWInner.h
index d23dbc27..9f62c5f3 100644
--- a/src/Cedar/SWInner.h
+++ b/src/Cedar/SWInner.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SWInner.h
diff --git a/src/Cedar/Sam.c b/src/Cedar/Sam.c
index b12a97f9..7520e40a 100644
--- a/src/Cedar/Sam.c
+++ b/src/Cedar/Sam.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Sam.c
@@ -156,13 +162,263 @@ bool SamAuthUserByAnonymous(HUB *h, char *username)
// Plaintext password authentication of user
bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *password, bool ast, UCHAR *mschap_v2_server_response_20)
{
- return false;
+ bool b = false;
+ wchar_t *name = NULL;
+ bool auth_by_nt = false;
+ HUB *h;
+ // Validate arguments
+ if (hub == NULL || c == NULL || username == NULL)
+ {
+ return false;
+ }
+
+ if (GetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH) != 0)
+ {
+ return false;
+ }
+
+ h = hub;
+
+ AddRef(h->ref);
+
+ // Get the user name on authentication system
+ AcLock(hub);
+ {
+ USER *u;
+ u = AcGetUser(hub, ast == false ? username : "*");
+ if (u)
+ {
+ Lock(u->lock);
+ {
+ if (u->AuthType == AUTHTYPE_RADIUS)
+ {
+ // Radius authentication
+ AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData;
+ if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0)
+ {
+ name = CopyStrToUni(username);
+ }
+ else
+ {
+ name = CopyUniStr(auth->RadiusUsername);
+ }
+ auth_by_nt = false;
+ }
+ else if (u->AuthType == AUTHTYPE_NT)
+ {
+ // NT authentication
+ AUTHNT *auth = (AUTHNT *)u->AuthData;
+ if (ast || auth->NtUsername == NULL || UniStrLen(auth->NtUsername) == 0)
+ {
+ name = CopyStrToUni(username);
+ }
+ else
+ {
+ name = CopyUniStr(auth->NtUsername);
+ }
+ auth_by_nt = true;
+ }
+ }
+ Unlock(u->lock);
+ ReleaseUser(u);
+ }
+ }
+ AcUnlock(hub);
+
+ if (name != NULL)
+ {
+ if (auth_by_nt == false)
+ {
+ // Radius authentication
+ char radius_server_addr[MAX_SIZE];
+ UINT radius_server_port;
+ char radius_secret[MAX_SIZE];
+ char suffix_filter[MAX_SIZE];
+ wchar_t suffix_filter_w[MAX_SIZE];
+ UINT interval;
+
+ Zero(suffix_filter, sizeof(suffix_filter));
+ Zero(suffix_filter_w, sizeof(suffix_filter_w));
+
+ // Get the Radius server information
+ if (GetRadiusServerEx2(hub, radius_server_addr, sizeof(radius_server_addr), &radius_server_port, radius_secret, sizeof(radius_secret), &interval, suffix_filter, sizeof(suffix_filter)))
+ {
+ Unlock(hub->lock);
+
+ StrToUni(suffix_filter_w, sizeof(suffix_filter_w), suffix_filter);
+
+ if (UniIsEmptyStr(suffix_filter_w) || UniEndWith(name, suffix_filter_w))
+ {
+ // Attempt to login
+ b = RadiusLogin(c, radius_server_addr, radius_server_port,
+ radius_secret, StrLen(radius_secret),
+ name, password, interval, mschap_v2_server_response_20);
+ }
+
+ Lock(hub->lock);
+ }
+ else
+ {
+ HLog(hub, "LH_NO_RADIUS_SETTING", name);
+ }
+ }
+ else
+ {
+ // NT authentication (Not available for non-Win32)
+#ifdef OS_WIN32
+ IPC_MSCHAP_V2_AUTHINFO mschap;
+ Unlock(hub->lock);
+
+ if (ParseAndExtractMsChapV2InfoFromPassword(&mschap, password) == false)
+ {
+ // Plaintext password authentication
+ b = MsCheckLogon(name, password);
+ }
+ else
+ {
+ UCHAR challenge8[8];
+ UCHAR nt_pw_hash_hash[16];
+ char nt_name[MAX_SIZE];
+
+ UniToStr(nt_name, sizeof(nt_name), name);
+
+ // MS-CHAPv2 authentication
+ MsChapV2_GenerateChallenge8(challenge8, mschap.MsChapV2_ClientChallenge,
+ mschap.MsChapV2_ServerChallenge,
+ mschap.MsChapV2_PPPUsername);
+
+ Debug("MsChapV2_PPPUsername = %s, nt_name = %s\n", mschap.MsChapV2_PPPUsername, nt_name);
+
+ b = MsPerformMsChapV2AuthByLsa(nt_name, challenge8, mschap.MsChapV2_ClientResponse, nt_pw_hash_hash);
+
+ if (b)
+ {
+ if (mschap_v2_server_response_20 != NULL)
+ {
+ MsChapV2Server_GenerateResponse(mschap_v2_server_response_20, nt_pw_hash_hash,
+ mschap.MsChapV2_ClientResponse, challenge8);
+ }
+ }
+ }
+
+ Lock(hub->lock);
+#else // OS_WIN32
+ // Nothing to do other than Win32
+#endif // OS_WIN32
+ }
+
+ // Memory release
+ Free(name);
+ }
+
+ ReleaseHub(h);
+
+ return b;
}
// Certificate authentication of user
bool SamAuthUserByCert(HUB *h, char *username, X *x)
{
- return false;
+ bool b = false;
+ // Validate arguments
+ if (h == NULL || username == NULL || x == NULL)
+ {
+ return false;
+ }
+
+ if (GetGlobalServerFlag(GSF_DISABLE_CERT_AUTH) != 0)
+ {
+ return false;
+ }
+
+ // Check expiration date
+ if (CheckXDateNow(x) == false)
+ {
+ return false;
+ }
+
+ // Check the Certification Revocation List
+ if (IsValidCertInHub(h, x) == false)
+ {
+ // Bad
+ wchar_t tmp[MAX_SIZE * 2];
+
+ // Log the contents of the certificate
+ GetAllNameFromX(tmp, sizeof(tmp), x);
+
+ HLog(h, "LH_AUTH_NG_CERT", username, tmp);
+ return false;
+ }
+
+ AcLock(h);
+ {
+ USER *u;
+ u = AcGetUser(h, username);
+ if (u)
+ {
+ Lock(u->lock);
+ {
+ if (u->AuthType == AUTHTYPE_USERCERT)
+ {
+ // Check whether to matche with the registered certificate
+ AUTHUSERCERT *auth = (AUTHUSERCERT *)u->AuthData;
+ if (CompareX(auth->UserX, x))
+ {
+ b = true;
+ }
+ }
+ else if (u->AuthType == AUTHTYPE_ROOTCERT)
+ {
+ // Check whether the certificate has been signed by the root certificate
+ AUTHROOTCERT *auth = (AUTHROOTCERT *)u->AuthData;
+ if (h->HubDb != NULL)
+ {
+ LockList(h->HubDb->RootCertList);
+ {
+ X *root_cert;
+ root_cert = GetIssuerFromList(h->HubDb->RootCertList, x);
+ if (root_cert != NULL)
+ {
+ b = true;
+ if (auth->CommonName != NULL && UniIsEmptyStr(auth->CommonName) == false)
+ {
+ // Compare the CN
+ if (UniStrCmpi(x->subject_name->CommonName, auth->CommonName) != 0)
+ {
+ b = false;
+ }
+ }
+ if (auth->Serial != NULL && auth->Serial->size >= 1)
+ {
+ // Compare the serial number
+ if (CompareXSerial(x->serial, auth->Serial) == false)
+ {
+ b = false;
+ }
+ }
+ }
+ }
+ UnlockList(h->HubDb->RootCertList);
+ }
+ }
+ }
+ Unlock(u->lock);
+ ReleaseUser(u);
+ }
+ }
+ AcUnlock(h);
+
+ if (b)
+ {
+ wchar_t tmp[MAX_SIZE * 2];
+
+ // Log the contents of the certificate
+ GetAllNameFromX(tmp, sizeof(tmp), x);
+
+ HLog(h, "LH_AUTH_OK_CERT", username, tmp);
+ }
+
+ return b;
}
// Get the root certificate that signed the specified certificate from the list
diff --git a/src/Cedar/Sam.h b/src/Cedar/Sam.h
index 164b1c24..61eb1739 100644
--- a/src/Cedar/Sam.h
+++ b/src/Cedar/Sam.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Sam.h
diff --git a/src/Cedar/SeLowUser.c b/src/Cedar/SeLowUser.c
index c4694177..191ad066 100644
--- a/src/Cedar/SeLowUser.c
+++ b/src/Cedar/SeLowUser.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SeLowUser.c
diff --git a/src/Cedar/SeLowUser.h b/src/Cedar/SeLowUser.h
index 05c9b13e..531fd881 100644
--- a/src/Cedar/SeLowUser.h
+++ b/src/Cedar/SeLowUser.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SeLowUser.h
diff --git a/src/Cedar/SecureInfo.c b/src/Cedar/SecureInfo.c
index af739f11..3bbe69cb 100644
--- a/src/Cedar/SecureInfo.c
+++ b/src/Cedar/SecureInfo.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SecureInfo.c
diff --git a/src/Cedar/SecureInfo.h b/src/Cedar/SecureInfo.h
index e39a5c2d..821fca5f 100644
--- a/src/Cedar/SecureInfo.h
+++ b/src/Cedar/SecureInfo.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SecureInfo.h
diff --git a/src/Cedar/SecureNAT.c b/src/Cedar/SecureNAT.c
index 4d77779b..fbb4b751 100644
--- a/src/Cedar/SecureNAT.c
+++ b/src/Cedar/SecureNAT.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SecureNAT.c
diff --git a/src/Cedar/SecureNAT.h b/src/Cedar/SecureNAT.h
index a73f718b..2452ab0a 100644
--- a/src/Cedar/SecureNAT.h
+++ b/src/Cedar/SecureNAT.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// SecureNAT.h
diff --git a/src/Cedar/Server.c b/src/Cedar/Server.c
index f4adda60..a0de204c 100644
--- a/src/Cedar/Server.c
+++ b/src/Cedar/Server.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Server.c
@@ -100,6 +106,8 @@ char *BRIDGE_CONFIG_FILE_NAME = "@vpn_bridge.config";
static bool server_reset_setting = false;
+static volatile UINT global_server_flags[NUM_GLOBAL_SERVER_FLAGS] = {0};
+
// Set the OpenVPN and SSTP setting
void SiSetOpenVPNAndSSTPConfig(SERVER *s, OPENVPN_SSTP_CONFIG *c)
{
@@ -825,6 +833,40 @@ UINT SiGetSysLogSaveStatus(SERVER *s)
// Send a syslog
void SiWriteSysLog(SERVER *s, char *typestr, char *hubname, wchar_t *message)
{
+ wchar_t tmp[1024];
+ char machinename[MAX_HOST_NAME_LEN + 1];
+ char datetime[MAX_PATH];
+ SYSTEMTIME st;
+ // Validate arguments
+ if (s == NULL || typestr == NULL || message == NULL)
+ {
+ return;
+ }
+
+ if (GetGlobalServerFlag(GSF_DISABLE_SYSLOG) != 0)
+ {
+ return;
+ }
+
+ // Host name
+ GetMachineName(machinename, sizeof(machinename));
+
+ // Date and time
+ LocalTime(&st);
+ GetDateTimeStrMilli(datetime, sizeof(datetime), &st);
+
+ if (IsEmptyStr(hubname) == false)
+ {
+ UniFormat(tmp, sizeof(tmp), L"[%S/VPN/%S] (%S) <%S>: %s",
+ machinename, hubname, datetime, typestr, message);
+ }
+ else
+ {
+ UniFormat(tmp, sizeof(tmp), L"[%S/VPN] (%S) <%S>: %s",
+ machinename, datetime, typestr, message);
+ }
+
+ SendSysLog(s->Syslog, tmp);
}
// Write the syslog configuration
@@ -1207,6 +1249,22 @@ void DestroyServerCapsCache(SERVER *s)
Unlock(s->CapsCacheLock);
}
+// Flush the Caps list for this server
+void FlushServerCaps(SERVER *s)
+{
+ CAPSLIST t;
+ // Validate arguments
+ if (s == NULL)
+ {
+ return;
+ }
+
+ DestroyServerCapsCache(s);
+
+ Zero(&t, sizeof(t));
+ GetServerCaps(s, &t);
+}
+
// Get the Caps list for this server
void GetServerCaps(SERVER *s, CAPSLIST *t)
{
@@ -1230,15 +1288,63 @@ void GetServerCaps(SERVER *s, CAPSLIST *t)
Unlock(s->CapsCacheLock);
}
+// Update the global server flags
+void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t)
+{
+ bool is_restricted = false;
+ // Validate arguments
+ if (s == NULL || t == NULL)
+ {
+ return;
+ }
+
+ is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar);
+
+ SetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE, is_restricted);
+ SetGlobalServerFlag(GSF_DISABLE_RADIUS_AUTH, is_restricted);
+ SetGlobalServerFlag(GSF_DISABLE_CERT_AUTH, is_restricted);
+ SetGlobalServerFlag(GSF_DISABLE_DEEP_LOGGING, is_restricted);
+ SetGlobalServerFlag(GSF_DISABLE_AC, is_restricted);
+ SetGlobalServerFlag(GSF_DISABLE_SYSLOG, is_restricted);
+}
+
+// Set a global server flag
+void SetGlobalServerFlag(UINT index, UINT value)
+{
+ // Validate arguments
+ if (index >= NUM_GLOBAL_SERVER_FLAGS)
+ {
+ return;
+ }
+
+ global_server_flags[index] = value;
+}
+
+// Get a global server flag
+UINT GetGlobalServerFlag(UINT index)
+{
+ // Validate arguments
+ if (index >= NUM_GLOBAL_SERVER_FLAGS)
+ {
+ return 0;
+ }
+
+ return global_server_flags[index];
+}
+
// Main of the aquisition of Caps of the server
void GetServerCapsMain(SERVER *s, CAPSLIST *t)
{
+ bool is_restricted = false;
+
// Validate arguments
if (s == NULL || t == NULL)
{
return;
}
+ is_restricted = SiIsEnterpriseFunctionsRestrictedOnOpenSource(s->Cedar);
+
// Initialize
InitCapsList(t);
@@ -1299,7 +1405,7 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
AddCapsBool(t, "b_support_qos", true);
// syslog
- AddCapsBool(t, "b_support_syslog", false);
+ AddCapsBool(t, "b_support_syslog", true);
// IPsec
// (Only works in stand-alone mode currently)
@@ -1382,6 +1488,10 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
// SecureNAT function is available
AddCapsBool(t, "b_support_securenat", true);
+ // Pushing routing table function of SecureNAT Virtual DHCP Server is available
+ AddCapsBool(t, "b_suppport_push_route", !is_restricted);
+ AddCapsBool(t, "b_suppport_push_route_config", true);
+
if (s->ServerType != SERVER_TYPE_STANDALONE)
{
AddCapsBool(t, "b_virtual_nat_disabled", true);
@@ -1428,7 +1538,9 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
// VPN client can be connected
AddCapsBool(t, "b_vpn_client_connect", s->Cedar->Bridge == false ? true : false);
- AddCapsBool(t, "b_support_radius", false);
+ // External authentication server is available
+ AddCapsBool(t, "b_support_radius", s->ServerType != SERVER_TYPE_FARM_MEMBER &&
+ s->Cedar->Bridge == false);
// Local-bridge function is available
AddCapsBool(t, "b_local_bridge", IsBridgeSupported());
@@ -1463,7 +1575,8 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
// Server authentication can be used in cascade connection
AddCapsBool(t, "b_support_cascade_cert", true);
- AddCapsBool(t, "b_support_config_log", false);
+ // the log file settings is modifiable
+ AddCapsBool(t, "b_support_config_log", s->ServerType != SERVER_TYPE_FARM_MEMBER);
// Automatic deletion of log file is available
AddCapsBool(t, "b_support_autodelete", true);
@@ -1515,6 +1628,8 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
// Support for CRL
AddCapsBool(t, "b_support_crl", true);
+ // Supports AC
+ AddCapsBool(t, "b_support_ac", true);
}
// Supports downloading a log file
@@ -1614,6 +1729,8 @@ void GetServerCapsMain(SERVER *s, CAPSLIST *t)
// VPN4
AddCapsBool(t, "b_vpn4", true);
+
+ UpdateGlobalServerFlags(s, t);
}
// SYSLOG_SETTING
@@ -3123,6 +3240,7 @@ void IncrementServerConfigRevision(SERVER *s)
FOLDER *SiWriteConfigurationToCfg(SERVER *s)
{
FOLDER *root;
+ char region[128];
// Validate arguments
if (s == NULL)
{
@@ -3131,6 +3249,10 @@ FOLDER *SiWriteConfigurationToCfg(SERVER *s)
root = CfgCreateFolder(NULL, TAG_ROOT);
+ SiGetCurrentRegion(s->Cedar, region, sizeof(region));
+
+ CfgAddStr(root, "Region", region);
+
CfgAddInt(root, "ConfigRevision", s->ConfigRevision);
SiWriteListeners(CfgCreateFolder(root, "ListenerList"), s);
@@ -3829,6 +3951,25 @@ void SiLoadHubOptionCfg(FOLDER *f, HUB_OPTION *o)
o->BroadcastLimiterStrictMode = CfgGetBool(f, "BroadcastLimiterStrictMode");
o->MaxLoggedPacketsPerMinute = CfgGetInt(f, "MaxLoggedPacketsPerMinute");
o->DoNotSaveHeavySecurityLogs = CfgGetBool(f, "DoNotSaveHeavySecurityLogs");
+
+ if (CfgIsItem(f, "DropBroadcastsInPrivacyFilterMode"))
+ {
+ o->DropBroadcastsInPrivacyFilterMode = CfgGetBool(f, "DropBroadcastsInPrivacyFilterMode");
+ }
+ else
+ {
+ o->DropBroadcastsInPrivacyFilterMode = true;
+ }
+
+ if (CfgIsItem(f, "DropArpInPrivacyFilterMode"))
+ {
+ o->DropArpInPrivacyFilterMode = CfgGetBool(f, "DropArpInPrivacyFilterMode");
+ }
+ else
+ {
+ o->DropArpInPrivacyFilterMode = true;
+ }
+
o->NoLookBPDUBridgeId = CfgGetBool(f, "NoLookBPDUBridgeId");
o->AdjustTcpMssValue = CfgGetInt(f, "AdjustTcpMssValue");
o->DisableAdjustTcpMss = CfgGetBool(f, "DisableAdjustTcpMss");
@@ -3939,6 +4080,8 @@ void SiWriteHubOptionCfg(FOLDER *f, HUB_OPTION *o)
CfgAddBool(f, "BroadcastLimiterStrictMode", o->BroadcastLimiterStrictMode);
CfgAddInt(f, "MaxLoggedPacketsPerMinute", o->MaxLoggedPacketsPerMinute);
CfgAddBool(f, "DoNotSaveHeavySecurityLogs", o->DoNotSaveHeavySecurityLogs);
+ CfgAddBool(f, "DropBroadcastsInPrivacyFilterMode", o->DropBroadcastsInPrivacyFilterMode);
+ CfgAddBool(f, "DropArpInPrivacyFilterMode", o->DropArpInPrivacyFilterMode);
CfgAddBool(f, "NoLookBPDUBridgeId", o->NoLookBPDUBridgeId);
CfgAddInt(f, "AdjustTcpMssValue", o->AdjustTcpMssValue);
CfgAddBool(f, "DisableAdjustTcpMss", o->DisableAdjustTcpMss);
@@ -7075,6 +7218,8 @@ void SiCalledUpdateHub(SERVER *s, PACK *p)
o.NoManageVlanId = PackGetBool(p, "NoManageVlanId");
o.MaxLoggedPacketsPerMinute = PackGetInt(p, "MaxLoggedPacketsPerMinute");
o.DoNotSaveHeavySecurityLogs = PackGetBool(p, "DoNotSaveHeavySecurityLogs");
+ o.DropBroadcastsInPrivacyFilterMode = PackGetBool(p, "DropBroadcastsInPrivacyFilterMode");
+ o.DropArpInPrivacyFilterMode = PackGetBool(p, "DropArpInPrivacyFilterMode");
o.VlanTypeId = PackGetInt(p, "VlanTypeId");
if (o.VlanTypeId == 0)
{
@@ -8913,6 +9058,8 @@ void SiPackAddCreateHub(PACK *p, HUB *h)
PackAddInt(p, "BroadcastStormDetectionThreshold", h->Option->BroadcastStormDetectionThreshold);
PackAddInt(p, "MaxLoggedPacketsPerMinute", h->Option->MaxLoggedPacketsPerMinute);
PackAddBool(p, "DoNotSaveHeavySecurityLogs", h->Option->DoNotSaveHeavySecurityLogs);
+ PackAddBool(p, "DropBroadcastsInPrivacyFilterMode", h->Option->DropBroadcastsInPrivacyFilterMode);
+ PackAddBool(p, "DropArpInPrivacyFilterMode", h->Option->DropArpInPrivacyFilterMode);
PackAddInt(p, "ClientMinimumRequiredBuild", h->Option->ClientMinimumRequiredBuild);
PackAddBool(p, "FixForDLinkBPDU", h->Option->FixForDLinkBPDU);
PackAddBool(p, "BroadcastLimiterStrictMode", h->Option->BroadcastLimiterStrictMode);
@@ -10311,6 +10458,122 @@ FARM_CONTROLLER *SiStartConnectToController(SERVER *s)
return f;
}
+// Get the current version
+void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size)
+{
+ ClearStr(region, region_size);
+ // Validate arguments
+ if (c == NULL || region == NULL)
+ {
+ return;
+ }
+
+ Lock(c->CurrentRegionLock);
+ {
+ StrCpy(region, region_size, c->CurrentRegion);
+ }
+ Unlock(c->CurrentRegionLock);
+
+ if (IsEmptyStr(region))
+ {
+ if (GetCurrentLangId() == SE_LANG_JAPANESE)
+ {
+ StrCpy(region, region_size, "JP");
+ }
+ else if (GetCurrentLangId() == SE_LANG_CHINESE_ZH)
+ {
+ StrCpy(region, region_size, "CN");
+ }
+ }
+}
+
+// Check whether some enterprise functions are restricted
+//
+// ** Hints by Daiyuu Nobori, written on March 19, 2014 **
+//
+// The following 'enterprise functions' are implemented on SoftEther VPN Server
+// since March 19, 2014. However, these functions are disabled on
+// SoftEther VPN Servers which run in Japan and China.
+//
+// - RADIUS / NT Domain user authentication
+// - RSA certificate authentication
+// - Deep-inspect packet logging
+// - Source IP address control list
+// - syslog transfer
+//
+// The SoftEther VPN Project intentionally disables these functions for users
+// in Japan and China. The reason is: Daiyuu Nobori, the chief author of
+// SoftEther VPN, has been liable to observe the existing agreements and
+// restrictions between him and some companies. The agreements have regulated
+// the region-limited restriction to implement and distribute the above
+// enterprise functions on the SoftEther VPN open-source program.
+//
+// Therefore, the SoftEther VPN Project distributes the binary program and
+// the source code with the "SiIsEnterpriseFunctionsRestrictedOnOpenSource"
+// function. This function identifies whether the SoftEther VPN Server
+// program is running in either Japan or China. If the restricted region is
+// detected, then the above enterprise functions will be disabled.
+//
+// Please note that the above restriction has been imposed only on the
+// original binaries and source codes from the SoftEther VPN Project.
+// Anyone, except Daiyuu Nobori, who understands and writes the C language
+// program can remove this restriction at his own risk.
+//
+bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c)
+{
+ char region[128];
+ bool ret = false;
+ // Validate arguments
+ if (c == NULL)
+ {
+ return false;
+ }
+
+
+ SiGetCurrentRegion(c, region, sizeof(region));
+
+ if (StrCmpi(region, "JP") == 0 || StrCmpi(region, "CN") == 0)
+ {
+ ret = true;
+ }
+
+ return ret;
+}
+
+// Update the current region
+void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update)
+{
+ bool changed = false;
+ // Validate arguments
+ if (c == NULL)
+ {
+ return;
+ }
+
+ if (IsEmptyStr(region) == false)
+ {
+ Lock(c->CurrentRegionLock);
+ {
+ if (StrCmpi(c->CurrentRegion, region) != 0)
+ {
+ StrCpy(c->CurrentRegion, sizeof(c->CurrentRegion), region);
+ changed = true;
+ }
+ }
+ Unlock(c->CurrentRegionLock);
+ }
+
+ if (force_update)
+ {
+ changed = true;
+ }
+
+ if (changed)
+ {
+ FlushServerCaps(c->Server);
+ }
+}
+
// Create a server
SERVER *SiNewServer(bool bridge)
{
@@ -10461,6 +10724,8 @@ SERVER *SiNewServerEx(bool bridge, bool in_client_inner_server)
SiInitDeadLockCheck(s);
+ SiUpdateCurrentRegion(s->Cedar, "", true);
+
return s;
}
diff --git a/src/Cedar/Server.h b/src/Cedar/Server.h
index 319e3eca..27803e94 100644
--- a/src/Cedar/Server.h
+++ b/src/Cedar/Server.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Server.h
@@ -397,6 +403,17 @@ struct LOG_FILE
};
+// Global server flags
+#define NUM_GLOBAL_SERVER_FLAGS 128
+#define GSF_DISABLE_PUSH_ROUTE 1
+#define GSF_DISABLE_RADIUS_AUTH 2
+#define GSF_DISABLE_CERT_AUTH 3
+#define GSF_DISABLE_DEEP_LOGGING 4
+#define GSF_DISABLE_AC 5
+#define GSF_DISABLE_SYSLOG 6
+#define GSF_SHOW_OSS_MSG 7
+
+
// Virtual HUB creation history
struct SERVER_HUB_CREATE_HISTORY
{
@@ -630,6 +647,7 @@ void InRpcSysLogSetting(SYSLOG_SETTING *t, PACK *p);
void OutRpcSysLogSetting(PACK *p, SYSLOG_SETTING *t);
void GetServerCaps(SERVER *s, CAPSLIST *t);
+void FlushServerCaps(SERVER *s);
bool GetServerCapsBool(SERVER *s, char *name);
UINT GetServerCapsInt(SERVER *s, char *name);
void GetServerCapsMain(SERVER *s, CAPSLIST *t);
@@ -637,6 +655,10 @@ void InitServerCapsCache(SERVER *s);
void FreeServerCapsCache(SERVER *s);
void DestroyServerCapsCache(SERVER *s);
+void SetGlobalServerFlag(UINT index, UINT value);
+UINT GetGlobalServerFlag(UINT index);
+void UpdateGlobalServerFlags(SERVER *s, CAPSLIST *t);
+
bool IsAdminPackSupportedServerProduct(char *name);
@@ -663,6 +685,10 @@ void SiApplyAzureConfig(SERVER *s, DDNS_CLIENT_STATUS *ddns_status);
void SiSetAzureEnable(SERVER *s, bool enabled);
bool SiGetAzureEnable(SERVER *s);
+void SiUpdateCurrentRegion(CEDAR *c, char *region, bool force_update);
+void SiGetCurrentRegion(CEDAR *c, char *region, UINT region_size);
+bool SiIsEnterpriseFunctionsRestrictedOnOpenSource(CEDAR *c);
+
#endif // SERVER_H
diff --git a/src/Cedar/Session.c b/src/Cedar/Session.c
index 7403b2cd..828ca911 100644
--- a/src/Cedar/Session.c
+++ b/src/Cedar/Session.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Session.c
diff --git a/src/Cedar/Session.h b/src/Cedar/Session.h
index 0191a7fd..5655947c 100644
--- a/src/Cedar/Session.h
+++ b/src/Cedar/Session.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Session.h
diff --git a/src/Cedar/UT.c b/src/Cedar/UT.c
index 3293667e..3ef42d83 100644
--- a/src/Cedar/UT.c
+++ b/src/Cedar/UT.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// UT.c
diff --git a/src/Cedar/UT.h b/src/Cedar/UT.h
index 8d4c9c0f..35b7c2b2 100644
--- a/src/Cedar/UT.h
+++ b/src/Cedar/UT.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// UT.h
diff --git a/src/Cedar/UdpAccel.c b/src/Cedar/UdpAccel.c
index 1be02aae..59abc216 100644
--- a/src/Cedar/UdpAccel.c
+++ b/src/Cedar/UdpAccel.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// UdpAccel.c
diff --git a/src/Cedar/UdpAccel.h b/src/Cedar/UdpAccel.h
index 240a45f4..e0ebbcf1 100644
--- a/src/Cedar/UdpAccel.h
+++ b/src/Cedar/UdpAccel.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// UdpAccel.h
diff --git a/src/Cedar/VG.c b/src/Cedar/VG.c
index 5f6befcf..637aea41 100644
--- a/src/Cedar/VG.c
+++ b/src/Cedar/VG.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VG.c
diff --git a/src/Cedar/VG.h b/src/Cedar/VG.h
index 218255c4..25013570 100644
--- a/src/Cedar/VG.h
+++ b/src/Cedar/VG.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VG.h
diff --git a/src/Cedar/VLan.c b/src/Cedar/VLan.c
index e0e9c710..2b781382 100644
--- a/src/Cedar/VLan.c
+++ b/src/Cedar/VLan.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLan.c
diff --git a/src/Cedar/VLan.h b/src/Cedar/VLan.h
index 639f57ad..bc95c2db 100644
--- a/src/Cedar/VLan.h
+++ b/src/Cedar/VLan.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLan.h
diff --git a/src/Cedar/VLanUnix.c b/src/Cedar/VLanUnix.c
index d40235dc..93e51d71 100644
--- a/src/Cedar/VLanUnix.c
+++ b/src/Cedar/VLanUnix.c
@@ -16,7 +16,6 @@
// - nattoheaven (https://github.com/nattoheaven)
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -87,6 +86,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLanUnix.c
diff --git a/src/Cedar/VLanUnix.h b/src/Cedar/VLanUnix.h
index ceccd1a0..4f2b529b 100644
--- a/src/Cedar/VLanUnix.h
+++ b/src/Cedar/VLanUnix.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLanUnix.h
diff --git a/src/Cedar/VLanWin32.c b/src/Cedar/VLanWin32.c
index ae83d3ec..f802f3f2 100644
--- a/src/Cedar/VLanWin32.c
+++ b/src/Cedar/VLanWin32.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLanWin32.c
diff --git a/src/Cedar/VLanWin32.h b/src/Cedar/VLanWin32.h
index 831ca694..11d511b5 100644
--- a/src/Cedar/VLanWin32.h
+++ b/src/Cedar/VLanWin32.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// VLanWin32.h
diff --git a/src/Cedar/Virtual.c b/src/Cedar/Virtual.c
index 21e5d6b8..1bc8b132 100644
--- a/src/Cedar/Virtual.c
+++ b/src/Cedar/Virtual.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Virtual.c
@@ -2695,7 +2701,7 @@ NATIVE_STACK *NnGetNextInterface(NATIVE_NAT *t)
UINTToIP(&subnet, opt.SubnetMask);
UINTToIP(&gw, opt.Gateway);
- IPCSetIPv4Parameters(ret->Ipc, &ip, &subnet, &gw);
+ IPCSetIPv4Parameters(ret->Ipc, &ip, &subnet, &gw, &opt.ClasslessRoute);
// Determine the DNS server to use
UINTToIP(&ret->DnsServerIP, opt.DnsServer);
@@ -9427,6 +9433,11 @@ void VirtualDhcpServer(VH *v, PKT *p)
ret.DnsServer2 = v->DhcpDns2;
ret.Gateway = v->DhcpGateway;
+ if (GetGlobalServerFlag(GSF_DISABLE_PUSH_ROUTE) == 0)
+ {
+ Copy(&ret.ClasslessRoute, &v->PushRoute, sizeof(DHCP_CLASSLESS_ROUTE_TABLE));
+ }
+
if (opt->Opcode != DHCP_INFORM)
{
char client_mac[MAX_SIZE];
@@ -9775,6 +9786,10 @@ void GetVirtualHostOption(VH *v, VH_OPTION *o)
// Save a log
o->SaveLog = v->SaveLog;
+
+ // Pushing route option
+ BuildClasslessRouteTableStr(o->DhcpPushRoutes, sizeof(o->DhcpPushRoutes), &v->PushRoute);
+ o->ApplyDhcpPushRoutes = true;
}
UnlockVirtual(v);
}
@@ -9869,6 +9884,19 @@ void SetVirtualHostOption(VH *v, VH_OPTION *vo)
// Save a log
v->SaveLog = vo->SaveLog;
+
+ // DHCP routing table pushing setting
+ if (vo->ApplyDhcpPushRoutes)
+ {
+ DHCP_CLASSLESS_ROUTE_TABLE rt;
+
+ Zero(&rt, sizeof(rt));
+
+ if (ParseClasslessRouteTableStr(&rt, vo->DhcpPushRoutes))
+ {
+ Copy(&v->PushRoute, &rt, sizeof(DHCP_CLASSLESS_ROUTE_TABLE));
+ }
+ }
}
UnlockVirtual(v);
}
diff --git a/src/Cedar/Virtual.h b/src/Cedar/Virtual.h
index 8c4a38ff..aed5d825 100644
--- a/src/Cedar/Virtual.h
+++ b/src/Cedar/Virtual.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Virtual.h
@@ -374,6 +380,7 @@ struct VH
LIST *DhcpLeaseList; // DHCP lease list
UINT64 LastDhcpPolling; // Time which the DHCP list polled last
bool SaveLog; // Save a log
+ DHCP_CLASSLESS_ROUTE_TABLE PushRoute; // Pushing routing table
COUNTER *Counter; // Session counter
UINT DhcpId; // DHCP ID
UINT64 LastSendBeacon; // Time which the beacon has been sent last
@@ -408,6 +415,8 @@ struct VH_OPTION
IP DhcpDnsServerAddress2; // Assigned DNS server address 2
char DhcpDomainName[MAX_HOST_NAME_LEN + 1]; // Assigned domain name
bool SaveLog; // Save a log
+ bool ApplyDhcpPushRoutes; // Apply flag for DhcpPushRoutes
+ char DhcpPushRoutes[MAX_DHCP_CLASSLESS_ROUTE_TABLE_STR_SIZE]; // DHCP pushing routes
};
// DHCP lease entry
diff --git a/src/Cedar/WaterMark.c b/src/Cedar/WaterMark.c
index 575c7cdb..6307d6b7 100644
--- a/src/Cedar/WaterMark.c
+++ b/src/Cedar/WaterMark.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WaterMark.c
diff --git a/src/Cedar/WaterMark.h b/src/Cedar/WaterMark.h
index 275f9bd8..0d6b1af0 100644
--- a/src/Cedar/WaterMark.h
+++ b/src/Cedar/WaterMark.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WaterMark.h
diff --git a/src/Cedar/WebUI.c b/src/Cedar/WebUI.c
index c36a085e..ce169661 100644
--- a/src/Cedar/WebUI.c
+++ b/src/Cedar/WebUI.c
@@ -14,7 +14,6 @@
// Author: Tetsuo Sugiyama
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WebUI.c
diff --git a/src/Cedar/WebUI.h b/src/Cedar/WebUI.h
index 2872a330..34f454df 100644
--- a/src/Cedar/WebUI.h
+++ b/src/Cedar/WebUI.h
@@ -14,7 +14,6 @@
// Author: Tetsuo Sugiyama
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WebUI.h
diff --git a/src/Cedar/Win32Com.cpp b/src/Cedar/Win32Com.cpp
index 0bd99b00..46c8bb4a 100644
--- a/src/Cedar/Win32Com.cpp
+++ b/src/Cedar/Win32Com.cpp
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Win32Com.c
diff --git a/src/Cedar/Win32Com.h b/src/Cedar/Win32Com.h
index c14ca535..7cb0f430 100644
--- a/src/Cedar/Win32Com.h
+++ b/src/Cedar/Win32Com.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Win32Com.h
diff --git a/src/Cedar/WinJumpList.cpp b/src/Cedar/WinJumpList.cpp
index dedf4b35..342f10e2 100644
--- a/src/Cedar/WinJumpList.cpp
+++ b/src/Cedar/WinJumpList.cpp
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WinJumpList.cpp
diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c
index 81463be4..593a3a6b 100644
--- a/src/Cedar/WinUi.c
+++ b/src/Cedar/WinUi.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WinUi.c
@@ -3671,6 +3677,8 @@ void AboutDlgInit(HWND hWnd, WINUI_ABOUT *a)
//DlgFont(hWnd, S_INFO4, 8, false);
SetShow(hWnd, B_UPDATE_CONFIG, (a->Update != NULL));
+
+ Show(hWnd, B_AUTHORS);
}
// Version information procedure
@@ -3721,6 +3729,9 @@ UINT AboutDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param
case B_UPDATE_CONFIG:
ConfigUpdateUi(a->Update, hWnd);
break;
+ case B_AUTHORS:
+ ShowTextFile(hWnd, "|authors.txt", _UU("DLG_ABOUT_AUTHORS"), ICO_ZURUHAM);
+ break;
case B_LANGUAGE:
// Language settings
if (true)
diff --git a/src/Cedar/WinUi.h b/src/Cedar/WinUi.h
index 8db66d9f..a9161253 100644
--- a/src/Cedar/WinUi.h
+++ b/src/Cedar/WinUi.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// WinUi.h
diff --git a/src/Cedar/Wpc.c b/src/Cedar/Wpc.c
index de04979b..392b75ee 100644
--- a/src/Cedar/Wpc.c
+++ b/src/Cedar/Wpc.c
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Wpc.c
diff --git a/src/Cedar/Wpc.h b/src/Cedar/Wpc.h
index 7f9428a3..2836fc59 100644
--- a/src/Cedar/Wpc.h
+++ b/src/Cedar/Wpc.h
@@ -14,7 +14,6 @@
// Author: Daiyuu Nobori
// Comments: Tetsuo Sugiyama, Ph.D.
//
-//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// version 2 as published by the Free Software Foundation.
@@ -85,6 +84,13 @@
// http://www.softether.org/ and ask your question on the users forum.
//
// Thank you for your cooperation.
+//
+//
+// NO MEMORY OR RESOURCE LEAKS
+// ---------------------------
+//
+// The memory-leaks and resource-leaks verification under the stress
+// test has been passed before release this source code.
// Wpc.h