mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2026-04-20 22:09:26 +03:00
Merge pull request #1 from SoftEtherVPN/master
update to latest version
This commit is contained in:
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1448,7 +1448,3 @@ int CompareUserName(void *p1, void *p2)
|
||||
return StrCmpi(u1->Name, u2->Name);
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -317,7 +317,3 @@ char *NormalizePolicyName(char *name);
|
||||
#endif // ACCOUNT_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+11
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Contributors:
|
||||
// - ELIN (https://github.com/el1n)
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
@@ -1166,7 +1166,7 @@ UINT StMakeOpenVpnConfigFile(ADMIN *a, RPC_READ_LOG_FILE *t)
|
||||
|
||||
name = NewName(cn, cn, cn, L"US", NULL, NULL);
|
||||
|
||||
dummy_x = NewRootX(dummy_public_k, dummy_private_k, name, MAX(GetDaysUntil2038(), SERVER_DEFAULT_CERT_DAYS), NULL);
|
||||
dummy_x = NewRootX(dummy_public_k, dummy_private_k, name, GetDaysUntil2038Ex(), NULL);
|
||||
|
||||
FreeName(name);
|
||||
|
||||
@@ -6739,7 +6739,7 @@ UINT StAddCa(ADMIN *a, RPC_HUB_ADD_CA *t)
|
||||
|
||||
if (t->Cert == NULL)
|
||||
{
|
||||
ERR_INVALID_PARAMETER;
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (t->Cert->is_compatible_bit == false)
|
||||
@@ -11840,12 +11840,12 @@ void InRpcHubEnumCa(RPC_HUB_ENUM_CA *t, PACK *p)
|
||||
void OutRpcHubEnumCa(PACK *p, RPC_HUB_ENUM_CA *t)
|
||||
{
|
||||
UINT i;
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
// Validate arguments
|
||||
if (t == NULL || p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
|
||||
for (i = 0;i < t->NumCa;i++)
|
||||
{
|
||||
@@ -12313,12 +12313,12 @@ void InRpcEnumAccessList(RPC_ENUM_ACCESS_LIST *a, PACK *p)
|
||||
void OutRpcEnumAccessList(PACK *p, RPC_ENUM_ACCESS_LIST *a)
|
||||
{
|
||||
UINT i;
|
||||
PackAddStr(p, "HubName", a->HubName);
|
||||
// Validate arguments
|
||||
if (a == NULL || p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PackAddStr(p, "HubName", a->HubName);
|
||||
|
||||
for (i = 0;i < a->NumAccess;i++)
|
||||
{
|
||||
@@ -12573,12 +12573,12 @@ void InRpcEnumUser(RPC_ENUM_USER *t, PACK *p)
|
||||
void OutRpcEnumUser(PACK *p, RPC_ENUM_USER *t)
|
||||
{
|
||||
UINT i;
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
// Validate arguments
|
||||
if (t == NULL || p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
|
||||
for (i = 0;i < t->NumUser;i++)
|
||||
{
|
||||
@@ -12787,12 +12787,12 @@ void InRpcEnumSession(RPC_ENUM_SESSION *t, PACK *p)
|
||||
void OutRpcEnumSession(PACK *p, RPC_ENUM_SESSION *t)
|
||||
{
|
||||
UINT i;
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
// Validate arguments
|
||||
if (t == NULL || p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
PackAddStr(p, "HubName", t->HubName);
|
||||
|
||||
for (i = 0;i < t->NumSession;i++)
|
||||
{
|
||||
@@ -13907,7 +13907,3 @@ bool SiIsEmptyPassword(void *hash_password)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1533,7 +1533,3 @@ void OutRpcInternetSetting(PACK *p, INTERNET_SETTING *t);
|
||||
#endif // ADMIN_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+7
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -205,7 +205,8 @@ void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param)
|
||||
BinToStr(server_cert_hash_str, sizeof(server_cert_hash_str),
|
||||
server_cert_hash, SHA1_SIZE);
|
||||
|
||||
if (IsEmptyStr(ac->DDnsStatusCopy.AzureCertHash) || StrCmpi(server_cert_hash_str, ac->DDnsStatusCopy.AzureCertHash) == 0)
|
||||
if (IsEmptyStr(ac->DDnsStatusCopy.AzureCertHash) || StrCmpi(server_cert_hash_str, ac->DDnsStatusCopy.AzureCertHash) == 0
|
||||
|| StrCmpi(server_cert_hash_str, ac->DDnsStatus.AzureCertHash) == 0)
|
||||
{
|
||||
if (SendAll(ns, AZURE_PROTOCOL_DATA_SIANGTURE, 24, true))
|
||||
{
|
||||
@@ -682,7 +683,3 @@ AZURE_CLIENT *NewAzureClient(CEDAR *cedar, SERVER *server)
|
||||
return ac;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -173,7 +173,3 @@ void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param);
|
||||
#endif // AZURE_CLIENT_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -114,7 +114,3 @@
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -118,7 +118,3 @@
|
||||
#endif // AZURE_SERVER_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+14
-8
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -556,7 +556,13 @@ BRIDGE *BrNewBridge(HUB *h, char *name, POLICY *p, bool local, bool monitor, boo
|
||||
return b;
|
||||
}
|
||||
|
||||
// Raw IP bridge is supported only on Linux
|
||||
bool IsRawIpBridgeSupported()
|
||||
{
|
||||
#ifdef UNIX_LINUX
|
||||
return true;
|
||||
#else // UNIX_LINUX
|
||||
return false;
|
||||
#endif // UNIX_LINUX
|
||||
}
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+9
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -126,6 +126,9 @@
|
||||
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Constants
|
||||
#define BRIDGE_SPECIAL_IPRAW_NAME "ipv4_rawsocket_virtual_router"
|
||||
|
||||
// Bridge
|
||||
struct BRIDGE
|
||||
{
|
||||
@@ -171,12 +174,9 @@ bool DeleteLocalBridge(CEDAR *c, char *hubname, char *devicename);
|
||||
bool IsBridgeSupported();
|
||||
bool IsNeedWinPcap();
|
||||
UINT GetEthDeviceHash();
|
||||
bool IsRawIpBridgeSupported();
|
||||
|
||||
#endif // BRIDGE_H
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+796
-12
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -374,7 +374,7 @@ TOKEN_LIST *GetEthListSolaris()
|
||||
|
||||
#ifdef UNIX_LINUX
|
||||
// Get Ethernet device list on Linux
|
||||
TOKEN_LIST *GetEthListLinux()
|
||||
TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip)
|
||||
{
|
||||
struct ifreq ifr;
|
||||
TOKEN_LIST *t;
|
||||
@@ -383,6 +383,11 @@ TOKEN_LIST *GetEthListLinux()
|
||||
LIST *o;
|
||||
char name[MAX_SIZE];
|
||||
|
||||
if (enum_normal == false && enum_rawip)
|
||||
{
|
||||
return ParseToken(BRIDGE_SPECIAL_IPRAW_NAME, NULL);
|
||||
}
|
||||
|
||||
o = NewListFast(CompareStr);
|
||||
|
||||
s = UnixEthOpenRawSocket();
|
||||
@@ -431,7 +436,7 @@ TOKEN_LIST *GetEthListLinux()
|
||||
Sort(o);
|
||||
|
||||
t = ZeroMalloc(sizeof(TOKEN_LIST));
|
||||
t->NumTokens = LIST_NUM(o);
|
||||
t->NumTokens = LIST_NUM(o) + (enum_rawip ? 1 : 0);
|
||||
t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens);
|
||||
|
||||
for (i = 0;i < LIST_NUM(o);i++)
|
||||
@@ -440,6 +445,11 @@ TOKEN_LIST *GetEthListLinux()
|
||||
t->Token[i] = name;
|
||||
}
|
||||
|
||||
if (enum_rawip)
|
||||
{
|
||||
t->Token[t->NumTokens - 1] = CopyStr(BRIDGE_SPECIAL_IPRAW_NAME);
|
||||
}
|
||||
|
||||
ReleaseList(o);
|
||||
|
||||
return t;
|
||||
@@ -542,11 +552,15 @@ TOKEN_LIST *GetEthListBpf()
|
||||
|
||||
// Enumerate Ethernet devices
|
||||
TOKEN_LIST *GetEthList()
|
||||
{
|
||||
return GetEthListEx(NULL, true, false);
|
||||
}
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip)
|
||||
{
|
||||
TOKEN_LIST *t = NULL;
|
||||
|
||||
#if defined(UNIX_LINUX)
|
||||
t = GetEthListLinux();
|
||||
t = GetEthListLinux(enum_normal, enum_rawip);
|
||||
#elif defined(UNIX_SOLARIS)
|
||||
t = GetEthListSolaris();
|
||||
#elif defined(BRIDGE_PCAP)
|
||||
@@ -575,6 +589,11 @@ ETH *OpenEthLinux(char *name, bool local, bool tapmode, char *tapaddr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (StrCmpi(name, BRIDGE_SPECIAL_IPRAW_NAME) == 0)
|
||||
{
|
||||
return OpenEthLinuxIpRaw();
|
||||
}
|
||||
|
||||
if (tapmode)
|
||||
{
|
||||
#ifndef NO_VLAN
|
||||
@@ -732,6 +751,10 @@ UINT EthGetMtu(ETH *e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (e->CurrentMtu != 0)
|
||||
{
|
||||
@@ -802,6 +825,10 @@ bool EthSetMtu(ETH *e, UINT mtu)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mtu == 0)
|
||||
{
|
||||
@@ -865,6 +892,11 @@ bool EthIsChangeMtuSupported(ETH *e)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
#else // defined(UNIX_LINUX) || defined(UNIX_BSD) || defined(UNIX_SOLARIS)
|
||||
return false;
|
||||
@@ -1526,6 +1558,13 @@ void CloseEth(ETH *e)
|
||||
return;
|
||||
}
|
||||
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
CloseEthLinuxIpRaw(e);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (e->Tap != NULL)
|
||||
{
|
||||
#ifndef NO_VLAN
|
||||
@@ -1647,6 +1686,11 @@ UINT EthGetPacketLinux(ETH *e, void **data)
|
||||
return INFINITE;
|
||||
}
|
||||
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
return EthGetPacketLinuxIpRaw(e, data);
|
||||
}
|
||||
|
||||
if (e->Tap != NULL)
|
||||
{
|
||||
#ifndef NO_VLAN
|
||||
@@ -1949,6 +1993,11 @@ void EthPutPacket(ETH *e, void *data, UINT size)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e->IsRawIpMode)
|
||||
{
|
||||
EthPutPacketLinuxIpRaw(e, data, size);
|
||||
return;
|
||||
}
|
||||
if (size < 14 || size > MAX_PACKET_SIZE)
|
||||
{
|
||||
Free(data);
|
||||
@@ -2017,10 +2066,745 @@ void EthPutPacket(ETH *e, void *data, UINT size)
|
||||
Free(data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Open ETH by using IP raw packets
|
||||
ETH *OpenEthLinuxIpRaw()
|
||||
{
|
||||
ETH *e;
|
||||
|
||||
if (IsRawIpBridgeSupported() == false)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
e = ZeroMalloc(sizeof(ETH));
|
||||
|
||||
e->IsRawIpMode = true;
|
||||
|
||||
e->RawTcp = NewUDP4(MAKE_SPECIAL_PORT(IPPROTO_TCP), NULL);
|
||||
e->RawUdp = NewUDP4(MAKE_SPECIAL_PORT(IPPROTO_UDP), NULL);
|
||||
e->RawIcmp = NewUDP4(MAKE_SPECIAL_PORT(IPPROTO_ICMP), NULL);
|
||||
|
||||
if (e->RawTcp == NULL || e->RawUdp == NULL || e->RawIcmp == NULL)
|
||||
{
|
||||
ReleaseSock(e->RawTcp);
|
||||
ReleaseSock(e->RawUdp);
|
||||
ReleaseSock(e->RawIcmp);
|
||||
|
||||
Free(e);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ClearSockDfBit(e->RawTcp);
|
||||
ClearSockDfBit(e->RawUdp);
|
||||
ClearSockDfBit(e->RawIcmp);
|
||||
|
||||
SetRawSockHeaderIncludeOption(e->RawTcp, true);
|
||||
SetRawSockHeaderIncludeOption(e->RawUdp, true);
|
||||
SetRawSockHeaderIncludeOption(e->RawIcmp, true);
|
||||
|
||||
e->Name = CopyStr(BRIDGE_SPECIAL_IPRAW_NAME);
|
||||
e->Title = CopyStr(BRIDGE_SPECIAL_IPRAW_NAME);
|
||||
e->Cancel = NewCancel();
|
||||
|
||||
UnixDeletePipe(e->Cancel->pipe_read, e->Cancel->pipe_write);
|
||||
e->Cancel->pipe_read = e->Cancel->pipe_write = -1;
|
||||
|
||||
UnixSetSocketNonBlockingMode(e->RawTcp->socket, true);
|
||||
UnixSetSocketNonBlockingMode(e->RawUdp->socket, true);
|
||||
UnixSetSocketNonBlockingMode(e->RawIcmp->socket, true);
|
||||
|
||||
e->Cancel->SpecialFlag = true;
|
||||
e->Cancel->pipe_read = e->RawTcp->socket;
|
||||
e->Cancel->pipe_special_read2 = e->RawUdp->socket;
|
||||
e->Cancel->pipe_special_read3 = e->RawIcmp->socket;
|
||||
|
||||
e->RawIpMyMacAddr[2] = 0x01;
|
||||
e->RawIpMyMacAddr[5] = 0x01;
|
||||
|
||||
SetIP(&e->MyIP, 10, 171, 7, 253);
|
||||
SetIP(&e->YourIP, 10, 171, 7, 254);
|
||||
|
||||
e->RawIpSendQueue = NewQueueFast();
|
||||
|
||||
e->RawIP_TmpBufferSize = 67000;
|
||||
e->RawIP_TmpBuffer = Malloc(e->RawIP_TmpBufferSize);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
// Close ETH by using IP raw packets
|
||||
void CloseEthLinuxIpRaw(ETH *e)
|
||||
{
|
||||
if (e == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
BUF *buf = GetNext(e->RawIpSendQueue);
|
||||
if (buf == NULL)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
FreeBuf(buf);
|
||||
}
|
||||
ReleaseQueue(e->RawIpSendQueue);
|
||||
|
||||
Free(e->Name);
|
||||
Free(e->Title);
|
||||
|
||||
ReleaseSock(e->RawTcp);
|
||||
ReleaseSock(e->RawUdp);
|
||||
ReleaseSock(e->RawIcmp);
|
||||
|
||||
ReleaseCancel(e->Cancel);
|
||||
|
||||
Free(e->RawIP_TmpBuffer);
|
||||
|
||||
Free(e);
|
||||
}
|
||||
|
||||
// Receive an IP raw packet
|
||||
UINT EthGetPacketLinuxIpRaw(ETH *e, void **data)
|
||||
{
|
||||
UINT r;
|
||||
BUF *b;
|
||||
// Validate arguments
|
||||
if (e == NULL || data == NULL)
|
||||
{
|
||||
return INFINITE;
|
||||
}
|
||||
if (e->RawIp_HasError)
|
||||
{
|
||||
return INFINITE;
|
||||
}
|
||||
|
||||
b = GetNext(e->RawIpSendQueue);
|
||||
if (b != NULL)
|
||||
{
|
||||
UINT size;
|
||||
|
||||
*data = b->Buf;
|
||||
size = b->Size;
|
||||
|
||||
Free(b);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
r = EthGetPacketLinuxIpRawForSock(e, data, e->RawTcp, IP_PROTO_TCP);
|
||||
if (r == 0)
|
||||
{
|
||||
r = EthGetPacketLinuxIpRawForSock(e, data, e->RawUdp, IP_PROTO_UDP);
|
||||
if (r == 0)
|
||||
{
|
||||
r = EthGetPacketLinuxIpRawForSock(e, data, e->RawIcmp, IP_PROTO_ICMPV4);
|
||||
}
|
||||
}
|
||||
|
||||
if (r == INFINITE)
|
||||
{
|
||||
e->RawIp_HasError = true;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
// Receive an IP raw packet for the specified socket
|
||||
UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto)
|
||||
{
|
||||
UCHAR *tmp;
|
||||
UINT r;
|
||||
IP src_addr;
|
||||
UINT src_port;
|
||||
UINT ret = INFINITE;
|
||||
UCHAR *retbuf;
|
||||
PKT *p;
|
||||
bool ok = false;
|
||||
// Validate arguments
|
||||
if (e == NULL || data == NULL)
|
||||
{
|
||||
return INFINITE;
|
||||
}
|
||||
|
||||
tmp = e->RawIP_TmpBuffer;
|
||||
|
||||
LABEL_RETRY:
|
||||
*data = NULL;
|
||||
|
||||
r = RecvFrom(s, &src_addr, &src_port, tmp, e->RawIP_TmpBufferSize);
|
||||
if (r == SOCK_LATER)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (r == 0)
|
||||
{
|
||||
if (s->IgnoreRecvErr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return INFINITE;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 14 + r;
|
||||
retbuf = Malloc(ret);
|
||||
*data = retbuf;
|
||||
|
||||
Copy(retbuf, e->RawIpYourMacAddr, 6);
|
||||
Copy(retbuf + 6, e->RawIpMyMacAddr, 6);
|
||||
retbuf[12] = 0x08;
|
||||
retbuf[13] = 0x00;
|
||||
Copy(retbuf + 14, tmp, r);
|
||||
|
||||
// Mangle packet
|
||||
p = ParsePacket(retbuf, ret);
|
||||
if (p != NULL)
|
||||
{
|
||||
if (p->TypeL3 == L3_IPV4)
|
||||
{
|
||||
IPV4_HEADER *ip;
|
||||
IP original_dest_ip;
|
||||
|
||||
ip = p->L3.IPv4Header;
|
||||
|
||||
UINTToIP(&original_dest_ip, ip->DstIP);
|
||||
|
||||
if (IsZeroIP(&e->MyPhysicalIPForce) == false && CmpIpAddr(&e->MyPhysicalIPForce, &original_dest_ip) == 0 ||
|
||||
(IsIPMyHost(&original_dest_ip) && IsLocalHostIP(&original_dest_ip) == false && IsHostIPAddress4(&original_dest_ip)))
|
||||
{
|
||||
if (IsZeroIP(&e->MyPhysicalIPForce) && CmpIpAddr(&e->MyPhysicalIP, &original_dest_ip) != 0)
|
||||
{
|
||||
// Update MyPhysicalIP
|
||||
Copy(&e->MyPhysicalIP, &original_dest_ip, sizeof(IP));
|
||||
// Debug("e->MyPhysicalIP = %r\n", &e->MyPhysicalIP);
|
||||
}
|
||||
|
||||
if (IsZeroIP(&e->MyPhysicalIPForce) == false)
|
||||
{
|
||||
Copy(&e->MyPhysicalIP, &e->MyPhysicalIPForce, sizeof(IP));
|
||||
}
|
||||
|
||||
ip->DstIP = IPToUINT(&e->YourIP);
|
||||
ip->Checksum = 0;
|
||||
ip->Checksum = IpChecksum(ip, IPV4_GET_HEADER_LEN(ip) * 5);
|
||||
|
||||
if (p->TypeL4 == L4_TCP)
|
||||
{
|
||||
TCP_HEADER *tcp = p->L4.TCPHeader;
|
||||
/*
|
||||
if (Endian16(tcp->SrcPort) == 80)
|
||||
{
|
||||
IP a, b;
|
||||
UINTToIP(&a, ip->SrcIP);
|
||||
UINTToIP(&b, ip->DstIP);
|
||||
Debug("%r %r %u %u\n", &a, &b, Endian16(tcp->SrcPort), Endian16(tcp->DstPort));
|
||||
}*/
|
||||
|
||||
ok = true;
|
||||
}
|
||||
else if (p->TypeL4 == L4_UDP)
|
||||
{
|
||||
UDP_HEADER *udp = p->L4.UDPHeader;
|
||||
|
||||
udp->Checksum = 0;
|
||||
|
||||
ok = true;
|
||||
}
|
||||
else if (p->TypeL4 == L4_ICMPV4)
|
||||
{
|
||||
ICMP_HEADER *icmp = p->L4.ICMPHeader;
|
||||
|
||||
if (icmp->Type == ICMP_TYPE_DESTINATION_UNREACHABLE || icmp->Type == ICMP_TYPE_TIME_EXCEEDED)
|
||||
{
|
||||
// Rewrite the Src IP of the IPv4 header of the ICMP response packet
|
||||
UINT size = p->PacketSize - ((UCHAR *)icmp - (UCHAR *)p->PacketData);
|
||||
UCHAR *data = (UCHAR *)icmp;
|
||||
IPV4_HEADER *orig_ipv4 = (IPV4_HEADER *)(((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO));
|
||||
UINT orig_ipv4_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO));
|
||||
|
||||
UINT orig_ipv4_header_size = GetIpHeaderSize((UCHAR *)orig_ipv4, orig_ipv4_size);
|
||||
|
||||
if (orig_ipv4_header_size >= sizeof(IPV4_HEADER) && orig_ipv4_size >= orig_ipv4_header_size)
|
||||
{
|
||||
if (orig_ipv4->Protocol == IP_PROTO_ICMPV4)
|
||||
{
|
||||
// Search the inner ICMP header
|
||||
UINT inner_icmp_size = orig_ipv4_size - orig_ipv4_header_size;
|
||||
|
||||
if (inner_icmp_size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)))
|
||||
{
|
||||
ICMP_HEADER *inner_icmp = (ICMP_HEADER *)(((UCHAR *)data) +
|
||||
sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO) + orig_ipv4_header_size);
|
||||
|
||||
if (inner_icmp->Type == ICMP_TYPE_ECHO_REQUEST)
|
||||
{
|
||||
ICMP_ECHO *inner_echo = (ICMP_ECHO *)(((UCHAR *)inner_icmp) + sizeof(ICMP_HEADER));
|
||||
|
||||
inner_icmp->Checksum = 0;
|
||||
orig_ipv4->SrcIP = IPToUINT(&e->YourIP);
|
||||
orig_ipv4->Checksum = 0;
|
||||
orig_ipv4->Checksum = IpChecksum(orig_ipv4, orig_ipv4_header_size);
|
||||
|
||||
// Rewrite the outer ICMP header
|
||||
if (true)
|
||||
{
|
||||
UCHAR *payload;
|
||||
UINT payload_size;
|
||||
ICMP_ECHO *echo;
|
||||
|
||||
// Echo Response
|
||||
echo = (ICMP_ECHO *)(((UCHAR *)data) + sizeof(ICMP_HEADER));
|
||||
|
||||
if (size >= (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO)))
|
||||
{
|
||||
payload = ((UCHAR *)data) + sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO);
|
||||
payload_size = size - (sizeof(ICMP_HEADER) + sizeof(ICMP_ECHO));
|
||||
|
||||
// Rewrite the header
|
||||
icmp->Checksum = 0;
|
||||
icmp->Checksum = IpChecksum(icmp, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
icmp->Checksum = 0;
|
||||
icmp->Checksum = IpChecksum(icmp, p->PayloadSize);
|
||||
|
||||
ok = true;
|
||||
}
|
||||
else if (p->TypeL4 == L4_FRAGMENT)
|
||||
{
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePacket(p);
|
||||
}
|
||||
|
||||
if (ok == false)
|
||||
{
|
||||
Free(*data);
|
||||
*data = NULL;
|
||||
|
||||
goto LABEL_RETRY;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Send internal IP packet (insert into the send queue)
|
||||
void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol)
|
||||
{
|
||||
BUF *b;
|
||||
if (e == NULL || data == NULL || size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e->RawIpSendQueue->num_item >= 1024)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
b = NewBuf();
|
||||
WriteBuf(b, e->RawIpYourMacAddr, 6);
|
||||
WriteBuf(b, e->RawIpMyMacAddr, 6);
|
||||
WriteBufShort(b, protocol);
|
||||
WriteBuf(b, data, size);
|
||||
SeekBufToBegin(b);
|
||||
|
||||
InsertQueue(e->RawIpSendQueue, b);
|
||||
}
|
||||
|
||||
// Process the packet internal if necessary
|
||||
bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p)
|
||||
{
|
||||
bool ret = false;
|
||||
if (e == NULL || p == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (p->TypeL3 == L3_ARPV4)
|
||||
{
|
||||
// ARP processing
|
||||
ARPV4_HEADER *arp = p->L3.ARPv4Header;
|
||||
|
||||
if (Endian16(arp->HardwareType) == ARP_HARDWARE_TYPE_ETHERNET &&
|
||||
Endian16(arp->ProtocolType) == MAC_PROTO_IPV4 &&
|
||||
arp->HardwareSize == 6 && arp->ProtocolType == 4)
|
||||
{
|
||||
if (IPToUINT(&e->MyIP) == arp->TargetIP)
|
||||
{
|
||||
if (Endian16(arp->Operation) == ARP_OPERATION_REQUEST)
|
||||
{
|
||||
ARPV4_HEADER r;
|
||||
|
||||
Zero(&r, sizeof(r));
|
||||
r.HardwareType = Endian16(ARP_HARDWARE_TYPE_ETHERNET);
|
||||
r.ProtocolType = Endian16(MAC_PROTO_IPV4);
|
||||
r.HardwareSize = 6;
|
||||
r.ProtocolSize = 4;
|
||||
r.Operation = Endian16(ARP_OPERATION_RESPONSE);
|
||||
Copy(r.SrcAddress, e->RawIpMyMacAddr, 6);
|
||||
Copy(r.TargetAddress, arp->SrcAddress, 6);
|
||||
r.SrcIP = IPToUINT(&e->MyIP);
|
||||
r.TargetIP = arp->SrcIP;
|
||||
|
||||
EthSendIpPacketInnerIpRaw(e, &r, sizeof(ARPV4_HEADER), MAC_PROTO_ARPV4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->TypeL3 == L3_IPV4 && p->TypeL4 == L4_UDP && p->TypeL7 == L7_DHCPV4)
|
||||
{
|
||||
// DHCP processing
|
||||
DHCPV4_HEADER *dhcp;
|
||||
UCHAR *data;
|
||||
UINT size;
|
||||
UINT dhcp_header_size;
|
||||
UINT dhcp_data_offset;
|
||||
UINT tran_id;
|
||||
UINT magic_cookie = Endian32(DHCP_MAGIC_COOKIE);
|
||||
bool ok;
|
||||
DHCP_OPTION_LIST *opt;
|
||||
|
||||
dhcp = p->L7.DHCPv4Header;
|
||||
tran_id = Endian32(dhcp->TransactionId);
|
||||
|
||||
// Get the DHCP data and size
|
||||
dhcp_header_size = sizeof(DHCPV4_HEADER);
|
||||
dhcp_data_offset = (UINT)(((UCHAR *)p->L7.DHCPv4Header) - ((UCHAR *)p->MacHeader) + dhcp_header_size);
|
||||
data = ((UCHAR *)dhcp) + dhcp_header_size;
|
||||
size = p->PacketSize - dhcp_data_offset;
|
||||
if (dhcp_header_size < 5)
|
||||
{
|
||||
// Data size is invalid
|
||||
return false;
|
||||
}
|
||||
|
||||
// Search for Magic Cookie
|
||||
ok = false;
|
||||
while (size >= 5)
|
||||
{
|
||||
if (Cmp(data, &magic_cookie, sizeof(magic_cookie)) == 0)
|
||||
{
|
||||
// Found
|
||||
data += 4;
|
||||
size -= 4;
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
data++;
|
||||
size--;
|
||||
}
|
||||
|
||||
if (ok == false)
|
||||
{
|
||||
// The packet is invalid
|
||||
return false;
|
||||
}
|
||||
|
||||
// Parse DHCP options list
|
||||
opt = ParseDhcpOptionList(data, size);
|
||||
if (opt == NULL)
|
||||
{
|
||||
// The packet is invalid
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dhcp->OpCode == 1 && (opt->Opcode == DHCP_DISCOVER || opt->Opcode == DHCP_REQUEST || opt->Opcode == DHCP_INFORM))
|
||||
{
|
||||
// Operate as the server
|
||||
UINT ip = IPToUINT(&e->YourIP);
|
||||
if (ip != 0 || opt->Opcode == DHCP_INFORM)
|
||||
{
|
||||
// Respond if there is providable IP address
|
||||
DHCP_OPTION_LIST ret;
|
||||
LIST *o;
|
||||
UINT hw_type;
|
||||
UINT hw_addr_size;
|
||||
UINT new_ip = ip;
|
||||
IP default_dns;
|
||||
|
||||
Zero(&default_dns, sizeof(default_dns));
|
||||
|
||||
Zero(&ret, sizeof(ret));
|
||||
|
||||
ret.Opcode = (opt->Opcode == DHCP_DISCOVER ? DHCP_OFFER : DHCP_ACK);
|
||||
ret.ServerAddress = IPToUINT(&e->MyIP);
|
||||
ret.LeaseTime = 3600;
|
||||
if (opt->Opcode == DHCP_INFORM)
|
||||
{
|
||||
ret.LeaseTime = 0;
|
||||
}
|
||||
|
||||
ret.SubnetMask = SetIP32(255, 255, 255, 252);
|
||||
|
||||
if (UnixGetDefaultDns(&default_dns) && IsZeroIp(&default_dns) == false)
|
||||
{
|
||||
ret.DnsServer = IPToUINT(&default_dns);
|
||||
ret.DnsServer2 = SetIP32(8, 8, 8, 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret.DnsServer = SetIP32(8, 8, 8, 8);
|
||||
ret.DnsServer2 = SetIP32(8, 8, 4, 4);
|
||||
}
|
||||
|
||||
ret.Gateway = IPToUINT(&e->MyIP);
|
||||
|
||||
if (opt->Opcode != DHCP_INFORM)
|
||||
{
|
||||
char client_mac[MAX_SIZE];
|
||||
char client_ip[64];
|
||||
IP ips;
|
||||
BinToStr(client_mac, sizeof(client_mac), p->MacAddressSrc, 6);
|
||||
UINTToIP(&ips, ip);
|
||||
IPToStr(client_ip, sizeof(client_ip), &ips);
|
||||
Debug("IP_RAW: DHCP %s : %s given %s\n",
|
||||
ret.Opcode == DHCP_OFFER ? "DHCP_OFFER" : "DHCP_ACK",
|
||||
client_mac, client_ip);
|
||||
}
|
||||
|
||||
// Build a DHCP option
|
||||
o = BuildDhcpOption(&ret);
|
||||
if (o != NULL)
|
||||
{
|
||||
BUF *b = BuildDhcpOptionsBuf(o);
|
||||
if (b != NULL)
|
||||
{
|
||||
UINT dest_ip = p->L3.IPv4Header->SrcIP;
|
||||
UINT blank_size = 128 + 64;
|
||||
UINT dhcp_packet_size;
|
||||
UINT magic = Endian32(DHCP_MAGIC_COOKIE);
|
||||
DHCPV4_HEADER *dhcp;
|
||||
void *magic_cookie_addr;
|
||||
void *buffer_addr;
|
||||
|
||||
if (dest_ip == 0)
|
||||
{
|
||||
dest_ip = 0xffffffff;
|
||||
}
|
||||
|
||||
// Calculate the DHCP packet size
|
||||
dhcp_packet_size = blank_size + sizeof(DHCPV4_HEADER) + sizeof(magic) + b->Size;
|
||||
|
||||
if (dhcp_packet_size < DHCP_MIN_SIZE)
|
||||
{
|
||||
// Padding
|
||||
dhcp_packet_size = DHCP_MIN_SIZE;
|
||||
}
|
||||
|
||||
// Create a header
|
||||
dhcp = ZeroMalloc(dhcp_packet_size);
|
||||
|
||||
dhcp->OpCode = 2;
|
||||
dhcp->HardwareType = hw_type;
|
||||
dhcp->HardwareAddressSize = hw_addr_size;
|
||||
dhcp->Hops = 0;
|
||||
dhcp->TransactionId = Endian32(tran_id);
|
||||
dhcp->Seconds = 0;
|
||||
dhcp->Flags = 0;
|
||||
dhcp->YourIP = new_ip;
|
||||
dhcp->ServerIP = IPToUINT(&e->MyIP);
|
||||
Copy(dhcp->ClientMacAddress, p->MacAddressSrc, 6);
|
||||
|
||||
// Calculate the address
|
||||
magic_cookie_addr = (((UCHAR *)dhcp) + sizeof(DHCPV4_HEADER) + blank_size);
|
||||
buffer_addr = ((UCHAR *)magic_cookie_addr) + sizeof(magic);
|
||||
|
||||
// Magic Cookie
|
||||
Copy(magic_cookie_addr, &magic, sizeof(magic));
|
||||
|
||||
// Buffer
|
||||
Copy(buffer_addr, b->Buf, b->Size);
|
||||
|
||||
if (true)
|
||||
{
|
||||
UCHAR *data = ZeroMalloc(sizeof(IPV4_HEADER) + sizeof(UDP_HEADER) + dhcp_packet_size);
|
||||
IPV4_HEADER *ipv4 = (IPV4_HEADER *)(data);
|
||||
UDP_HEADER *udp = (UDP_HEADER *)(data + sizeof(IPV4_HEADER));
|
||||
|
||||
Copy(data + sizeof(IPV4_HEADER) + sizeof(UDP_HEADER), dhcp, dhcp_packet_size);
|
||||
|
||||
IPV4_SET_VERSION(ipv4, 4);
|
||||
IPV4_SET_HEADER_LEN(ipv4, 5);
|
||||
ipv4->TotalLength = Endian16(sizeof(IPV4_HEADER) + sizeof(UDP_HEADER) + dhcp_packet_size);
|
||||
ipv4->TimeToLive = 63;
|
||||
ipv4->Protocol = IP_PROTO_UDP;
|
||||
ipv4->SrcIP = IPToUINT(&e->MyIP);
|
||||
ipv4->DstIP = dest_ip;
|
||||
ipv4->Checksum = IpChecksum(ipv4, sizeof(IPV4_HEADER));
|
||||
|
||||
udp->SrcPort = Endian16(NAT_DHCP_SERVER_PORT);
|
||||
udp->DstPort = Endian16(NAT_DHCP_CLIENT_PORT);
|
||||
udp->PacketLength = Endian16(sizeof(UDP_HEADER) + dhcp_packet_size);
|
||||
udp->Checksum = CalcChecksumForIPv4(ipv4->SrcIP, ipv4->DstIP, IP_PROTO_UDP,
|
||||
dhcp, dhcp_packet_size, 0);
|
||||
if (udp->Checksum == 0)
|
||||
{
|
||||
udp->Checksum = 0xffff;
|
||||
}
|
||||
|
||||
EthSendIpPacketInnerIpRaw(e, data, sizeof(IPV4_HEADER) + sizeof(UDP_HEADER) + dhcp_packet_size, MAC_PROTO_IPV4);
|
||||
|
||||
Free(data);
|
||||
}
|
||||
|
||||
// Release the memory
|
||||
Free(dhcp);
|
||||
FreeBuf(b);
|
||||
}
|
||||
FreeDhcpOptions(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Free(opt);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Send an IP raw packet
|
||||
void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size)
|
||||
{
|
||||
PKT *p;
|
||||
// Validate arguments
|
||||
if (e == NULL || data == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (size < 14 || size > MAX_PACKET_SIZE || e->RawIp_HasError)
|
||||
{
|
||||
Free(data);
|
||||
return;
|
||||
}
|
||||
|
||||
p = ParsePacket(data, size);
|
||||
|
||||
if (p->BroadcastPacket || Cmp(p->MacAddressDest, e->RawIpMyMacAddr, 6) == 0)
|
||||
{
|
||||
if (IsValidUnicastMacAddress(p->MacAddressSrc))
|
||||
{
|
||||
Copy(e->RawIpYourMacAddr, p->MacAddressSrc, 6);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsZero(e->RawIpYourMacAddr, 6) || IsValidUnicastMacAddress(p->MacAddressSrc) == false ||
|
||||
(p->BroadcastPacket == false && Cmp(p->MacAddressDest, e->RawIpMyMacAddr, 6) != 0))
|
||||
{
|
||||
Free(data);
|
||||
FreePacket(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
SOCK *s = NULL;
|
||||
|
||||
if (p->TypeL3 == L3_IPV4)
|
||||
{
|
||||
if (p->TypeL4 == L4_TCP)
|
||||
{
|
||||
if (IsZeroIP(&e->MyPhysicalIP) == false)
|
||||
{
|
||||
s = e->RawTcp;
|
||||
}
|
||||
}
|
||||
else if (p->TypeL4 == L4_UDP)
|
||||
{
|
||||
if (EthProcessIpPacketInnerIpRaw(e, p) == false)
|
||||
{
|
||||
s = e->RawUdp;
|
||||
}
|
||||
}
|
||||
else if (p->TypeL4 == L4_ICMPV4)
|
||||
{
|
||||
if (IsZeroIP(&e->MyPhysicalIP) == false)
|
||||
{
|
||||
s = e->RawIcmp;
|
||||
}
|
||||
}
|
||||
else if (p->TypeL4 == L4_FRAGMENT)
|
||||
{
|
||||
if (IsZeroIP(&e->MyPhysicalIP) == false)
|
||||
{
|
||||
s = e->RawIcmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (p->TypeL3 == L3_ARPV4)
|
||||
{
|
||||
EthProcessIpPacketInnerIpRaw(e, p);
|
||||
}
|
||||
|
||||
if (s != NULL && p->L3.IPv4Header->DstIP != 0xffffffff && p->BroadcastPacket == false &&
|
||||
p->L3.IPv4Header->SrcIP == IPToUINT(&e->YourIP))
|
||||
{
|
||||
UCHAR *send_data = p->IPv4PayloadData;
|
||||
UCHAR *head = p->PacketData;
|
||||
UINT remove_header_size = (UINT)(send_data - head);
|
||||
|
||||
if (p->PacketSize > remove_header_size)
|
||||
{
|
||||
IP dest;
|
||||
UINT send_data_size = p->PacketSize - remove_header_size;
|
||||
|
||||
// checksum
|
||||
if (p->TypeL4 == L4_UDP)
|
||||
{
|
||||
p->L4.UDPHeader->Checksum = 0;
|
||||
}
|
||||
else if (p->TypeL4 == L4_TCP)
|
||||
{
|
||||
p->L4.TCPHeader->Checksum = 0;
|
||||
p->L4.TCPHeader->Checksum = CalcChecksumForIPv4(IPToUINT(&e->MyPhysicalIP),
|
||||
p->L3.IPv4Header->DstIP, IP_PROTO_TCP,
|
||||
p->L4.TCPHeader, p->IPv4PayloadSize, 0);
|
||||
}
|
||||
|
||||
UINTToIP(&dest, p->L3.IPv4Header->DstIP);
|
||||
|
||||
if (s->RawIP_HeaderIncludeFlag == false)
|
||||
{
|
||||
SendTo(s, &dest, 0, send_data, send_data_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPV4_HEADER *ip = p->L3.IPv4Header;
|
||||
|
||||
ip->SrcIP = IPToUINT(&e->MyPhysicalIP);
|
||||
ip->Checksum = 0;
|
||||
ip->Checksum = IpChecksum(ip, IPV4_GET_HEADER_LEN(ip) * 4);
|
||||
|
||||
SendTo(s, &dest, 0, ip, ((UCHAR *)p->PacketData - (UCHAR *)ip) + p->PacketSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreePacket(p);
|
||||
}
|
||||
|
||||
Free(data);
|
||||
}
|
||||
|
||||
|
||||
#endif // BRIDGE_C
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+28
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -162,6 +162,19 @@ struct ETH
|
||||
|
||||
VLAN *Tap; // tap
|
||||
bool Linux_IsAuxDataSupported; // Is PACKET_AUXDATA supported
|
||||
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
SOCK *RawTcp, *RawUdp, *RawIcmp; // RAW sockets
|
||||
bool RawIp_HasError;
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyIP;
|
||||
IP YourIP;
|
||||
QUEUE *RawIpSendQueue;
|
||||
IP MyPhysicalIP;
|
||||
IP MyPhysicalIPForce;
|
||||
UCHAR *RawIP_TmpBuffer;
|
||||
UINT RawIP_TmpBufferSize;
|
||||
};
|
||||
|
||||
#if defined( BRIDGE_BPF ) || defined( BRIDGE_PCAP )
|
||||
@@ -180,7 +193,8 @@ bool IsEthSupportedLinux();
|
||||
bool IsEthSupportedSolaris();
|
||||
bool IsEthSupportedPcap();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListLinux();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListLinux(bool enum_normal, bool enum_rawip);
|
||||
TOKEN_LIST *GetEthListSolaris();
|
||||
TOKEN_LIST *GetEthListPcap();
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
@@ -203,6 +217,14 @@ bool EthIsChangeMtuSupported(ETH *e);
|
||||
bool EthGetInterfaceDescriptionUnix(char *name, char *str, UINT size);
|
||||
bool EthIsInterfaceDescriptionSupportedUnix();
|
||||
|
||||
ETH *OpenEthLinuxIpRaw();
|
||||
void CloseEthLinuxIpRaw(ETH *e);
|
||||
UINT EthGetPacketLinuxIpRaw(ETH *e, void **data);
|
||||
UINT EthGetPacketLinuxIpRawForSock(ETH *e, void **data, SOCK *s, UINT proto);
|
||||
void EthPutPacketLinuxIpRaw(ETH *e, void *data, UINT size);
|
||||
bool EthProcessIpPacketInnerIpRaw(ETH *e, PKT *p);
|
||||
void EthSendIpPacketInnerIpRaw(ETH *e, void *data, UINT size, USHORT protocol);
|
||||
|
||||
#ifdef UNIX_SOLARIS
|
||||
// Function prototype for Solaris
|
||||
bool DlipAttatchRequest(int fd, UINT devid);
|
||||
@@ -216,7 +238,3 @@ int UnixEthOpenRawSocket();
|
||||
#endif // BRIDGEUNIX_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+19
-21
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1356,9 +1356,9 @@ TOKEN_LIST *GetEthList()
|
||||
{
|
||||
UINT v;
|
||||
|
||||
return GetEthListEx(&v);
|
||||
return GetEthListEx(&v, true, false);
|
||||
}
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden)
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip)
|
||||
{
|
||||
TOKEN_LIST *ret;
|
||||
UINT i;
|
||||
@@ -1371,6 +1371,11 @@ TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (enum_normal == false)
|
||||
{
|
||||
return NullToken();
|
||||
}
|
||||
|
||||
if (total_num_including_hidden == NULL)
|
||||
{
|
||||
total_num_including_hidden = &dummy_int;
|
||||
@@ -1894,6 +1899,12 @@ bool IsPcdSupported()
|
||||
UINT type;
|
||||
OS_INFO *info = GetOsInfo();
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
// Windows 10 or later never supports PCD driver.
|
||||
return false;
|
||||
}
|
||||
|
||||
type = info->OsType;
|
||||
|
||||
if (OS_IS_WINDOWS_NT(type) == false)
|
||||
@@ -1972,11 +1983,6 @@ HINSTANCE InstallPcdDriverInternal()
|
||||
src_filename = BRIDGE_WIN32_PCD_SYS_X64;
|
||||
}
|
||||
|
||||
if (MsIsIA64())
|
||||
{
|
||||
src_filename = BRIDGE_WIN32_PCD_SYS_IA64;
|
||||
}
|
||||
|
||||
// Copy see.sys
|
||||
if (FileCopy(src_filename, tmp) == false)
|
||||
{
|
||||
@@ -1995,10 +2001,6 @@ HINSTANCE InstallPcdDriverInternal()
|
||||
{
|
||||
dll_filename = BRIDGE_WIN32_PCD_DLL_X64;
|
||||
}
|
||||
else if (MsIsIA64())
|
||||
{
|
||||
dll_filename = BRIDGE_WIN32_PCD_DLL_IA64;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to load see.dll and initialize
|
||||
@@ -2142,7 +2144,7 @@ RELEASE:
|
||||
return false;
|
||||
}
|
||||
|
||||
o = GetEthListEx(&total_num);
|
||||
o = GetEthListEx(&total_num, true, false);
|
||||
if (o == NULL || total_num == 0)
|
||||
{
|
||||
FreeToken(o);
|
||||
@@ -2241,7 +2243,3 @@ void GetEthNetworkConnectionName(wchar_t *dst, UINT size, char *device_name)
|
||||
#endif // BRIDGE_C
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+14
-14
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -116,11 +116,9 @@
|
||||
|
||||
#define BRIDGE_WIN32_PACKET_DLL "Packet.dll"
|
||||
#define BRIDGE_WIN32_PCD_DLL "|see.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS "|see.sys"
|
||||
#define BRIDGE_WIN32_PCD_SYS "|DriverPackages\\See\\x86\\See_x86.sys"
|
||||
#define BRIDGE_WIN32_PCD_DLL_X64 "|see_x64.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS_X64 "|see_x64.sys"
|
||||
#define BRIDGE_WIN32_PCD_DLL_IA64 "|see_ia64.dll"
|
||||
#define BRIDGE_WIN32_PCD_SYS_IA64 "|see_ia64.sys"
|
||||
#define BRIDGE_WIN32_PCD_SYS_X64 "|DriverPackages\\See\\x64\\See_x64.sys"
|
||||
#define BRIDGE_WIN32_PCD_REGKEY "SYSTEM\\CurrentControlSet\\services\\SEE"
|
||||
#define BRIDGE_WIN32_PCD_BUILDVALUE "CurrentInstalledBuild"
|
||||
|
||||
@@ -215,6 +213,12 @@ struct ETH
|
||||
|
||||
SU *Su; // SeLow handle
|
||||
SU_ADAPTER *SuAdapter; // SeLow adapter handle
|
||||
|
||||
// Unused
|
||||
bool IsRawIpMode; // RAW IP mode
|
||||
UCHAR RawIpMyMacAddr[6];
|
||||
UCHAR RawIpYourMacAddr[6];
|
||||
IP MyPhysicalIPForce;
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
@@ -223,7 +227,7 @@ void FreeEth();
|
||||
bool IsEthSupported();
|
||||
bool IsEthSupportedInner();
|
||||
TOKEN_LIST *GetEthList();
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden);
|
||||
TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, bool enum_rawip);
|
||||
ETH *OpenEth(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
ETH *OpenEthInternal(char *name, bool local, bool tapmode, char *tapaddr);
|
||||
void CloseEth(ETH *e);
|
||||
@@ -262,7 +266,3 @@ bool Win32GetEnableSeLow();
|
||||
#endif // BRIDGEWIN32_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Contributors:
|
||||
// - ELIN (https://github.com/el1n)
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
@@ -12526,7 +12526,3 @@ void *CmUpdateJumpList(UINT start_id)
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -156,7 +156,3 @@ UINT CmGetSecureBitmapId(char *dest_hostname);
|
||||
#endif // CM_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Contributors:
|
||||
// - ELIN (https://github.com/el1n)
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
@@ -639,7 +639,3 @@ bool CmGetProxyServerNameAndPortFromIeProxyRegStr(char *name, UINT name_size, UI
|
||||
void *CmUpdateJumpList(UINT start_id);
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+51
-18
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -118,6 +118,34 @@ static UINT init_cedar_counter = 0;
|
||||
static REF *cedar_log_ref = NULL;
|
||||
static LOG *cedar_log;
|
||||
|
||||
// Check whether there is any EAP-enabled RADIUS configuration
|
||||
bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c)
|
||||
{
|
||||
bool ret = false;
|
||||
UINT i;
|
||||
if (c == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
LockHubList(c);
|
||||
{
|
||||
for (i = 0;i < LIST_NUM(c->HubList);i++)
|
||||
{
|
||||
HUB *hub = LIST_DATA(c->HubList, i);
|
||||
|
||||
if (hub->RadiusConvertAllMsChapv2AuthRequestToEap)
|
||||
{
|
||||
ret = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
UnlockHubList(c);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Get build date of current code
|
||||
UINT64 GetCurrentBuildDate()
|
||||
{
|
||||
@@ -235,18 +263,27 @@ bool IsSupportedWinVer(RPC_WINVER *v)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Enable in future when supported
|
||||
if ((v->VerMajor == 6 && v->VerMinor == 4) ||(v->VerMajor == 10 && v->VerMinor == 0))
|
||||
if ((v->VerMajor == 6 && v->VerMinor == 4) || (v->VerMajor == 10 && v->VerMinor == 0))
|
||||
{
|
||||
// Windows 10, Server 10
|
||||
if (v->ServicePack <= 0)
|
||||
if (v->IsServer == false)
|
||||
{
|
||||
// SP0 only
|
||||
return true;
|
||||
// Windows 10 (not Windows Server 2016)
|
||||
if (v->ServicePack <= 0)
|
||||
{
|
||||
// SP0 only
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows Server 2016
|
||||
if (v->ServicePack <= 0)
|
||||
{
|
||||
// SP0 only
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1722,7 +1759,7 @@ CEDAR *NewCedar(X *server_x, K *server_k)
|
||||
|
||||
c->TrafficDiffList = NewList(NULL);
|
||||
|
||||
SetCedarCipherList(c, "RC4-MD5");
|
||||
SetCedarCipherList(c, SERVER_DEFAULT_CIPHER_NAME);
|
||||
|
||||
c->ClientId = _II("CLIENT_ID");
|
||||
|
||||
@@ -1877,7 +1914,3 @@ void FreeCedar()
|
||||
FreeProtocol();
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+18
-21
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -135,10 +135,10 @@
|
||||
|
||||
|
||||
// Version number
|
||||
#define CEDAR_VER 415
|
||||
#define CEDAR_VER 423
|
||||
|
||||
// Build Number
|
||||
#define CEDAR_BUILD 9546
|
||||
#define CEDAR_BUILD 9647
|
||||
|
||||
// Beta number
|
||||
//#define BETA_NUMBER 3
|
||||
@@ -153,16 +153,16 @@
|
||||
|
||||
// Specify the location to build
|
||||
#ifndef BUILD_PLACE
|
||||
#define BUILD_PLACE "pc30"
|
||||
#define BUILD_PLACE "pc37"
|
||||
#endif // BUILD_PLACE
|
||||
|
||||
// Specifies the build date
|
||||
#define BUILD_DATE_Y 2015
|
||||
#define BUILD_DATE_M 4
|
||||
#define BUILD_DATE_D 5
|
||||
#define BUILD_DATE_HO 2
|
||||
#define BUILD_DATE_MI 54
|
||||
#define BUILD_DATE_SE 8
|
||||
#define BUILD_DATE_Y 2017
|
||||
#define BUILD_DATE_M 10
|
||||
#define BUILD_DATE_D 19
|
||||
#define BUILD_DATE_HO 14
|
||||
#define BUILD_DATE_MI 28
|
||||
#define BUILD_DATE_SE 18
|
||||
|
||||
// Tolerable time difference
|
||||
#define ALLOW_TIMESTAMP_DIFF (UINT64)(3 * 24 * 60 * 60 * 1000)
|
||||
@@ -242,7 +242,7 @@
|
||||
#define FIFO_BUDGET VPN_GP(GP_FIFO_BUDGET, 1000000)
|
||||
#endif // USE_STRATEGY_LOW_MEMORY
|
||||
|
||||
#define MAX_PACKET_SIZE 1560 // Maximum packet size
|
||||
#define MAX_PACKET_SIZE 1600 // Maximum packet size
|
||||
#define UDP_BUF_SIZE (32 * 1024) // Aim of the UDP packet size
|
||||
|
||||
#ifndef USE_STRATEGY_LOW_MEMORY
|
||||
@@ -670,7 +670,7 @@
|
||||
|
||||
#define ARP_ENTRY_EXPIRES (30 * 1000) // ARP table expiration date
|
||||
#define ARP_ENTRY_POLLING_TIME (1 * 1000) // ARP table cleaning timer
|
||||
#define ARP_REQUEST_TIMEOUT (200) // ARP request time-out period
|
||||
#define ARP_REQUEST_TIMEOUT (1000) // ARP request time-out period
|
||||
#define ARP_REQUEST_GIVEUP (5 * 1000) // Time to give up sending the ARP request
|
||||
#define IP_WAIT_FOR_ARP_TIMEOUT (5 * 1000) // Total time that an IP packet waiting for ARP table
|
||||
#define IP_COMBINE_TIMEOUT (10 * 1000) // Time-out of IP packet combining
|
||||
@@ -1052,7 +1052,7 @@ typedef struct CEDAR
|
||||
UINT QueueBudget; // Queue budget
|
||||
LOCK *FifoBudgetLock; // Fifo budget lock
|
||||
UINT FifoBudget; // Fifo budget
|
||||
bool AcceptOnlyTls; // Accept only TLS (Disable SSL)
|
||||
SSL_ACCEPT_SETTINGS SslAcceptSettings; // SSL Accept Settings
|
||||
char OpenVPNDefaultClientOption[MAX_SIZE]; // OpenVPN Default Client Option String
|
||||
} CEDAR;
|
||||
|
||||
@@ -1259,12 +1259,9 @@ UINT CedarGetQueueBudgetConsuming(CEDAR *c);
|
||||
UINT CedarGetFifoBudgetConsuming(CEDAR *c);
|
||||
UINT CedarGetQueueBudgetBalance(CEDAR *c);
|
||||
UINT CedarGetFifoBudgetBalance(CEDAR *c);
|
||||
bool CedarIsThereAnyEapEnabledRadiusConfig(CEDAR *c);
|
||||
|
||||
|
||||
|
||||
#endif // CEDAR_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)Mayaqua\win32_inc;.;$(SolutionDir);WinPcap"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_USE_32BIT_TIME_T"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -188,7 +188,7 @@
|
||||
EnableIntrinsicFunctions="false"
|
||||
FavorSizeOrSpeed="0"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)Mayaqua\win32_inc;.;$(SolutionDir);WinPcap"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_USE_32BIT_TIME_T;VPN_SPEED"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;VPN_SPEED"
|
||||
StringPooling="false"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -113,7 +113,3 @@
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -124,7 +124,3 @@
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <Cedar/Cedar.h>
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+19
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -142,6 +142,16 @@ typedef struct AUTHNT AUTHNT;
|
||||
// ==============================================================
|
||||
|
||||
typedef struct RADIUS_LOGIN_OPTION RADIUS_LOGIN_OPTION;
|
||||
typedef struct RADIUS_PACKET RADIUS_PACKET;
|
||||
typedef struct RADIUS_AVP RADIUS_AVP;
|
||||
typedef struct EAP_CLIENT EAP_CLIENT;
|
||||
typedef struct EAP_MESSAGE EAP_MESSAGE;
|
||||
typedef struct EAP_MSCHAPV2_GENERAL EAP_MSCHAPV2_GENERAL;
|
||||
typedef struct EAP_MSCHAPV2_CHALLENGE EAP_MSCHAPV2_CHALLENGE;
|
||||
typedef struct EAP_MSCHAPV2_RESPONSE EAP_MSCHAPV2_RESPONSE;
|
||||
typedef struct EAP_MSCHAPV2_SUCCESS_SERVER EAP_MSCHAPV2_SUCCESS_SERVER;
|
||||
typedef struct EAP_MSCHAPV2_SUCCESS_CLIENT EAP_MSCHAPV2_SUCCESS_CLIENT;
|
||||
typedef struct EAP_PEAP EAP_PEAP;
|
||||
|
||||
|
||||
// ==============================================================
|
||||
@@ -528,6 +538,8 @@ typedef struct CTC CTC;
|
||||
typedef struct CTR CTR;
|
||||
typedef struct TTC TTC;
|
||||
typedef struct TTS TTS;
|
||||
typedef struct TTS_WORKER TTS_WORKER;
|
||||
typedef struct TTC_WORKER TTC_WORKER;
|
||||
typedef struct TT_RESULT TT_RESULT;
|
||||
typedef struct TTS_SOCK TTS_SOCK;
|
||||
typedef struct TTC_SOCK TTC_SOCK;
|
||||
@@ -738,6 +750,8 @@ typedef struct MIRROR_SERVER MIRROR_SERVER;
|
||||
// ==============================================================
|
||||
|
||||
typedef struct NATIVE_STACK NATIVE_STACK;
|
||||
typedef struct IPTABLES_STATE IPTABLES_STATE;
|
||||
typedef struct IPTABLES_ENTRY IPTABLES_ENTRY;
|
||||
|
||||
|
||||
// ==============================================================
|
||||
@@ -751,7 +765,3 @@ typedef struct SU_ADAPTER_LIST SU_ADAPTER_LIST;
|
||||
|
||||
|
||||
#endif // CEDARTYPE_H
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+12
-14
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Contributors:
|
||||
// - nattoheaven (https://github.com/nattoheaven)
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
@@ -2181,13 +2181,14 @@ BUF *CiAccountToCfg(RPC_CLIENT_CREATE_ACCOUNT *t)
|
||||
// RPC dispatch routine
|
||||
PACK *CiRpcDispatch(RPC *rpc, char *name, PACK *p)
|
||||
{
|
||||
CLIENT *c = rpc->Param;
|
||||
PACK *ret;
|
||||
CLIENT *c;
|
||||
// Validate arguments
|
||||
if (rpc == NULL || name == NULL || p == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
c = rpc->Param;
|
||||
|
||||
ret = NewPack();
|
||||
|
||||
@@ -6029,12 +6030,13 @@ L_TRY:
|
||||
ReleaseSock(s);
|
||||
|
||||
ret = ZeroMalloc(sizeof(REMOTE_CLIENT));
|
||||
ret->Rpc = rpc;
|
||||
rpc->Param = ret;
|
||||
|
||||
if (ret != NULL)
|
||||
{
|
||||
RPC_CLIENT_VERSION t;
|
||||
|
||||
ret->Rpc = rpc;
|
||||
Zero(&t, sizeof(t));
|
||||
CcGetClientVersion(ret, &t);
|
||||
ret->OsType = t.OsType;
|
||||
@@ -6487,7 +6489,7 @@ bool Win32CiSecureSign(SECURE_SIGN *sign)
|
||||
// Success
|
||||
ret = true;
|
||||
sign->ClientCert = batch[0].OutputX;
|
||||
Copy(sign->Signature, batch[1].OutputSign, 128);
|
||||
Copy(sign->Signature, batch[1].OutputSign, MIN(sizeof(sign->Signature),sizeof(batch[1].OutputSign)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6661,7 +6663,7 @@ bool CtConnect(CLIENT *c, RPC_CLIENT_CONNECT *connect)
|
||||
CiSetError(c, ERR_ACCOUNT_ACTIVE);
|
||||
}
|
||||
else if (r->ClientAuth->AuthType == CLIENT_AUTHTYPE_SECURE &&
|
||||
client->UseSecureDeviceId == 0)
|
||||
c->UseSecureDeviceId == 0)
|
||||
{
|
||||
// Secure device is not specified
|
||||
CiSetError(c, ERR_NO_SECURE_DEVICE_SPECIFIED);
|
||||
@@ -8450,7 +8452,7 @@ bool CtCreateVLan(CLIENT *c, RPC_CLIENT_CREATE_VLAN *create)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Regulation in Windows 8
|
||||
// Regulation in Windows 8 / 10
|
||||
if (MsIsInfCatalogRequired())
|
||||
{
|
||||
if (CiIsValidVLanRegulatedName(create->DeviceName) == false)
|
||||
@@ -11110,7 +11112,3 @@ void CiClientStatusPrinter(SESSION *s, wchar_t *status)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -878,7 +878,3 @@ void CiInitDriverVerStruct(MS_DRIVER_VER *ver);
|
||||
#endif // CLIENT_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+565
-322
File diff suppressed because it is too large
Load Diff
+35
-12
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -181,13 +181,30 @@ struct TTC
|
||||
THREAD *Thread; // Thread
|
||||
volatile bool Halt; // Halting flag
|
||||
bool *Cancel; // Halting flag 2
|
||||
SOCK_EVENT *SockEvent; // Socket event
|
||||
LIST *ItcSockList; // Client socket list
|
||||
TT_RESULT Result; // Result
|
||||
UINT ErrorCode; // Error code
|
||||
bool AbnormalTerminated; // Abnormal termination
|
||||
EVENT *StartEvent; // Start event
|
||||
EVENT *InitedEvent; // Initialize completion notification event
|
||||
LIST *WorkerThreadList; // List of worker threads
|
||||
|
||||
UINT flag1, flag2;
|
||||
|
||||
UINT64 session_id;
|
||||
UINT64 end_tick;
|
||||
UINT64 start_tick;
|
||||
};
|
||||
|
||||
// Traffic test worker thread
|
||||
struct TTC_WORKER
|
||||
{
|
||||
THREAD *WorkerThread;
|
||||
TTC *Ttc;
|
||||
LIST *SockList; // Client socket list
|
||||
SOCK_EVENT *SockEvent; // Socket event
|
||||
EVENT *StartEvent; // Start event
|
||||
bool Ok; // The result
|
||||
};
|
||||
|
||||
// Server side socket
|
||||
@@ -202,7 +219,10 @@ struct TTS_SOCK
|
||||
UINT64 SessionId; // Session ID
|
||||
bool NoMoreSendData; // Flag not to send more data
|
||||
UINT64 FirstRecvTick; // Time which the data has been received last
|
||||
UINT64 FirstSendTick; // Time which the data has been sent last
|
||||
UINT64 Span; // Period
|
||||
UINT64 GiveupSpan;
|
||||
UINT64 LastCommTime;
|
||||
};
|
||||
|
||||
// Traffic test server
|
||||
@@ -213,15 +233,22 @@ struct TTS
|
||||
volatile bool Halt; // Halting flag
|
||||
UINT Port; // Port number
|
||||
THREAD *Thread; // Thread
|
||||
THREAD *WorkThread; // Worker thread
|
||||
THREAD *IPv6AcceptThread; // IPv6 Accept thread
|
||||
SOCK *ListenSocket; // Socket to wait
|
||||
SOCK *ListenSocketV6; // Socket to wait (IPv6)
|
||||
UINT ErrorCode; // Error code
|
||||
UINT IdSeed; // ID value
|
||||
LIST *WorkerList; // Worker threads list
|
||||
};
|
||||
|
||||
// Traffic test worker thread
|
||||
struct TTS_WORKER
|
||||
{
|
||||
TTS *Tts; // TTS
|
||||
THREAD *WorkThread; // Worker thread
|
||||
SOCK_EVENT *SockEvent; // Socket event
|
||||
LIST *TtsSockList; // Server socket list
|
||||
bool NewSocketArrived; // New socket has arrived
|
||||
UINT IdSeed; // ID value
|
||||
};
|
||||
|
||||
// VPN Tools context
|
||||
@@ -673,7 +700,3 @@ UINT PsVpnAzureGetStatus(CONSOLE *c, char *cmd_name, wchar_t *str, void *param);
|
||||
#endif // COMMAND_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+8
-14
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1030,7 +1030,7 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
|
||||
UINT size;
|
||||
SESSION *s;
|
||||
HUB *hub = NULL;
|
||||
bool use_qos;
|
||||
bool use_qos = false;
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
@@ -1038,11 +1038,11 @@ void ConnectionSend(CONNECTION *c, UINT64 now)
|
||||
}
|
||||
|
||||
s = c->Session;
|
||||
use_qos = s->QoS;
|
||||
|
||||
if (s != NULL)
|
||||
{
|
||||
hub = s->Hub;
|
||||
use_qos = s->QoS;
|
||||
}
|
||||
|
||||
// Protocol
|
||||
@@ -3137,10 +3137,7 @@ void ConnectionAccept(CONNECTION *c)
|
||||
|
||||
// Start the SSL communication
|
||||
Debug("StartSSL()\n");
|
||||
if (c->Cedar->AcceptOnlyTls)
|
||||
{
|
||||
s->AcceptOnlyTls = true;
|
||||
}
|
||||
Copy(&s->SslAcceptSettings, &c->Cedar->SslAcceptSettings, sizeof(SSL_ACCEPT_SETTINGS));
|
||||
if (StartSSL(s, x, k) == false)
|
||||
{
|
||||
// Failed
|
||||
@@ -3672,6 +3669,3 @@ CONNECTION *NewClientConnectionEx(SESSION *s, char *client_str, UINT client_ver,
|
||||
|
||||
return c;
|
||||
}
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+6
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -144,7 +144,7 @@ struct SECURE_SIGN
|
||||
char SecurePrivateKeyName[MAX_SECURE_DEVICE_FILE_LEN + 1]; // Secure device secret key name
|
||||
X *ClientCert; // Client certificate
|
||||
UCHAR Random[SHA1_SIZE]; // Random value for signature
|
||||
UCHAR Signature[128]; // Signed data
|
||||
UCHAR Signature[4096 / 8]; // Signed data
|
||||
UINT UseSecureDeviceId;
|
||||
UINT BitmapId; // Bitmap ID
|
||||
};
|
||||
@@ -372,7 +372,3 @@ UINT GetMachineRand();
|
||||
|
||||
|
||||
#endif // CONNECTION_H
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+33
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -769,6 +769,18 @@ bool DispatchNextCmdEx(CONSOLE *c, wchar_t *exec_command, char *prompt, CMD cmd[
|
||||
// Show the prompt
|
||||
RETRY:
|
||||
tmp = CopyStrToUni(prompt);
|
||||
|
||||
if (c->ProgrammingMode)
|
||||
{
|
||||
wchar_t tmp2[MAX_PATH];
|
||||
|
||||
UniFormat(tmp2, sizeof(tmp2), L"[PROMPT:%u:%s]\r\n", c->RetCode, tmp);
|
||||
|
||||
Free(tmp);
|
||||
|
||||
tmp = CopyUniStr(tmp2);
|
||||
}
|
||||
|
||||
str = c->ReadLine(c, tmp, false);
|
||||
Free(tmp);
|
||||
|
||||
@@ -1430,6 +1442,14 @@ EVAL_VALUE:
|
||||
Free(str);
|
||||
break;
|
||||
}
|
||||
else if (c->ProgrammingMode)
|
||||
{
|
||||
// In the programming mode, return the error immediately.
|
||||
ok = false;
|
||||
Free(name);
|
||||
Free(str);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Request to re-enter
|
||||
@@ -1458,7 +1478,11 @@ EVAL_VALUE:
|
||||
wchar_t *tmp;
|
||||
SHOW_PROMPT:
|
||||
// Prompt because it is a mandatory parameter
|
||||
tmp = p->PromptProc(c, p->PromptProcParam);
|
||||
tmp = NULL;
|
||||
if (c->ProgrammingMode == false)
|
||||
{
|
||||
tmp = p->PromptProc(c, p->PromptProcParam);
|
||||
}
|
||||
if (tmp == NULL)
|
||||
{
|
||||
// User canceled
|
||||
@@ -2213,6 +2237,7 @@ CONSOLE *NewLocalConsole(wchar_t *infile, wchar_t *outfile)
|
||||
c->ReadPassword = ConsoleLocalReadPassword;
|
||||
c->Write = ConsoleLocalWrite;
|
||||
c->GetWidth = ConsoleLocalGetWidth;
|
||||
c->OutputLock = NewLock();
|
||||
|
||||
if (UniIsEmptyStr(infile) == false)
|
||||
{
|
||||
@@ -2324,6 +2349,8 @@ void ConsoleLocalFree(CONSOLE *c)
|
||||
Free(p);
|
||||
}
|
||||
|
||||
DeleteLock(c->OutputLock);
|
||||
|
||||
// Memory release
|
||||
Free(c);
|
||||
}
|
||||
@@ -2534,7 +2561,3 @@ void ConsoleWriteOutFile(CONSOLE *c, wchar_t *str, bool add_last_crlf)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+7
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -160,6 +160,8 @@ struct CONSOLE
|
||||
char *(*ReadPassword)(CONSOLE *c, wchar_t *prompt); // Function to read the password
|
||||
bool (*Write)(CONSOLE *c, wchar_t *str); // Function to write a string
|
||||
UINT (*GetWidth)(CONSOLE *c); // Get the width of the screen
|
||||
bool ProgrammingMode; // Programming Mode
|
||||
LOCK *OutputLock; // Output Lock
|
||||
};
|
||||
|
||||
// Local console parameters
|
||||
@@ -246,7 +248,3 @@ UINT ConsoleLocalGetWidth(CONSOLE *c);
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+18
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -624,8 +624,9 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
|
||||
PackAddInt(req, "lasterror_ipv4", c->Err_IPv4_GetMyIp);
|
||||
PackAddInt(req, "lasterror_ipv6", c->Err_IPv6_GetMyIp);
|
||||
PackAddBool(req, "use_azure", use_azure);
|
||||
PackAddStr(req, "product_str", CEDAR_PRODUCT_STR);
|
||||
PackAddStr(req, "product_str", "SoftEther OSS");
|
||||
PackAddInt(req, "ddns_protocol_version", DDNS_VERSION);
|
||||
PackAddInt(req, "ddns_oss", 1);
|
||||
|
||||
|
||||
if (use_azure)
|
||||
@@ -670,9 +671,12 @@ UINT DCRegister(DDNS_CLIENT *c, bool ipv6, DDNS_REGISTER_PARAM *p, char *replace
|
||||
if (ret == NULL)
|
||||
{
|
||||
Debug("WpcCall: %s\n", url3);
|
||||
ret = WpcCallEx(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req,
|
||||
NULL, NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL), NULL, DDNS_RPC_MAX_RECV_SIZE,
|
||||
add_header_name, add_header_value);
|
||||
ret = WpcCallEx2(url3, &t, DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, "register", req,
|
||||
NULL, NULL, ((cert_hash != NULL && ((cert_hash->Size % SHA1_SIZE) == 0)) ? cert_hash->Buf : NULL),
|
||||
(cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0),
|
||||
NULL, DDNS_RPC_MAX_RECV_SIZE,
|
||||
add_header_name, add_header_value,
|
||||
DDNS_SNI_VER_STRING);
|
||||
Debug("WpcCall Ret: %u\n", ret);
|
||||
}
|
||||
|
||||
@@ -874,8 +878,11 @@ UINT DCGetMyIpMain(DDNS_CLIENT *c, bool ipv6, char *dst, UINT dst_size, bool use
|
||||
}
|
||||
|
||||
|
||||
recv = HttpRequest(&data, (ipv6 ? NULL : &c->InternetSetting), DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, &ret, false, NULL, NULL,
|
||||
NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL));
|
||||
StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING);
|
||||
|
||||
recv = HttpRequestEx3(&data, (ipv6 ? NULL : &c->InternetSetting), DDNS_CONNECT_TIMEOUT, DDNS_COMM_TIMEOUT, &ret, false, NULL, NULL,
|
||||
NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL),
|
||||
(cert_hash != NULL ? cert_hash->Size / SHA1_SIZE : 0), NULL, 0, NULL, NULL);
|
||||
|
||||
FreeBuf(cert_hash);
|
||||
|
||||
@@ -1040,7 +1047,3 @@ void DCGenNewKey(UCHAR *key)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+17
-14
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -115,11 +115,18 @@
|
||||
#define DDNS_H
|
||||
|
||||
// Certificate hash
|
||||
#define DDNS_CERT_HASH "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3"
|
||||
#define DDNS_CERT_HASH "78BF0499A99396907C9F49DD13571C81FE26E6F5" \
|
||||
"439BAFA75A6EE5671FC9F9A02D34FF29881761A0" \
|
||||
"EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3" \
|
||||
"74DF99D4B1B5F0488A388B50D347D26013DC67A5" \
|
||||
"6EBB39AFCA8C900635CFC11218CF293A612457E4"
|
||||
|
||||
#define DDNS_SNI_VER_STRING "DDNS"
|
||||
|
||||
|
||||
// Destination URL
|
||||
#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.servers.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.servers-v6.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V4_GLOBAL "https://x%c.x%c.dev.servers.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_GLOBAL "https://x%c.x%c.dev.servers-v6.ddns.softether-network.net/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_GLOBAL "http://get-my-ip.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_GLOBAL "http://get-my-ip-v6.ddns.softether-network.net/ddns/getmyip.ashx"
|
||||
|
||||
@@ -132,8 +139,8 @@
|
||||
#define DDNS_REPLACE_URL2_FOR_WEST_NGN "http://senet.p-ns.flets-west.jp/ddns/getmyip.ashx"
|
||||
|
||||
// For China: Free version
|
||||
#define DDNS_URL_V4_ALT "https://x%c.x%c.servers.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_ALT "https://x%c.x%c.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V4_ALT "https://x%c.x%c.dev.servers.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL_V6_ALT "https://x%c.x%c.dev.servers-v6.ddns.uxcom.jp/ddns/ddns.aspx"
|
||||
#define DDNS_URL2_V4_ALT "http://get-my-ip.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
#define DDNS_URL2_V6_ALT "http://get-my-ip-v6.ddns.uxcom.jp/ddns/getmyip.ashx"
|
||||
|
||||
@@ -241,7 +248,3 @@ void DCGetInternetSetting(DDNS_CLIENT *c, INTERNET_SETTING *t);
|
||||
#endif // DDNS_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -263,7 +263,3 @@ bool LiIsLicenseKey(char *str)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -122,7 +122,3 @@ bool LiStrToKeyBit(UCHAR *keybit, char *keystr);
|
||||
#endif // DATABASE_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1500,7 +1500,3 @@ RETRY:
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -120,7 +120,3 @@ void EMExec();
|
||||
#endif // EM_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-8
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -147,6 +147,3 @@ void EmLicenseAddDlgUpdate(HWND hWnd, RPC *s);
|
||||
void EmLicenseAddDlgShiftTextItem(HWND hWnd, UINT id1, UINT id2, UINT *next_focus);
|
||||
void EmLicenseAddDlgGetText(HWND hWnd, char *str, UINT size);
|
||||
void EmLicenseAddDlgOnOk(HWND hWnd, RPC *s);
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1380,7 +1380,3 @@ void ElFree()
|
||||
el_lock = NULL;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -279,7 +279,3 @@ void OutRpcElLicenseStatus(PACK *p, RPC_EL_LICENSE_STATUS *t);
|
||||
#endif // ETHERLOG_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+110
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -166,6 +166,103 @@ ADMIN_OPTION admin_options[] =
|
||||
|
||||
UINT num_admin_options = sizeof(admin_options) / sizeof(ADMIN_OPTION);
|
||||
|
||||
|
||||
// Create an EAP client for the specified Virtual Hub
|
||||
EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username)
|
||||
{
|
||||
HUB *hub = NULL;
|
||||
EAP_CLIENT *ret = NULL;
|
||||
char radius_servers[MAX_PATH] = {0};
|
||||
UINT radius_port = 0;
|
||||
UINT radius_retry_interval = 0;
|
||||
char radius_secret[MAX_PATH] = {0};
|
||||
char radius_suffix_filter[MAX_PATH] = {0};
|
||||
if (cedar == NULL || hubname == NULL || client_ip_str == NULL || username == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Find the Virtual Hub
|
||||
LockHubList(cedar);
|
||||
{
|
||||
hub = GetHub(cedar, hubname);
|
||||
}
|
||||
UnlockHubList(cedar);
|
||||
|
||||
if (hub != NULL)
|
||||
{
|
||||
if (GetRadiusServerEx2(hub, radius_servers, sizeof(radius_servers), &radius_port, radius_secret,
|
||||
sizeof(radius_secret), &radius_retry_interval, radius_suffix_filter, sizeof(radius_suffix_filter)))
|
||||
{
|
||||
bool use_peap = hub->RadiusUsePeapInsteadOfEap;
|
||||
|
||||
if (IsEmptyStr(radius_suffix_filter) || EndWith(username, radius_suffix_filter))
|
||||
{
|
||||
TOKEN_LIST *radius_servers_list = ParseToken(radius_servers, " ,;\t");
|
||||
|
||||
if (radius_servers_list != NULL && radius_servers_list->NumTokens >= 1)
|
||||
{
|
||||
// Try for each of RADIUS servers
|
||||
UINT i;
|
||||
bool finish = false;
|
||||
|
||||
for (i = 0;i < radius_servers_list->NumTokens;i++)
|
||||
{
|
||||
EAP_CLIENT *eap;
|
||||
IP ip;
|
||||
|
||||
if (GetIP(&ip, radius_servers_list->Token[i]))
|
||||
{
|
||||
eap = NewEapClient(&ip, radius_port, radius_secret, radius_retry_interval,
|
||||
RADIUS_INITIAL_EAP_TIMEOUT, client_ip_str, username, hubname);
|
||||
|
||||
if (eap != NULL)
|
||||
{
|
||||
if (use_peap == false)
|
||||
{
|
||||
// EAP
|
||||
if (EapClientSendMsChapv2AuthRequest(eap))
|
||||
{
|
||||
eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT;
|
||||
ret = eap;
|
||||
finish = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// PEAP
|
||||
if (PeapClientSendMsChapv2AuthRequest(eap))
|
||||
{
|
||||
eap->GiveupTimeout = RADIUS_RETRY_TIMEOUT;
|
||||
ret = eap;
|
||||
finish = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (finish == false)
|
||||
{
|
||||
ReleaseEapClient(eap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finish)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeToken(radius_servers_list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReleaseHub(hub);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Create a user list
|
||||
LIST *NewUserList()
|
||||
{
|
||||
@@ -587,6 +684,7 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
|
||||
GetHubAdminOptionDataAndSet(ao, "SecureNAT_MaxIcmpSessionsPerIp", &o->SecureNAT_MaxIcmpSessionsPerIp);
|
||||
GetHubAdminOptionDataAndSet(ao, "AccessListIncludeFileCacheLifetime", &o->AccessListIncludeFileCacheLifetime);
|
||||
GetHubAdminOptionDataAndSet(ao, "DisableKernelModeSecureNAT", &o->DisableKernelModeSecureNAT);
|
||||
GetHubAdminOptionDataAndSet(ao, "DisableIpRawModeSecureNAT", &o->DisableIpRawModeSecureNAT);
|
||||
GetHubAdminOptionDataAndSet(ao, "DisableUserModeSecureNAT", &o->DisableUserModeSecureNAT);
|
||||
GetHubAdminOptionDataAndSet(ao, "DisableCheckMacOnLocalBridge", &o->DisableCheckMacOnLocalBridge);
|
||||
GetHubAdminOptionDataAndSet(ao, "DisableCorrectIpOffloadChecksum", &o->DisableCorrectIpOffloadChecksum);
|
||||
@@ -598,9 +696,12 @@ void DataToHubOptionStruct(HUB_OPTION *o, RPC_ADMIN_OPTION *ao)
|
||||
GetHubAdminOptionDataAndSet(ao, "SuppressClientUpdateNotification", &o->SuppressClientUpdateNotification);
|
||||
GetHubAdminOptionDataAndSet(ao, "FloodingSendQueueBufferQuota", &o->FloodingSendQueueBufferQuota);
|
||||
GetHubAdminOptionDataAndSet(ao, "AssignVLanIdByRadiusAttribute", &o->AssignVLanIdByRadiusAttribute);
|
||||
GetHubAdminOptionDataAndSet(ao, "DenyAllRadiusLoginWithNoVlanAssign", &o->DenyAllRadiusLoginWithNoVlanAssign);
|
||||
GetHubAdminOptionDataAndSet(ao, "SecureNAT_RandomizeAssignIp", &o->SecureNAT_RandomizeAssignIp);
|
||||
GetHubAdminOptionDataAndSet(ao, "DetectDormantSessionInterval", &o->DetectDormantSessionInterval);
|
||||
GetHubAdminOptionDataAndSet(ao, "NoPhysicalIPOnPacketLog", &o->NoPhysicalIPOnPacketLog);
|
||||
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsDhcpUserClassOption", &o->UseHubNameAsDhcpUserClassOption);
|
||||
GetHubAdminOptionDataAndSet(ao, "UseHubNameAsRadiusNasId", &o->UseHubNameAsRadiusNasId);
|
||||
}
|
||||
|
||||
// Convert the contents of the HUB_OPTION to data
|
||||
@@ -656,6 +757,7 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
|
||||
Add(aol, NewAdminOption("SecureNAT_MaxIcmpSessionsPerIp", o->SecureNAT_MaxIcmpSessionsPerIp));
|
||||
Add(aol, NewAdminOption("AccessListIncludeFileCacheLifetime", o->AccessListIncludeFileCacheLifetime));
|
||||
Add(aol, NewAdminOption("DisableKernelModeSecureNAT", o->DisableKernelModeSecureNAT));
|
||||
Add(aol, NewAdminOption("DisableIpRawModeSecureNAT", o->DisableIpRawModeSecureNAT));
|
||||
Add(aol, NewAdminOption("DisableUserModeSecureNAT", o->DisableUserModeSecureNAT));
|
||||
Add(aol, NewAdminOption("DisableCheckMacOnLocalBridge", o->DisableCheckMacOnLocalBridge));
|
||||
Add(aol, NewAdminOption("DisableCorrectIpOffloadChecksum", o->DisableCorrectIpOffloadChecksum));
|
||||
@@ -667,9 +769,12 @@ void HubOptionStructToData(RPC_ADMIN_OPTION *ao, HUB_OPTION *o, char *hub_name)
|
||||
Add(aol, NewAdminOption("SuppressClientUpdateNotification", o->SuppressClientUpdateNotification));
|
||||
Add(aol, NewAdminOption("FloodingSendQueueBufferQuota", o->FloodingSendQueueBufferQuota));
|
||||
Add(aol, NewAdminOption("AssignVLanIdByRadiusAttribute", o->AssignVLanIdByRadiusAttribute));
|
||||
Add(aol, NewAdminOption("DenyAllRadiusLoginWithNoVlanAssign", o->DenyAllRadiusLoginWithNoVlanAssign));
|
||||
Add(aol, NewAdminOption("SecureNAT_RandomizeAssignIp", o->SecureNAT_RandomizeAssignIp));
|
||||
Add(aol, NewAdminOption("DetectDormantSessionInterval", o->DetectDormantSessionInterval));
|
||||
Add(aol, NewAdminOption("NoPhysicalIPOnPacketLog", o->NoPhysicalIPOnPacketLog));
|
||||
Add(aol, NewAdminOption("UseHubNameAsDhcpUserClassOption", o->UseHubNameAsDhcpUserClassOption));
|
||||
Add(aol, NewAdminOption("UseHubNameAsRadiusNasId", o->UseHubNameAsRadiusNasId));
|
||||
|
||||
Zero(ao, sizeof(RPC_ADMIN_OPTION));
|
||||
|
||||
@@ -1122,12 +1227,6 @@ bool IsValidCertInHub(HUB *h, X *x)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsXRevoked(x))
|
||||
{
|
||||
// Disabled by the CRL stored in the file
|
||||
return false;
|
||||
}
|
||||
|
||||
LockList(h->HubDb->CrlList);
|
||||
{
|
||||
ret = IsCertMatchCrlList(x, h->HubDb->CrlList);
|
||||
@@ -7335,7 +7434,3 @@ HUBDB *NewHubDb()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+12
-8
@@ -3,15 +3,15 @@
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -265,6 +265,7 @@ struct HUB_OPTION
|
||||
UINT SecureNAT_MaxIcmpSessionsPerIp; // Maximum number of ICMP sessions per IP address
|
||||
UINT AccessListIncludeFileCacheLifetime; // Expiration of the access list external file (in seconds)
|
||||
bool DisableKernelModeSecureNAT; // Disable the kernel mode NAT
|
||||
bool DisableIpRawModeSecureNAT; // Disable the IP Raw Mode NAT
|
||||
bool DisableUserModeSecureNAT; // Disable the user mode NAT
|
||||
bool DisableCheckMacOnLocalBridge; // Disable the MAC address verification in local bridge
|
||||
bool DisableCorrectIpOffloadChecksum; // Disable the correction of checksum that is IP-Offloaded
|
||||
@@ -276,9 +277,12 @@ struct HUB_OPTION
|
||||
bool SuppressClientUpdateNotification; // Suppress the update notification function on the VPN Client
|
||||
UINT FloodingSendQueueBufferQuota; // The global quota of send queues of flooding packets
|
||||
bool AssignVLanIdByRadiusAttribute; // Assign the VLAN ID for the VPN session, by the attribute value of RADIUS
|
||||
bool DenyAllRadiusLoginWithNoVlanAssign; // Deny all RADIUS login with no VLAN ID assigned
|
||||
bool SecureNAT_RandomizeAssignIp; // Randomize the assignment IP address for new DHCP client
|
||||
UINT DetectDormantSessionInterval; // Interval (seconds) threshold to detect a dormant VPN session
|
||||
bool NoPhysicalIPOnPacketLog; // Disable saving physical IP address on the packet log
|
||||
bool UseHubNameAsDhcpUserClassOption; // Add HubName to DHCP request as User-Class option
|
||||
bool UseHubNameAsRadiusNasId; // Add HubName to Radius request as NAS-Identifier attrioption
|
||||
};
|
||||
|
||||
// MAC table entry
|
||||
@@ -434,6 +438,9 @@ struct HUB
|
||||
UINT RadiusRetryInterval; // Radius retry interval
|
||||
BUF *RadiusSecret; // Radius shared key
|
||||
char RadiusSuffixFilter[MAX_SIZE]; // Radius suffix filter
|
||||
char RadiusRealm[MAX_SIZE]; // Radius realm (optional)
|
||||
bool RadiusConvertAllMsChapv2AuthRequestToEap; // Convert all MS-CHAPv2 auth request to EAP
|
||||
bool RadiusUsePeapInsteadOfEap; // Use PEAP instead of EAP
|
||||
volatile bool Halt; // Halting flag
|
||||
bool Offline; // Offline
|
||||
bool BeingOffline; // Be Doing Offline
|
||||
@@ -636,11 +643,8 @@ void CalcTrafficDiff(TRAFFIC *diff, TRAFFIC *old, TRAFFIC *current);
|
||||
bool CheckMaxLoggedPacketsPerMinute(SESSION *s, UINT max_packets, UINT64 now);
|
||||
void VgsSetUserAgentValue(char *str);
|
||||
void VgsSetEmbTag(bool b);
|
||||
EAP_CLIENT *HubNewEapClient(CEDAR *cedar, char *hubname, char *client_ip_str, char *username);
|
||||
|
||||
#endif // HUB_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -793,7 +793,3 @@ IPSEC_SERVER *NewIPsecServer(CEDAR *cedar)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -203,7 +203,3 @@ void IPSecSetDisable(bool b);
|
||||
|
||||
#endif // IPSEC_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -170,7 +170,7 @@ void EtherIPIpcConnectThread(THREAD *t, void *p)
|
||||
&s->ClientIP, s->ClientPort,
|
||||
&s->ServerIP, s->ServerPort,
|
||||
tmp,
|
||||
s->CryptName, true, mss);
|
||||
s->CryptName, true, mss, NULL);
|
||||
|
||||
if (ipc != NULL)
|
||||
{
|
||||
@@ -563,7 +563,3 @@ UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -174,7 +174,3 @@ UINT CalcEtherIPTcpMss(ETHERIP_SERVER *s);
|
||||
#endif // IPSEC_ETHERIP_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+22
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -113,6 +113,7 @@
|
||||
|
||||
#include "CedarPch.h"
|
||||
|
||||
//#define RAW_DEBUG
|
||||
|
||||
// Processing of IKE received packet
|
||||
void ProcIKEPacketRecv(IKE_SERVER *ike, UDPPACKET *p)
|
||||
@@ -753,7 +754,7 @@ void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p)
|
||||
// Transport mode
|
||||
if (next_header == IP_PROTO_UDP)
|
||||
{
|
||||
if (ike->IPsec->Services.L2TP_IPsec)
|
||||
if (ike->IPsec->Services.L2TP_IPsec || ike->IPsec->Services.EtherIP_IPsec)
|
||||
{
|
||||
// An UDP packet has been received
|
||||
ProcIPsecUdpPacketRecv(ike, c, dec_data, dec_size);
|
||||
@@ -791,6 +792,19 @@ void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p)
|
||||
if (ipsec_sa->PairIPsecSa != NULL)
|
||||
{
|
||||
c->CurrentIpSecSaSend = ipsec_sa->PairIPsecSa;
|
||||
|
||||
if (p->DestPort == IPSEC_PORT_IPSEC_ESP_UDP)
|
||||
{
|
||||
IPSECSA *send_sa = c->CurrentIpSecSaSend;
|
||||
if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TUNNEL)
|
||||
{
|
||||
send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TUNNEL_1;
|
||||
}
|
||||
else if (send_sa->TransformSetting.CapsuleMode == IKE_P2_CAPSULE_TRANSPORT)
|
||||
{
|
||||
send_sa->TransformSetting.CapsuleMode = IKE_P2_CAPSULE_NAT_TRANSPORT_1;
|
||||
}
|
||||
}
|
||||
}
|
||||
c->LastCommTick = ike->Now;
|
||||
ipsec_sa->LastCommTick = ike->Now;
|
||||
@@ -4711,6 +4725,8 @@ bool GetBestTransformSettingForIPsecSa(IKE_SERVER *ike, IKE_PACKET *pr, IPSEC_SA
|
||||
IKE_PACKET_TRANSFORM_PAYLOAD *transform = &transform_payload->Payload.Transform;
|
||||
IPSEC_SA_TRANSFORM_SETTING set;
|
||||
|
||||
Zero(&set, sizeof(set));
|
||||
|
||||
if (TransformPayloadToTransformSettingForIPsecSa(ike, transform, &set, server_ip))
|
||||
{
|
||||
Copy(setting, &set, sizeof(IPSEC_SA_TRANSFORM_SETTING));
|
||||
@@ -5971,7 +5987,3 @@ IKE_SERVER *NewIKEServer(CEDAR *cedar, IPSEC_SERVER *ipsec)
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -474,7 +474,3 @@ IKE_SA *SearchIkeSaByCookie(IKE_SERVER *ike, UINT64 init_cookie, UINT64 resp_coo
|
||||
|
||||
#endif // IPSEC_IKE_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+55
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -133,20 +133,27 @@ bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *pa
|
||||
|
||||
t = ParseTokenWithNullStr(password, ":");
|
||||
|
||||
if (t->NumTokens == 5)
|
||||
if (t->NumTokens == 6)
|
||||
{
|
||||
BUF *b1, *b2, *b3;
|
||||
BUF *b1, *b2, *b3, *b4;
|
||||
|
||||
b1 = StrToBin(t->Token[2]);
|
||||
b2 = StrToBin(t->Token[3]);
|
||||
b3 = StrToBin(t->Token[4]);
|
||||
b4 = StrToBin(t->Token[5]);
|
||||
|
||||
if (IsEmptyStr(t->Token[1]) == false && b1->Size == 16 && b2->Size == 16 && b3->Size == 24)
|
||||
if (IsEmptyStr(t->Token[1]) == false && b1->Size == 16 && b2->Size == 16 && b3->Size == 24
|
||||
&& b4->Size == 8)
|
||||
{
|
||||
UINT64 eap_client_ptr = 0;
|
||||
|
||||
StrCpy(d->MsChapV2_PPPUsername, sizeof(d->MsChapV2_PPPUsername), t->Token[1]);
|
||||
Copy(d->MsChapV2_ServerChallenge, b1->Buf, 16);
|
||||
Copy(d->MsChapV2_ClientChallenge, b2->Buf, 16);
|
||||
Copy(d->MsChapV2_ClientResponse, b3->Buf, 24);
|
||||
Copy(&eap_client_ptr, b4->Buf, 8);
|
||||
|
||||
d->MsChapV2_EapClient = (EAP_CLIENT *)eap_client_ptr;
|
||||
|
||||
ret = true;
|
||||
}
|
||||
@@ -154,6 +161,7 @@ bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *pa
|
||||
FreeBuf(b1);
|
||||
FreeBuf(b2);
|
||||
FreeBuf(b3);
|
||||
FreeBuf(b4);
|
||||
}
|
||||
|
||||
FreeToken(t);
|
||||
@@ -315,7 +323,7 @@ IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code)
|
||||
param->UserName, param->Password, error_code, ¶m->ClientIp,
|
||||
param->ClientPort, ¶m->ServerIp, param->ServerPort,
|
||||
param->ClientHostname, param->CryptName,
|
||||
param->BridgeMode, param->Mss);
|
||||
param->BridgeMode, param->Mss, NULL);
|
||||
|
||||
return ipc;
|
||||
}
|
||||
@@ -324,7 +332,7 @@ IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code)
|
||||
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password,
|
||||
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
|
||||
char *client_hostname, char *crypt_name,
|
||||
bool bridge_mode, UINT mss)
|
||||
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client)
|
||||
{
|
||||
IPC *ipc;
|
||||
UINT dummy_int = 0;
|
||||
@@ -418,7 +426,6 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
|
||||
|
||||
// Upload the authentication data
|
||||
p = PackLoginWithPlainPassword(hubname, username, password);
|
||||
PackAddInt64(p, "timestamp", SystemTime64());
|
||||
PackAddStr(p, "hello", client_name);
|
||||
PackAddInt(p, "client_ver", cedar->Version);
|
||||
PackAddInt(p, "client_build", cedar->Build);
|
||||
@@ -431,6 +438,14 @@ IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char
|
||||
PackAddBool(p, "require_monitor_mode", false);
|
||||
PackAddBool(p, "qos", false);
|
||||
|
||||
if (eap_client != NULL)
|
||||
{
|
||||
UINT64 ptr = (UINT64)eap_client;
|
||||
PackAddInt64(p, "release_me_eap_client", ptr);
|
||||
|
||||
AddRef(eap_client->Ref);
|
||||
}
|
||||
|
||||
// Unique ID is determined by the sum of the connecting client IP address and the client_name
|
||||
b = NewBuf();
|
||||
WriteBuf(b, client_ip, sizeof(IP));
|
||||
@@ -663,6 +678,24 @@ void FreeIPC(IPC *ipc)
|
||||
Free(ipc);
|
||||
}
|
||||
|
||||
// Set User Class option if corresponding Virtual Hub optin is set
|
||||
void IPCDhcpSetConditionalUserClass(IPC *ipc, DHCP_OPTION_LIST *req)
|
||||
{
|
||||
HUB *hub;
|
||||
|
||||
hub = GetHub(ipc->Cedar, ipc->HubName);
|
||||
if (hub == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (hub->Option && hub->Option->UseHubNameAsDhcpUserClassOption)
|
||||
{
|
||||
StrCpy(req->UserClass, sizeof(req->UserClass), ipc->HubName);
|
||||
}
|
||||
ReleaseHub(hub);
|
||||
}
|
||||
|
||||
// Release the IP address from the DHCP server
|
||||
void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server)
|
||||
{
|
||||
@@ -677,6 +710,7 @@ void IPCDhcpFreeIP(IPC *ipc, IP *dhcp_server)
|
||||
Zero(&req, sizeof(req));
|
||||
req.Opcode = DHCP_RELEASE;
|
||||
req.ServerAddress = IPToUINT(dhcp_server);
|
||||
IPCDhcpSetConditionalUserClass(ipc, &req);
|
||||
|
||||
FreeDHCPv4Data(IPCSendDhcpRequest(ipc, NULL, tran_id, &req, 0, 0, NULL));
|
||||
}
|
||||
@@ -697,6 +731,7 @@ void IPCDhcpRenewIP(IPC *ipc, IP *dhcp_server)
|
||||
req.Opcode = DHCP_REQUEST;
|
||||
StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname);
|
||||
req.RequestedIp = IPToUINT(&ipc->ClientIPAddress);
|
||||
IPCDhcpSetConditionalUserClass(ipc, &req);
|
||||
|
||||
FreeDHCPv4Data(IPCSendDhcpRequest(ipc, dhcp_server, tran_id, &req, 0, 0, NULL));
|
||||
}
|
||||
@@ -719,6 +754,7 @@ bool IPCDhcpRequestInformIP(IPC *ipc, DHCP_OPTION_LIST *opt, TUBE *discon_poll_t
|
||||
req.Opcode = DHCP_INFORM;
|
||||
req.ClientAddress = IPToUINT(client_ip);
|
||||
StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname);
|
||||
IPCDhcpSetConditionalUserClass(ipc, &req);
|
||||
|
||||
d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube);
|
||||
if (d == NULL)
|
||||
@@ -783,6 +819,7 @@ LABEL_RETRY_FOR_OPENVPN:
|
||||
req.RequestedIp = request_ip;
|
||||
req.Opcode = DHCP_DISCOVER;
|
||||
StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname);
|
||||
IPCDhcpSetConditionalUserClass(ipc, &req);
|
||||
|
||||
d = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_OFFER, IPC_DHCP_TIMEOUT, discon_poll_tube);
|
||||
if (d == NULL)
|
||||
@@ -893,6 +930,7 @@ LABEL_RETRY_FOR_OPENVPN:
|
||||
StrCpy(req.Hostname, sizeof(req.Hostname), ipc->ClientHostname);
|
||||
req.ServerAddress = d->ParsedOptionList->ServerAddress;
|
||||
req.RequestedIp = d->ParsedOptionList->ClientAddress;
|
||||
IPCDhcpSetConditionalUserClass(ipc, &req);
|
||||
|
||||
d2 = IPCSendDhcpRequest(ipc, NULL, tran_id, &req, DHCP_ACK, IPC_DHCP_TIMEOUT, discon_poll_tube);
|
||||
if (d2 == NULL)
|
||||
@@ -1227,6 +1265,12 @@ BUF *IPCBuildDhcpRequestOptions(IPC *ipc, DHCP_OPTION_LIST *opt)
|
||||
Add(o, NewDhcpOption(DHCP_ID_HOST_NAME, opt->Hostname, StrLen(opt->Hostname)));
|
||||
}
|
||||
|
||||
// User Class
|
||||
if (IsEmptyStr(opt->UserClass) == false)
|
||||
{
|
||||
Add(o, NewDhcpOption(DHCP_ID_USER_CLASS, opt->UserClass, StrLen(opt->UserClass)));
|
||||
}
|
||||
|
||||
// Vendor
|
||||
Add(o, NewDhcpOption(DHCP_ID_VENDOR_ID, IPC_DHCP_VENDOR_ID, StrLen(IPC_DHCP_VENDOR_ID)));
|
||||
|
||||
@@ -2073,7 +2117,3 @@ BLOCK *IPCRecvL2(IPC *ipc)
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+7
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -218,12 +218,13 @@ struct IPC_MSCHAP_V2_AUTHINFO
|
||||
UCHAR MsChapV2_ServerChallenge[16]; // MS-CHAPv2 Server Challenge
|
||||
UCHAR MsChapV2_ClientChallenge[16]; // MS-CHAPv2 Client Challenge
|
||||
UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response
|
||||
EAP_CLIENT *MsChapV2_EapClient; // EAP client
|
||||
};
|
||||
|
||||
IPC *NewIPC(CEDAR *cedar, char *client_name, char *postfix, char *hubname, char *username, char *password,
|
||||
UINT *error_code, IP *client_ip, UINT client_port, IP *server_ip, UINT server_port,
|
||||
char *client_hostname, char *crypt_name,
|
||||
bool bridge_mode, UINT mss);
|
||||
bool bridge_mode, UINT mss, EAP_CLIENT *eap_client);
|
||||
IPC *NewIPCByParam(CEDAR *cedar, IPC_PARAM *param, UINT *error_code);
|
||||
IPC *NewIPCBySock(CEDAR *cedar, SOCK *s, void *mac_address);
|
||||
void FreeIPC(IPC *ipc);
|
||||
@@ -268,7 +269,3 @@ bool ParseAndExtractMsChapV2InfoFromPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *pa
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+73
-19
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -2558,8 +2558,8 @@ IKE_ENGINE *NewIkeEngine()
|
||||
{
|
||||
IKE_ENGINE *e = ZeroMalloc(sizeof(IKE_ENGINE));
|
||||
IKE_CRYPTO *des, *des3, *aes;
|
||||
IKE_HASH *sha1, *md5;
|
||||
IKE_DH *dh1, *dh2, *dh5;
|
||||
IKE_HASH *sha1, *md5, *sha2_256, *sha2_384, *sha2_512;
|
||||
IKE_DH *dh1, *dh2, *dh5, *dh2048, *dh3072, *dh4096;
|
||||
UINT des_key_sizes[] =
|
||||
{
|
||||
8,
|
||||
@@ -2594,6 +2594,14 @@ IKE_ENGINE *NewIkeEngine()
|
||||
// SHA-1
|
||||
sha1 = NewIkeHash(e, IKE_HASH_SHA1_ID, IKE_HASH_SHA1_STRING, 20);
|
||||
|
||||
// SHA-2
|
||||
// sha2-256
|
||||
sha2_256 = NewIkeHash(e, IKE_HASH_SHA2_256_ID, IKE_HASH_SHA2_256_STRING, 32);
|
||||
// sha2-384
|
||||
sha2_384 = NewIkeHash(e, IKE_HASH_SHA2_384_ID, IKE_HASH_SHA2_384_STRING, 48);
|
||||
// sha2-512
|
||||
sha2_512 = NewIkeHash(e, IKE_HASH_SHA2_512_ID, IKE_HASH_SHA2_512_STRING, 64);
|
||||
|
||||
// MD5
|
||||
md5 = NewIkeHash(e, IKE_HASH_MD5_ID, IKE_HASH_MD5_STRING, 16);
|
||||
|
||||
@@ -2601,6 +2609,9 @@ IKE_ENGINE *NewIkeEngine()
|
||||
dh1 = NewIkeDh(e, IKE_DH_1_ID, IKE_DH_1_STRING, 96);
|
||||
dh2 = NewIkeDh(e, IKE_DH_2_ID, IKE_DH_2_STRING, 128);
|
||||
dh5 = NewIkeDh(e, IKE_DH_5_ID, IKE_DH_5_STRING, 192);
|
||||
dh2048 = NewIkeDh(e, IKE_DH_2048_ID, IKE_DH_2048_STRING, 256);
|
||||
dh3072 = NewIkeDh(e, IKE_DH_3072_ID, IKE_DH_3072_STRING, 384);
|
||||
dh4096 = NewIkeDh(e, IKE_DH_4096_ID, IKE_DH_4096_STRING, 512);
|
||||
|
||||
// Define the IKE algorithm
|
||||
e->IkeCryptos[IKE_P1_CRYPTO_DES_CBC] = des;
|
||||
@@ -2608,6 +2619,10 @@ IKE_ENGINE *NewIkeEngine()
|
||||
e->IkeCryptos[IKE_P1_CRYPTO_AES_CBC] = aes;
|
||||
e->IkeHashes[IKE_P1_HASH_MD5] = md5;
|
||||
e->IkeHashes[IKE_P1_HASH_SHA1] = sha1;
|
||||
e->IkeHashes[IKE_P1_HASH_SHA2_256] = sha2_256;
|
||||
e->IkeHashes[IKE_P1_HASH_SHA2_384] = sha2_384;
|
||||
e->IkeHashes[IKE_P1_HASH_SHA2_512] = sha2_512;
|
||||
|
||||
|
||||
// Definition of ESP algorithm
|
||||
e->EspCryptos[IKE_TRANSFORM_ID_P2_ESP_DES] = des;
|
||||
@@ -2620,6 +2635,9 @@ IKE_ENGINE *NewIkeEngine()
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_768_MODP] = e->EspDhs[IKE_P2_DH_GROUP_768_MODP] = dh1;
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_1024_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1024_MODP] = dh2;
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_1536_MODP] = e->EspDhs[IKE_P2_DH_GROUP_1536_MODP] = dh5;
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_2048_MODP] = e->EspDhs[IKE_P2_DH_GROUP_2048_MODP] = dh2048;
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_3072_MODP] = e->EspDhs[IKE_P2_DH_GROUP_3072_MODP] = dh3072;
|
||||
e->IkeDhs[IKE_P1_DH_GROUP_4096_MODP] = e->EspDhs[IKE_P2_DH_GROUP_4096_MODP] = dh4096;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -2925,6 +2943,15 @@ void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size)
|
||||
// SHA-1
|
||||
Sha1(dst, src, size);
|
||||
break;
|
||||
case IKE_HASH_SHA2_256_ID:
|
||||
Sha2_256(dst, src, size);
|
||||
break;
|
||||
case IKE_HASH_SHA2_384_ID:
|
||||
Sha2_384(dst, src, size);
|
||||
break;
|
||||
case IKE_HASH_SHA2_512_ID:
|
||||
Sha2_512(dst, src, size);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Unknown
|
||||
@@ -2936,11 +2963,12 @@ void IkeHash(IKE_HASH *h, void *dst, void *src, UINT size)
|
||||
// Calculation of HMAC
|
||||
void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT data_size)
|
||||
{
|
||||
UCHAR k[HMAC_BLOCK_SIZE];
|
||||
UINT hmac_block_size = HMAC_BLOCK_SIZE;
|
||||
UCHAR k[HMAC_BLOCK_SIZE_MAX];
|
||||
UCHAR *data1;
|
||||
UCHAR hash1[IKE_MAX_HASH_SIZE];
|
||||
UINT data1_size;
|
||||
UCHAR data2[IKE_MAX_HASH_SIZE + HMAC_BLOCK_SIZE];
|
||||
UCHAR data2[IKE_MAX_HASH_SIZE + HMAC_BLOCK_SIZE_MAX];
|
||||
UINT data2_size;
|
||||
UCHAR tmp1600[1600];
|
||||
bool no_free = false;
|
||||
@@ -2951,6 +2979,27 @@ void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT
|
||||
return;
|
||||
}
|
||||
|
||||
switch (h->HashId)
|
||||
{
|
||||
case IKE_HASH_SHA1_ID:
|
||||
case IKE_HASH_SHA2_256_ID:
|
||||
hmac_block_size = HMAC_BLOCK_SIZE;
|
||||
break;
|
||||
|
||||
case IKE_HASH_SHA2_384_ID:
|
||||
case IKE_HASH_SHA2_512_ID:
|
||||
hmac_block_size = HMAC_BLOCK_SIZE_1024;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (hmac_block_size > HMAC_BLOCK_SIZE_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (h->HashId == IKE_HASH_SHA1_ID)
|
||||
{
|
||||
// Use special function (fast) in the case of SHA-1
|
||||
@@ -2966,7 +3015,7 @@ void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT
|
||||
|
||||
// Creating a K
|
||||
Zero(k, sizeof(k));
|
||||
if (key_size <= HMAC_BLOCK_SIZE)
|
||||
if (key_size <= hmac_block_size)
|
||||
{
|
||||
Copy(k, key, key_size);
|
||||
}
|
||||
@@ -2976,7 +3025,7 @@ void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT
|
||||
}
|
||||
|
||||
// Generation of data 1
|
||||
data1_size = data_size + HMAC_BLOCK_SIZE;
|
||||
data1_size = data_size + hmac_block_size;
|
||||
|
||||
if (data1_size > sizeof(tmp1600))
|
||||
{
|
||||
@@ -2988,12 +3037,12 @@ void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT
|
||||
no_free = true;
|
||||
}
|
||||
|
||||
for (i = 0;i < HMAC_BLOCK_SIZE;i++)
|
||||
for (i = 0;i < hmac_block_size;i++)
|
||||
{
|
||||
data1[i] = k[i] ^ 0x36;
|
||||
}
|
||||
|
||||
Copy(data1 + HMAC_BLOCK_SIZE, data, data_size);
|
||||
Copy(data1 + hmac_block_size, data, data_size);
|
||||
|
||||
// Calculate the hash value
|
||||
IkeHash(h, hash1, data1, data1_size);
|
||||
@@ -3004,14 +3053,14 @@ void IkeHMac(IKE_HASH *h, void *dst, void *key, UINT key_size, void *data, UINT
|
||||
}
|
||||
|
||||
// Generation of data 2
|
||||
data2_size = h->HashSize + HMAC_BLOCK_SIZE;
|
||||
data2_size = h->HashSize + hmac_block_size;
|
||||
|
||||
for (i = 0;i < HMAC_BLOCK_SIZE;i++)
|
||||
{
|
||||
data2[i] = k[i] ^ 0x5c;
|
||||
}
|
||||
|
||||
Copy(data2 + HMAC_BLOCK_SIZE, hash1, h->HashSize);
|
||||
Copy(data2 + hmac_block_size, hash1, h->HashSize);
|
||||
|
||||
// Calculate the hash value
|
||||
IkeHash(h, dst, data2, data2_size);
|
||||
@@ -3132,6 +3181,15 @@ DH_CTX *IkeDhNewCtx(IKE_DH *d)
|
||||
|
||||
case IKE_DH_5_ID:
|
||||
return DhNewGroup5();
|
||||
|
||||
case IKE_DH_2048_ID:
|
||||
return DhNew2048();
|
||||
|
||||
case IKE_DH_3072_ID:
|
||||
return DhNew3072();
|
||||
|
||||
case IKE_DH_4096_ID:
|
||||
return DhNew4096();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -3153,7 +3211,3 @@ void IkeDhFreeCtx(DH_CTX *dh)
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+43
-11
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -120,7 +120,7 @@
|
||||
#endif // OS_WIN32
|
||||
|
||||
// Maximum hash size
|
||||
#define IKE_MAX_HASH_SIZE 20 // Size of SHA-1 is the maximum for now
|
||||
#define IKE_MAX_HASH_SIZE 64 // Size of SHA-2-512 is the maximum for now
|
||||
|
||||
// Maximum block size
|
||||
#define IKE_MAX_BLOCK_SIZE 16 // Size of AES is maximum at the moment
|
||||
@@ -224,6 +224,7 @@ struct IKE_TRANSFORM_VALUE
|
||||
} GCC_PACKED;
|
||||
|
||||
// The Type value in IKE transform value (Phase 1)
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_TRANSFORM_VALUE_P1_CRYPTO 1 // Encryption algorithm
|
||||
#define IKE_TRANSFORM_VALUE_P1_HASH 2 // Hash algorithm
|
||||
#define IKE_TRANSFORM_VALUE_P1_AUTH_METHOD 3 // Authentication method
|
||||
@@ -233,6 +234,7 @@ struct IKE_TRANSFORM_VALUE
|
||||
#define IKE_TRANSFORM_VALUE_P1_KET_SIZE 14 // Key size
|
||||
|
||||
// The Type value in IKE transform values (Phase 2)
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_TRANSFORM_VALUE_P2_LIFE_TYPE 1 // Expiration date type
|
||||
#define IKE_TRANSFORM_VALUE_P2_LIFE_VALUE 2 // Expiration date
|
||||
#define IKE_TRANSFORM_VALUE_P2_DH_GROUP 3 // DH group number
|
||||
@@ -241,6 +243,7 @@ struct IKE_TRANSFORM_VALUE
|
||||
#define IKE_TRANSFORM_VALUE_P2_KEY_SIZE 6 // Key size
|
||||
|
||||
// Phase 1: The encryption algorithm in the IKE transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P1_CRYPTO_DES_CBC 1
|
||||
#define IKE_P1_CRYPTO_BLOWFISH 3
|
||||
#define IKE_P1_CRYPTO_3DES_CBC 5
|
||||
@@ -248,30 +251,45 @@ struct IKE_TRANSFORM_VALUE
|
||||
#define IKE_P1_CRYPTO_AES_CBC 7
|
||||
|
||||
// Phase 1: The hash algorithm in IKE transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P1_HASH_MD5 1
|
||||
#define IKE_P1_HASH_SHA1 2
|
||||
#define IKE_P1_HASH_SHA2_256 4
|
||||
#define IKE_P1_HASH_SHA2_384 5
|
||||
#define IKE_P1_HASH_SHA2_512 6
|
||||
|
||||
// Phase 1: The authentication method in the IKE transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P1_AUTH_METHOD_PRESHAREDKEY 1
|
||||
#define IKE_P1_AUTH_METHOD_RSA_SIGN 3
|
||||
|
||||
// Phase 1: The DH group number in the IKE transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P1_DH_GROUP_768_MODP 1
|
||||
#define IKE_P1_DH_GROUP_1024_MODP 2
|
||||
#define IKE_P1_DH_GROUP_1536_MODP 5
|
||||
#define IKE_P1_DH_GROUP_2048_MODP 14
|
||||
#define IKE_P1_DH_GROUP_3072_MODP 15
|
||||
#define IKE_P1_DH_GROUP_4096_MODP 16
|
||||
|
||||
// Phase 1: The expiration date type in IKE transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P1_LIFE_TYPE_SECONDS 1
|
||||
#define IKE_P1_LIFE_TYPE_KILOBYTES 2
|
||||
|
||||
// Phase 2: The HMAC algorithm in IPsec transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P2_HMAC_MD5_96 1
|
||||
#define IKE_P2_HMAC_SHA1_96 2
|
||||
|
||||
// Phase 2: The DH group number in the IPsec transform value
|
||||
// MUST BE LESS THAN "MAX_IKE_ENGINE_ELEMENTS" !!!
|
||||
#define IKE_P2_DH_GROUP_768_MODP 1
|
||||
#define IKE_P2_DH_GROUP_1024_MODP 2
|
||||
#define IKE_P2_DH_GROUP_1536_MODP 5
|
||||
#define IKE_P2_DH_GROUP_2048_MODP 14
|
||||
#define IKE_P2_DH_GROUP_3072_MODP 15
|
||||
#define IKE_P2_DH_GROUP_4096_MODP 16
|
||||
|
||||
// Phase 2: The encapsulation mode in IPsec transform value
|
||||
#define IKE_P2_CAPSULE_TUNNEL 1
|
||||
@@ -530,6 +548,15 @@ struct IKE_P1_KEYSET
|
||||
#define IKE_HASH_SHA1_ID 1
|
||||
#define IKE_HASH_SHA1_STRING "SHA-1"
|
||||
|
||||
#define IKE_HASH_SHA2_256_ID 2
|
||||
#define IKE_HASH_SHA2_256_STRING "SHA-2-256"
|
||||
|
||||
#define IKE_HASH_SHA2_384_ID 3
|
||||
#define IKE_HASH_SHA2_384_STRING "SHA-2-384"
|
||||
|
||||
#define IKE_HASH_SHA2_512_ID 4
|
||||
#define IKE_HASH_SHA2_512_STRING "SHA-2-512"
|
||||
|
||||
// Number and name of DH algorithm for IKE
|
||||
#define IKE_DH_1_ID 0
|
||||
#define IKE_DH_1_STRING "MODP 768 (Group 1)"
|
||||
@@ -540,6 +567,15 @@ struct IKE_P1_KEYSET
|
||||
#define IKE_DH_5_ID 2
|
||||
#define IKE_DH_5_STRING "MODP 1536 (Group 5)"
|
||||
|
||||
#define IKE_DH_2048_ID 14
|
||||
#define IKE_DH_2048_STRING "MODP 2048 (Group 14)"
|
||||
|
||||
#define IKE_DH_3072_ID 15
|
||||
#define IKE_DH_3072_STRING "MODP 3072 (Group 15)"
|
||||
|
||||
#define IKE_DH_4096_ID 16
|
||||
#define IKE_DH_4096_STRING "MODP 4096 (Group 16)"
|
||||
|
||||
|
||||
// Encryption algorithm for IKE
|
||||
struct IKE_CRYPTO
|
||||
@@ -578,7 +614,7 @@ struct IKE_DH
|
||||
UINT KeySize; // Key size
|
||||
};
|
||||
|
||||
#define MAX_IKE_ENGINE_ELEMENTS 16
|
||||
#define MAX_IKE_ENGINE_ELEMENTS 64
|
||||
|
||||
// Encryption engine for IKE
|
||||
struct IKE_ENGINE
|
||||
@@ -735,7 +771,3 @@ void IkeDhFreeCtx(DH_CTX *dh);
|
||||
#endif // IPSEC_PACKET_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+197
-47
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -180,7 +180,7 @@ void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L
|
||||
|
||||
p->Nr = t->LastNr + 1;
|
||||
|
||||
buf = BuildL2TPPacketData(p);
|
||||
buf = BuildL2TPPacketData(p, t);
|
||||
|
||||
q = ZeroMalloc(sizeof(L2TP_QUEUE));
|
||||
q->Buf = buf;
|
||||
@@ -239,15 +239,33 @@ void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void
|
||||
else
|
||||
{
|
||||
// L2TPv3
|
||||
buf_size = 4 + size;
|
||||
buf = Malloc(buf_size);
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
buf_size = 4 + size;
|
||||
buf = Malloc(buf_size);
|
||||
|
||||
WRITE_UINT(buf, s->SessionId1);
|
||||
WRITE_UINT(buf, s->SessionId1);
|
||||
|
||||
Copy(buf + 4, data, size);
|
||||
Copy(buf + 4, data, size);
|
||||
|
||||
// Transmission
|
||||
p = NewUdpPacket(&t->ServerIp, IPSEC_PORT_L2TPV3_VIRTUAL, &t->ClientIp, IPSEC_PORT_L2TPV3_VIRTUAL, buf, buf_size);
|
||||
// Transmission
|
||||
p = NewUdpPacket(&t->ServerIp, IPSEC_PORT_L2TPV3_VIRTUAL, &t->ClientIp, IPSEC_PORT_L2TPV3_VIRTUAL, buf, buf_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT header = 0x00030000;
|
||||
|
||||
buf_size = 8 + size;
|
||||
buf = Malloc(buf_size);
|
||||
|
||||
WRITE_UINT(buf, header);
|
||||
WRITE_UINT(buf + 4, s->SessionId1);
|
||||
|
||||
Copy(buf + 8, data, size);
|
||||
|
||||
// Transmission
|
||||
p = NewUdpPacket(&t->ServerIp, t->ServerPort, &t->ClientIp, t->ClientPort, buf, buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
L2TPSendUDP(l2tp, p);
|
||||
@@ -285,14 +303,14 @@ void L2TPSendUDP(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
}
|
||||
|
||||
// Build a L2TP packet
|
||||
BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t)
|
||||
{
|
||||
BUF *ret;
|
||||
UCHAR c;
|
||||
USHORT us;
|
||||
UINT ui;
|
||||
// Validate arguments
|
||||
if (pp == NULL)
|
||||
if (pp == NULL || t == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -322,9 +340,12 @@ BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
|
||||
if (pp->Ver == 3)
|
||||
{
|
||||
// Zero as Session ID
|
||||
ui = 0;
|
||||
WriteBuf(ret, &ui, sizeof(UINT));
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
// Zero as Session ID
|
||||
ui = 0;
|
||||
WriteBuf(ret, &ui, sizeof(UINT));
|
||||
}
|
||||
}
|
||||
|
||||
// Flags
|
||||
@@ -339,6 +360,11 @@ BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
c |= L2TP_HEADER_BIT_OFFSET;
|
||||
}
|
||||
|
||||
if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3)
|
||||
{
|
||||
c = 0;
|
||||
}
|
||||
|
||||
WriteBuf(ret, &c, 1);
|
||||
|
||||
// Ver
|
||||
@@ -356,6 +382,13 @@ BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
WriteBuf(ret, &us, sizeof(USHORT));
|
||||
}
|
||||
|
||||
// Reserved
|
||||
if (pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3)
|
||||
{
|
||||
us = 0;
|
||||
WriteBuf(ret, &us, sizeof(USHORT));
|
||||
}
|
||||
|
||||
// Tunnel ID
|
||||
if (pp->Ver != 3)
|
||||
{
|
||||
@@ -387,9 +420,12 @@ BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Offset Size = 0
|
||||
us = 0;
|
||||
WriteBuf(ret, &us, sizeof(USHORT));
|
||||
if (!(pp->IsControl == false && pp->Ver == 3 && t->IsYamahaV3))
|
||||
{
|
||||
// Offset Size = 0
|
||||
us = 0;
|
||||
WriteBuf(ret, &us, sizeof(USHORT));
|
||||
}
|
||||
}
|
||||
|
||||
if (pp->IsControl)
|
||||
@@ -431,7 +467,8 @@ BUF *BuildL2TPPacketData(L2TP_PACKET *pp)
|
||||
if (pp->IsControl)
|
||||
{
|
||||
// Update Length
|
||||
WRITE_USHORT(((UCHAR *)ret->Buf) + 2 + (pp->Ver == 3 ? sizeof(UINT) : 0), (USHORT)(ret->Size - (pp->Ver == 3 ? sizeof(UINT) : 0)));
|
||||
bool l2tpv3_non_yamaha = ((pp->Ver == 3) && (t->IsYamahaV3 == false));
|
||||
WRITE_USHORT(((UCHAR *)ret->Buf) + 2 + (l2tpv3_non_yamaha ? sizeof(UINT) : 0), (USHORT)(ret->Size - (l2tpv3_non_yamaha ? sizeof(UINT) : 0)));
|
||||
}
|
||||
|
||||
SeekBuf(ret, 0, 0);
|
||||
@@ -446,6 +483,7 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
UCHAR *buf;
|
||||
UINT size;
|
||||
bool is_l2tpv3 = false;
|
||||
bool is_l2tpv3_yamaha = false;
|
||||
// Validate arguments
|
||||
if (p == NULL)
|
||||
{
|
||||
@@ -456,17 +494,27 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
|
||||
if (p->SrcPort == IPSEC_PORT_L2TPV3_VIRTUAL)
|
||||
{
|
||||
// It is L2TPv3
|
||||
// L2TPv3 (Cisco)
|
||||
is_l2tpv3 = true;
|
||||
}
|
||||
|
||||
buf = p->Data;
|
||||
size = p->Size;
|
||||
|
||||
if (is_l2tpv3)
|
||||
if (size >= 2 && ((buf[1] & L2TP_HEADER_BIT_VER) == 3))
|
||||
{
|
||||
if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL)
|
||||
{
|
||||
// L2TPv3 (YAMAHA)
|
||||
is_l2tpv3 = true;
|
||||
is_l2tpv3_yamaha = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_l2tpv3 && (is_l2tpv3_yamaha == false))
|
||||
{
|
||||
// L2TPv3 (Cisco)
|
||||
UINT session_id;
|
||||
// In the case of L2TPv3
|
||||
if (size < 4)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
@@ -590,6 +638,24 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
size = ret->Length - 4;
|
||||
}
|
||||
|
||||
if (is_l2tpv3)
|
||||
{
|
||||
if (p->SrcPort != IPSEC_PORT_L2TPV3_VIRTUAL)
|
||||
{
|
||||
if (ret->IsControl == false)
|
||||
{
|
||||
// Reserved
|
||||
if (size < 2)
|
||||
{
|
||||
goto LABEL_ERROR;
|
||||
}
|
||||
|
||||
buf += 2;
|
||||
size -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tunnel ID, Session ID
|
||||
if (size < 4)
|
||||
{
|
||||
@@ -616,6 +682,11 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
|
||||
// The session ID is not written in the header
|
||||
ret->SessionId = 0;
|
||||
|
||||
if (ret->IsControl == false)
|
||||
{
|
||||
ret->SessionId = ret->TunnelId;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret->HasSequence)
|
||||
@@ -742,7 +813,7 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
ret->MessageType = READ_USHORT(a->Data);
|
||||
}
|
||||
|
||||
if (ret->Ver == 3)
|
||||
if (ret->Ver == 3 && ret->IsControl)
|
||||
{
|
||||
// Get the Remote Session ID in the case of L2TPv3
|
||||
L2TP_AVP *a = GetAVPValue(ret, L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE);
|
||||
@@ -752,6 +823,8 @@ L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p)
|
||||
}
|
||||
}
|
||||
|
||||
ret->IsYamahaV3 = is_l2tpv3_yamaha;
|
||||
|
||||
return ret;
|
||||
|
||||
LABEL_ERROR:
|
||||
@@ -783,6 +856,22 @@ L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id)
|
||||
}
|
||||
}
|
||||
|
||||
if (vendor_id == 0)
|
||||
{
|
||||
if (type == L2TP_AVP_TYPE_V3_TUNNEL_ID)
|
||||
{
|
||||
return GetAVPValueEx(p, L2TPV3_CISCO_AVP_TUNNEL_ID, L2TP_AVP_VENDOR_ID_CISCO);
|
||||
}
|
||||
else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL)
|
||||
{
|
||||
return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_LOCAL, L2TP_AVP_VENDOR_ID_CISCO);
|
||||
}
|
||||
else if (type == L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE)
|
||||
{
|
||||
return GetAVPValueEx(p, L2TPV3_CISCO_AVP_SESSION_ID_REMOTE, L2TP_AVP_VENDOR_ID_CISCO);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -899,6 +988,9 @@ L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp)
|
||||
{
|
||||
t->IsCiscoV3 = true;
|
||||
}
|
||||
|
||||
// L2TPv3 on YAMAHA
|
||||
t->IsYamahaV3 = p->IsYamahaV3;
|
||||
}
|
||||
|
||||
// Transmission queue
|
||||
@@ -965,6 +1057,30 @@ L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3)
|
||||
{
|
||||
UINT i;
|
||||
// Validate arguments
|
||||
if (l2tp == NULL || client_ip == 0 || tunnel_id == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0;i < LIST_NUM(l2tp->TunnelList);i++)
|
||||
{
|
||||
L2TP_TUNNEL *t = LIST_DATA(l2tp->TunnelList, i);
|
||||
|
||||
if (t->TunnelId1 == tunnel_id && CmpIpAddr(&t->ClientIp, client_ip) == 0)
|
||||
{
|
||||
if (EQUAL_BOOL(t->IsV3, is_v3))
|
||||
{
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Create a new tunnel ID
|
||||
UINT GenerateNewTunnelId(L2TP_SERVER *l2tp, IP *client_ip)
|
||||
@@ -1179,14 +1295,23 @@ void L2TPProcessRecvControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_PACKET
|
||||
|
||||
if (s->IsV3)
|
||||
{
|
||||
// Pseudowire AVP
|
||||
us = Endian16(s->PseudowireType);
|
||||
Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_TYPE, true, 0, &us, sizeof(USHORT)));
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
// Pseudowire AVP
|
||||
us = Endian16(s->PseudowireType);
|
||||
Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_PW_TYPE, true, 0, &us, sizeof(USHORT)));
|
||||
}
|
||||
|
||||
if (s->IsCiscoV3)
|
||||
{
|
||||
Add(pp->AvpList, NewAVP(L2TPV3_CISCO_AVP_PW_TYPE, true, L2TP_AVP_VENDOR_ID_CISCO, &us, sizeof(USHORT)));
|
||||
}
|
||||
|
||||
if (t->IsYamahaV3)
|
||||
{
|
||||
us = Endian16(0x0003);
|
||||
Add(pp->AvpList, NewAVP(L2TP_AVP_TYPE_V3_CIRCUIT_STATUS, true, 0, &us, sizeof(USHORT)));
|
||||
}
|
||||
}
|
||||
|
||||
SendL2TPControlPacket(l2tp, t, session_id, pp);
|
||||
@@ -1563,18 +1688,21 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
// Respond with SCCEP to SCCRQ
|
||||
pp2 = NewL2TPControlPacket(L2TP_MESSAGE_TYPE_SCCRP, t->IsV3);
|
||||
|
||||
// Protocol Version
|
||||
protocol_version[0] = 1;
|
||||
protocol_version[1] = 0;
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_PROTOCOL_VERSION, true, 0, protocol_version, sizeof(protocol_version)));
|
||||
|
||||
// Framing Capabilities
|
||||
Zero(caps_data, sizeof(caps_data));
|
||||
if (t->IsV3 == false)
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
caps_data[3] = 3;
|
||||
// Protocol Version
|
||||
protocol_version[0] = 1;
|
||||
protocol_version[1] = 0;
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_PROTOCOL_VERSION, true, 0, protocol_version, sizeof(protocol_version)));
|
||||
|
||||
// Framing Capabilities
|
||||
Zero(caps_data, sizeof(caps_data));
|
||||
if (t->IsV3 == false)
|
||||
{
|
||||
caps_data[3] = 3;
|
||||
}
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_FRAME_CAP, false, 0, caps_data, sizeof(caps_data)));
|
||||
}
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_FRAME_CAP, false, 0, caps_data, sizeof(caps_data)));
|
||||
|
||||
if (t->IsV3 == false)
|
||||
{
|
||||
@@ -1593,7 +1721,21 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_HOST_NAME, true, 0, hostname, StrLen(hostname)));
|
||||
|
||||
// Vendor Name
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, L2TP_VENDOR_NAME, StrLen(L2TP_VENDOR_NAME)));
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, L2TP_VENDOR_NAME, StrLen(L2TP_VENDOR_NAME)));
|
||||
}
|
||||
else
|
||||
{
|
||||
char *yamaha_str = "YAMAHA Corporation";
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_VENDOR_NAME, false, 0, yamaha_str, StrLen(yamaha_str)));
|
||||
}
|
||||
|
||||
if (t->IsYamahaV3)
|
||||
{
|
||||
UINT zero = 0;
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_V3_ROUTER_ID, true, 0, &zero, sizeof(UINT)));
|
||||
}
|
||||
|
||||
// Assigned Tunnel ID
|
||||
if (t->IsV3 == false)
|
||||
@@ -1635,8 +1777,11 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
}
|
||||
|
||||
// Recv Window Size
|
||||
us = Endian16(L2TP_WINDOW_SIZE);
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_RECV_WINDOW_SIZE, false, 0, &us, sizeof(USHORT)));
|
||||
if (t->IsYamahaV3 == false)
|
||||
{
|
||||
us = Endian16(L2TP_WINDOW_SIZE);
|
||||
Add(pp2->AvpList, NewAVP(L2TP_AVP_TYPE_RECV_WINDOW_SIZE, false, 0, &us, sizeof(USHORT)));
|
||||
}
|
||||
|
||||
SendL2TPControlPacket(l2tp, t, 0, pp2);
|
||||
|
||||
@@ -1654,7 +1799,7 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
L2TP_TUNNEL *t = NULL;
|
||||
L2TP_SESSION *l2tpv3_session = NULL;
|
||||
|
||||
if (pp->Ver != 3 || pp->IsControl)
|
||||
if (pp->IsControl || pp->Ver != 3)
|
||||
{
|
||||
t = GetTunnelFromId(l2tp, &p->SrcIP, pp->TunnelId, pp->Ver == 3);
|
||||
}
|
||||
@@ -1767,6 +1912,15 @@ void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reply ACK for already-received packets
|
||||
if (pp->IsZLB == false)
|
||||
{
|
||||
// The packet other than ZLB is treated
|
||||
t->StateChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2373,7 +2527,7 @@ void L2TPProcessInterrupts(L2TP_SERVER *l2tp)
|
||||
|
||||
pp->TunnelId = t->TunnelId1;
|
||||
pp->Ns = t->NextNs;
|
||||
q->Buf = BuildL2TPPacketData(pp);
|
||||
q->Buf = BuildL2TPPacketData(pp, t);
|
||||
|
||||
SendL2TPControlPacketMain(l2tp, t, q);
|
||||
|
||||
@@ -2555,7 +2709,3 @@ void SetL2TPServerSockEvent(L2TP_SERVER *l2tp, SOCK_EVENT *e)
|
||||
l2tp->SockEvent = e;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+10
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -189,6 +189,7 @@
|
||||
#define L2TP_AVP_TYPE_V3_SESSION_ID_LOCAL 63 // Local Session ID
|
||||
#define L2TP_AVP_TYPE_V3_SESSION_ID_REMOTE 64 // Remote Session ID
|
||||
#define L2TP_AVP_TYPE_V3_PW_TYPE 68 // Pseudowire Type
|
||||
#define L2TP_AVP_TYPE_V3_CIRCUIT_STATUS 71
|
||||
|
||||
// Message Type value
|
||||
#define L2TP_MESSAGE_TYPE_SCCRQ 1 // Start-Control-Connection-Request
|
||||
@@ -247,6 +248,7 @@ struct L2TP_PACKET
|
||||
bool HasOffset; // Whether there is offset bit
|
||||
bool IsPriority; // Whether priority packet
|
||||
bool IsZLB; // Zero Length Bit
|
||||
bool IsYamahaV3; // L2TPv3 on YAMAHA
|
||||
UINT Ver; // Version
|
||||
UINT Length; // Length
|
||||
UINT TunnelId; // Tunnel ID
|
||||
@@ -284,6 +286,7 @@ struct L2TP_TUNNEL
|
||||
{
|
||||
bool IsV3; // L2TPv3
|
||||
bool IsCiscoV3; // L2TPv3 for Cisco
|
||||
bool IsYamahaV3; // L2TPv3 for YAMAHA
|
||||
IP ClientIp; // Client IP address
|
||||
UINT ClientPort; // Client port number
|
||||
IP ServerIp; // Server IP address
|
||||
@@ -339,7 +342,7 @@ void FreeL2TPServer(L2TP_SERVER *l2tp);
|
||||
void StopL2TPServer(L2TP_SERVER *l2tp, bool no_wait);
|
||||
void ProcL2TPPacketRecv(L2TP_SERVER *l2tp, UDPPACKET *p);
|
||||
L2TP_PACKET *ParseL2TPPacket(UDPPACKET *p);
|
||||
BUF *BuildL2TPPacketData(L2TP_PACKET *pp);
|
||||
BUF *BuildL2TPPacketData(L2TP_PACKET *pp, L2TP_TUNNEL *t);
|
||||
L2TP_AVP *GetAVPValue(L2TP_PACKET *p, UINT type);
|
||||
L2TP_AVP *GetAVPValueEx(L2TP_PACKET *p, UINT type, UINT vendor_id);
|
||||
L2TP_TUNNEL *NewL2TPTunnel(L2TP_SERVER *l2tp, L2TP_PACKET *p, UDPPACKET *udp);
|
||||
@@ -348,6 +351,7 @@ UINT GenerateNewTunnelIdEx(L2TP_SERVER *l2tp, IP *client_ip, bool is_32bit);
|
||||
void FreeL2TPTunnel(L2TP_TUNNEL *t);
|
||||
L2TP_TUNNEL *GetTunnelFromId(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3);
|
||||
L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClient(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id);
|
||||
L2TP_TUNNEL *GetTunnelFromIdOfAssignedByClientEx(L2TP_SERVER *l2tp, IP *client_ip, UINT tunnel_id, bool is_v3);
|
||||
void SendL2TPControlPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, UINT session_id, L2TP_PACKET *p);
|
||||
void SendL2TPControlPacketMain(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_QUEUE *q);
|
||||
void SendL2TPDataPacket(L2TP_SERVER *l2tp, L2TP_TUNNEL *t, L2TP_SESSION *s, void *data, UINT size);
|
||||
@@ -377,7 +381,3 @@ void L2TPSessionManageEtherIPServer(L2TP_SERVER *l2tp, L2TP_SESSION *s);
|
||||
#endif // IPSEC_L2TP_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+144
-19
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -135,6 +135,8 @@ void PPPThread(THREAD *thread, void *param)
|
||||
p->Mru1 = p->Mru2 = PPP_MRU_DEFAULT;
|
||||
p->RecvPacketList = NewList(NULL);
|
||||
|
||||
p->MsChapV2_UseDoubleMsChapV2 = CedarIsThereAnyEapEnabledRadiusConfig(p->Cedar);
|
||||
|
||||
//// Link establishment phase
|
||||
IPToStr(ipstr1, sizeof(ipstr1), &p->ClientIP);
|
||||
IPToStr(ipstr2, sizeof(ipstr2), &p->ServerIP);
|
||||
@@ -244,9 +246,96 @@ void PPPThread(THREAD *thread, void *param)
|
||||
|
||||
PPPContinueUntilFinishAllLCPOptionRequestsDetermined(p);
|
||||
|
||||
if (p->MsChapV2_UseDoubleMsChapV2)
|
||||
{
|
||||
// Use the double-MSCHAPv2 technieue
|
||||
GetMachineHostName(machine_name, sizeof(machine_name));
|
||||
MsChapV2Server_GenerateChallenge(p->MsChapV2_ServerChallenge);
|
||||
|
||||
pp = ZeroMalloc(sizeof(PPP_PACKET));
|
||||
pp->Protocol = PPP_PROTOCOL_CHAP;
|
||||
pp->IsControl = true;
|
||||
pp->Lcp = NewPPPLCP(PPP_CHAP_CODE_CHALLENGE, 99);
|
||||
|
||||
b = NewBuf();
|
||||
WriteBufChar(b, 16);
|
||||
WriteBuf(b, p->MsChapV2_ServerChallenge, sizeof(p->MsChapV2_ServerChallenge));
|
||||
WriteBuf(b, machine_name, StrLen(machine_name));
|
||||
pp->Lcp->Data = Clone(b->Buf, b->Size);
|
||||
pp->Lcp->DataSize = b->Size;
|
||||
FreeBuf(b);
|
||||
|
||||
PPPSendPacket(p, pp);
|
||||
|
||||
pp_ret = PPPRecvResponsePacket(p, pp, 0, &pp_ret_protocol, false, true);
|
||||
|
||||
if (pp_ret != NULL)
|
||||
{
|
||||
// Extract the username from the first MS-CHAP v2 packet
|
||||
if (pp_ret->Lcp != NULL && pp_ret->Lcp->DataSize >= 51)
|
||||
{
|
||||
BUF *b;
|
||||
|
||||
b = MemToBuf(pp_ret->Lcp->Data, pp_ret->Lcp->DataSize);
|
||||
|
||||
if (ReadBufChar(b) == 49)
|
||||
{
|
||||
UCHAR client_response_buffer[49];
|
||||
char username_tmp[MAX_SIZE];
|
||||
char id[MAX_SIZE];
|
||||
char hub[MAX_SIZE];
|
||||
char client_ip_tmp[256];
|
||||
EAP_CLIENT *eap;
|
||||
ETHERIP_ID d;
|
||||
|
||||
ReadBuf(b, client_response_buffer, 49);
|
||||
|
||||
Zero(username_tmp, sizeof(username_tmp));
|
||||
ReadBuf(b, username_tmp, sizeof(username_tmp));
|
||||
|
||||
Debug("First MS-CHAPv2: id=%s\n", username_tmp);
|
||||
|
||||
Zero(id, sizeof(id));
|
||||
Zero(hub, sizeof(hub));
|
||||
|
||||
// The user name is divided into the ID and the virtual HUB name
|
||||
Zero(&d, sizeof(d));
|
||||
PPPParseUsername(p->Cedar, username_tmp, &d);
|
||||
|
||||
StrCpy(id, sizeof(id), d.UserName);
|
||||
StrCpy(hub, sizeof(hub), d.HubName);
|
||||
Debug("First MS-CHAPv2: username=%s, hubname=%s\n", id, hub);
|
||||
|
||||
IPToStr(client_ip_tmp, sizeof(client_ip_tmp), &p->ClientIP);
|
||||
|
||||
eap = HubNewEapClient(p->Cedar, hub, client_ip_tmp, id);
|
||||
|
||||
if (eap)
|
||||
{
|
||||
p->EapClient = eap;
|
||||
}
|
||||
}
|
||||
|
||||
FreeBuf(b);
|
||||
}
|
||||
|
||||
FreePPPPacket(pp_ret);
|
||||
}
|
||||
|
||||
FreePPPPacket(pp);
|
||||
}
|
||||
|
||||
// Generate a Server Challenge packet of MS-CHAP v2
|
||||
GetMachineHostName(machine_name, sizeof(machine_name));
|
||||
MsChapV2Server_GenerateChallenge(p->MsChapV2_ServerChallenge);
|
||||
|
||||
if (p->EapClient == NULL)
|
||||
{
|
||||
MsChapV2Server_GenerateChallenge(p->MsChapV2_ServerChallenge);
|
||||
}
|
||||
else
|
||||
{
|
||||
Copy(p->MsChapV2_ServerChallenge, p->EapClient->MsChapV2Challenge.Chap_ChallengeValue, 16);
|
||||
}
|
||||
|
||||
pp = ZeroMalloc(sizeof(PPP_PACKET));
|
||||
pp->Protocol = PPP_PROTOCOL_CHAP;
|
||||
@@ -264,7 +353,7 @@ void PPPThread(THREAD *thread, void *param)
|
||||
PPPSendPacket(p, pp);
|
||||
|
||||
pp_ret_protocol = 0;
|
||||
pp_ret = PPPRecvResponsePacket(p, pp, 0, &pp_ret_protocol, false);
|
||||
pp_ret = PPPRecvResponsePacket(p, pp, 0, &pp_ret_protocol, false, false);
|
||||
|
||||
if (pp_ret != NULL)
|
||||
{
|
||||
@@ -565,7 +654,7 @@ bool PPPContinueUntilFinishAllLCPOptionRequestsDetermined(PPP_SESSION *p)
|
||||
return false;
|
||||
}
|
||||
|
||||
PPPRecvResponsePacket(p, NULL, PPP_PROTOCOL_LCP, &received_protocol, true);
|
||||
PPPRecvResponsePacket(p, NULL, PPP_PROTOCOL_LCP, &received_protocol, true, false);
|
||||
|
||||
return p->ClientLCPOptionDetermined;
|
||||
}
|
||||
@@ -580,7 +669,7 @@ USHORT PPPContinueCurrentProtocolRequestListening(PPP_SESSION *p, USHORT protoco
|
||||
return 0;
|
||||
}
|
||||
|
||||
PPPRecvResponsePacket(p, NULL, protocol, &received_protocol, false);
|
||||
PPPRecvResponsePacket(p, NULL, protocol, &received_protocol, false, false);
|
||||
|
||||
return received_protocol;
|
||||
}
|
||||
@@ -634,7 +723,7 @@ bool PPPSendRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c)
|
||||
}
|
||||
|
||||
// Receive a corresponding PPP packet
|
||||
pp2 = PPPRecvResponsePacket(p, pp, 0, NULL, false);
|
||||
pp2 = PPPRecvResponsePacket(p, pp, 0, NULL, false, false);
|
||||
|
||||
if (pp2 != NULL)
|
||||
{
|
||||
@@ -880,8 +969,10 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
|
||||
char server_challenge_hex[MAX_SIZE];
|
||||
char client_challenge_hex[MAX_SIZE];
|
||||
char client_response_hex[MAX_SIZE];
|
||||
char eap_client_hex[64];
|
||||
ETHERIP_ID d;
|
||||
UINT error_code;
|
||||
UINT64 eap_client_ptr = (UINT64)p->EapClient;
|
||||
|
||||
ReadBuf(b, client_response_buffer, 49);
|
||||
|
||||
@@ -913,18 +1004,21 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
|
||||
p->MsChapV2_ClientChallenge, sizeof(p->MsChapV2_ClientChallenge));
|
||||
BinToStr(client_response_hex, sizeof(client_response_hex),
|
||||
p->MsChapV2_ClientResponse, sizeof(p->MsChapV2_ClientResponse));
|
||||
BinToStr(eap_client_hex, sizeof(eap_client_hex),
|
||||
&eap_client_ptr, 8);
|
||||
|
||||
Format(password, sizeof(password), "%s%s:%s:%s:%s",
|
||||
Format(password, sizeof(password), "%s%s:%s:%s:%s:%s",
|
||||
IPC_PASSWORD_MSCHAPV2_TAG,
|
||||
username_tmp,
|
||||
server_challenge_hex,
|
||||
client_challenge_hex,
|
||||
client_response_hex);
|
||||
client_response_hex,
|
||||
eap_client_hex);
|
||||
|
||||
// Attempt to connect with IPC
|
||||
ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password,
|
||||
&error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort,
|
||||
p->ClientHostname, p->CryptName, false, p->AdjustMss);
|
||||
p->ClientHostname, p->CryptName, false, p->AdjustMss, p->EapClient);
|
||||
|
||||
if (ipc != NULL)
|
||||
{
|
||||
@@ -1057,7 +1151,7 @@ PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req)
|
||||
|
||||
ipc = NewIPC(p->Cedar, p->ClientSoftwareName, p->Postfix, hub, id, password,
|
||||
&error_code, &p->ClientIP, p->ClientPort, &p->ServerIP, p->ServerPort,
|
||||
p->ClientHostname, p->CryptName, false, p->AdjustMss);
|
||||
p->ClientHostname, p->CryptName, false, p->AdjustMss, NULL);
|
||||
|
||||
if (ipc != NULL)
|
||||
{
|
||||
@@ -1555,7 +1649,8 @@ bool PPPGetIPAddressValueFromLCP(PPP_LCP *c, UINT type, IP *ip)
|
||||
// (If req == NULL, process on that protocol while the protocol specified in expected_protocol have received.
|
||||
//If other protocols has arrived, without further processing, and then store that packet in the session context once,
|
||||
// return NULL by setting the received_protocol.)
|
||||
PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expected_protocol, USHORT *received_protocol, bool finish_when_all_lcp_acked)
|
||||
PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expected_protocol, USHORT *received_protocol, bool finish_when_all_lcp_acked,
|
||||
bool return_mschapv2_response_with_no_processing)
|
||||
{
|
||||
UINT64 giveup_tick = Tick64() + (UINT64)PPP_PACKET_RECV_TIMEOUT;
|
||||
UINT64 next_resend = Tick64() + (UINT64)PPP_PACKET_RESEND_INTERVAL;
|
||||
@@ -1618,6 +1713,16 @@ PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expect
|
||||
{
|
||||
return pp;
|
||||
}
|
||||
|
||||
if (return_mschapv2_response_with_no_processing)
|
||||
{
|
||||
// For the double-MSCHAPv2 technique
|
||||
if (pp->IsControl && pp->Protocol == req->Protocol && pp->Lcp->Id == req->Lcp->Id &&
|
||||
pp->Protocol == PPP_PROTOCOL_CHAP && PPP_PAP_CODE_IS_RESPONSE(pp->Lcp->Code))
|
||||
{
|
||||
return pp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return a response immediately without processing if a protocol other than the expected received
|
||||
@@ -1644,8 +1749,15 @@ PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expect
|
||||
|
||||
if (pp->IsControl && PPP_CODE_IS_REQUEST(pp->Protocol, pp->Lcp->Code))
|
||||
{
|
||||
// Record current resend because next steps may take a while
|
||||
UINT64 currentresend = next_resend - now;
|
||||
|
||||
// Process when the received packet is a request packet
|
||||
response = PPPProcessRequestPacket(p, pp);
|
||||
|
||||
// Increase next resend because this may have taken a while
|
||||
next_resend = Tick64() + currentresend;
|
||||
|
||||
FreePPPPacket(pp);
|
||||
|
||||
if (response == NULL)
|
||||
@@ -2357,9 +2469,26 @@ void FreePPPSession(PPP_SESSION *p)
|
||||
FreeIPC(p->Ipc);
|
||||
}
|
||||
|
||||
PPPFreeEapClient(p);
|
||||
|
||||
Free(p);
|
||||
}
|
||||
|
||||
// Free the associated EAP client
|
||||
void PPPFreeEapClient(PPP_SESSION *p)
|
||||
{
|
||||
if (p == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->EapClient != NULL)
|
||||
{
|
||||
ReleaseEapClient(p->EapClient);
|
||||
p->EapClient = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the option value
|
||||
PPP_OPTION *GetOptionValue(PPP_LCP *c, UCHAR type)
|
||||
{
|
||||
@@ -2713,7 +2842,3 @@ char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list)
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+11
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -284,6 +284,9 @@ struct PPP_SESSION
|
||||
UCHAR MsChapV2_ClientResponse[24]; // MS-CHAPv2 Client Response
|
||||
UCHAR MsChapV2_ServerResponse[20]; // MS-CHAPv2 Server Response
|
||||
UINT MsChapV2_ErrorCode; // Authentication failure error code of MS-CHAPv2
|
||||
|
||||
bool MsChapV2_UseDoubleMsChapV2; // Use the double-MSCHAPv2 technieue
|
||||
EAP_CLIENT *EapClient; // EAP client
|
||||
};
|
||||
|
||||
// Function prototype
|
||||
@@ -316,7 +319,8 @@ bool PPPSetIPAddressValueToLCP(PPP_LCP *c, UINT type, IP *ip, bool only_modify);
|
||||
bool PPPSendRequest(PPP_SESSION *p, USHORT protocol, PPP_LCP *c);
|
||||
USHORT PPPContinueCurrentProtocolRequestListening(PPP_SESSION *p, USHORT protocol);
|
||||
bool PPPContinueUntilFinishAllLCPOptionRequestsDetermined(PPP_SESSION *p);
|
||||
PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expected_protocol, USHORT *received_protocol, bool finish_when_all_lcp_acked);
|
||||
PPP_PACKET *PPPRecvResponsePacket(PPP_SESSION *p, PPP_PACKET *req, USHORT expected_protocol, USHORT *received_protocol, bool finish_when_all_lcp_acked,
|
||||
bool return_mschapv2_response_with_no_processing);
|
||||
PPP_PACKET *PPPProcessRequestPacket(PPP_SESSION *p, PPP_PACKET *req);
|
||||
void PPPSendEchoRequest(PPP_SESSION *p);
|
||||
bool PPPParseUsername(CEDAR *cedar, char *src, ETHERIP_ID *dst);
|
||||
@@ -331,11 +335,8 @@ void MsChapV2Client_GenerateResponse(UCHAR *dst, UCHAR *challenge8, UCHAR *nt_pa
|
||||
void MsChapV2Server_GenerateResponse(UCHAR *dst, UCHAR *nt_password_hash_hash, UCHAR *client_response, UCHAR *challenge8);
|
||||
bool MsChapV2VerityPassword(IPC_MSCHAP_V2_AUTHINFO *d, char *password);
|
||||
char *MsChapV2DoBruteForce(IPC_MSCHAP_V2_AUTHINFO *d, LIST *password_list);
|
||||
void PPPFreeEapClient(PPP_SESSION *p);
|
||||
|
||||
#endif // IPSEC_PPP_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+33
-18
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
|
||||
// IPsec_Win7.c
|
||||
// Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012
|
||||
// Initialize the helper module for Windows 7 / Windows 8 / Windows Vista / Windows Server 2008 / Windows Server 2008 R2 / Windows Server 2012 / Windows 10
|
||||
|
||||
#include <GlobalConst.h>
|
||||
|
||||
@@ -367,19 +367,35 @@ bool IPsecWin7InitDriverInner()
|
||||
|
||||
if (install_driver)
|
||||
{
|
||||
char *src_filename = IPSEC_WIN7_SRC_SYS_X86;
|
||||
if (MsIsX64())
|
||||
char src_filename[MAX_PATH];
|
||||
|
||||
if (MsIsWindows10() == false)
|
||||
{
|
||||
src_filename = IPSEC_WIN7_SRC_SYS_X64;
|
||||
Format(src_filename, sizeof(src_filename),
|
||||
"|DriverPackages\\Wfp\\%s\\pxwfp_%s.sys",
|
||||
(MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(src_filename, sizeof(src_filename),
|
||||
"|DriverPackages\\Wfp_Win10\\%s\\pxwfp_%s.sys",
|
||||
(MsIsX64() ? "x64" : "x86"), (MsIsX64() ? "x64" : "x86"));
|
||||
}
|
||||
|
||||
// Copy the driver
|
||||
if (FileCopy(src_filename, sys_filename) == false)
|
||||
{
|
||||
Debug("%s copy failed.\n", sys_filename);
|
||||
return false;
|
||||
Debug("%s copy failed. %u\n", sys_filename, GetLastError());
|
||||
if (IsFileExists(sys_filename) == false)
|
||||
{
|
||||
Debug("%s failed. Abort.\n", sys_filename);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("%s copied.\n", sys_filename);
|
||||
}
|
||||
Debug("%s copied.\n", sys_filename);
|
||||
|
||||
// Set the build number
|
||||
SetCurrentIPsecWin7DriverBuild();
|
||||
@@ -467,13 +483,16 @@ bool IPsecWin7InitDriverInner()
|
||||
// Write the build number of the current driver
|
||||
void SetCurrentIPsecWin7DriverBuild()
|
||||
{
|
||||
MsRegWriteInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, IPSEC_WIN7_DRIVER_BUILDNUMBER, CEDAR_BUILD);
|
||||
MsRegWriteInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY,
|
||||
(MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER),
|
||||
CEDAR_BUILD);
|
||||
}
|
||||
|
||||
// Get the build number of the current driver
|
||||
UINT GetCurrentIPsecWin7DriverBuild()
|
||||
{
|
||||
return MsRegReadInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY, IPSEC_WIN7_DRIVER_BUILDNUMBER);
|
||||
return MsRegReadInt(REG_LOCAL_MACHINE, IPSEC_WIN7_DRIVER_REGKEY,
|
||||
(MsIsWindows10() ? IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 : IPSEC_WIN7_DRIVER_BUILDNUMBER));
|
||||
}
|
||||
|
||||
// Initialization of the API
|
||||
@@ -554,7 +573,3 @@ bool IPsecWin7InitApi()
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -127,6 +127,7 @@
|
||||
#define IPSEC_WIN7_FILTER_TITLE_V6 CEDAR_PRODUCT_STR_W L" VPN IPsec Filter for IPv6"
|
||||
#define IPSEC_WIN7_DRIVER_REGKEY "SYSTEM\\CurrentControlSet\\services\\pxwfp"
|
||||
#define IPSEC_WIN7_DRIVER_BUILDNUMBER "CurrentInstalledBuild"
|
||||
#define IPSEC_WIN7_DRIVER_BUILDNUMBER_WIN10 "CurrentInstalledBuild_Win10"
|
||||
|
||||
|
||||
// Function prototype
|
||||
@@ -145,7 +146,3 @@ bool IPsecWin7InitApi();
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -184,7 +184,3 @@ struct IPSEC_WIN7
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -3016,7 +3016,3 @@ bool OvsPerformTcpServer(CEDAR *cedar, SOCK *sock)
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -152,10 +152,10 @@
|
||||
#define OPENVPN_IPC_POSTFIX_L3 "OPENVPN_L3"
|
||||
|
||||
// List of supported encryption algorithms
|
||||
#define OPENVPN_CIPHER_LIST "[NULL-CIPHER] NULL AES-128-CBC AES-192-CBC AES-256-CBC BF-CBC CAST-CBC CAST5-CBC DES-CBC DES-EDE-CBC DES-EDE3-CBC DESX-CBC RC2-40-CBC RC2-64-CBC RC2-CBC"
|
||||
#define OPENVPN_CIPHER_LIST "[NULL-CIPHER] NULL AES-128-CBC AES-192-CBC AES-256-CBC BF-CBC CAST-CBC CAST5-CBC DES-CBC DES-EDE-CBC DES-EDE3-CBC DESX-CBC RC2-40-CBC RC2-64-CBC RC2-CBC CAMELLIA-128-CBC CAMELLIA-192-CBC CAMELLIA-256-CBC"
|
||||
|
||||
// List of the supported hash algorithm
|
||||
#define OPENVPN_MD_LIST "SHA SHA1 MD5 MD4 RMD160"
|
||||
#define OPENVPN_MD_LIST "SHA SHA1 SHA256 SHA384 SHA512 MD5 MD4 RMD160"
|
||||
|
||||
// MTU
|
||||
#define OPENVPN_MTU_LINK 1514 // Ethernet MTU
|
||||
@@ -389,7 +389,3 @@ void OvsSetNoOpenVpnUdp(bool b);
|
||||
#endif // INTEROP_OPENVPN_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1248,7 +1248,3 @@ bool AcceptSstp(CONNECTION *c)
|
||||
return ret2;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -262,7 +262,3 @@ void SetNoSstp(bool b);
|
||||
#endif // INTEROP_SSTP_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+11
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -540,6 +540,12 @@ void L3KnownArp(L3IF *f, UINT ip, UCHAR *mac)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!((f->IpAddress & f->SubnetMask) == (ip & f->SubnetMask)))
|
||||
{
|
||||
// Outside the subnet
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete an ARP query entry to this IP address
|
||||
Zero(&t, sizeof(t));
|
||||
t.IpAddress = ip;
|
||||
@@ -2197,7 +2203,3 @@ int CmpL3ArpEntry(void *p1, void *p2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -253,7 +253,3 @@ void L3PollingIpQueue(L3IF *f);
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -782,7 +782,3 @@ LINK *NewLink(CEDAR *cedar, HUB *hub, CLIENT_OPTION *option, CLIENT_AUTH *auth,
|
||||
return k;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -169,7 +169,3 @@ void NormalizeLinkPolicy(POLICY *p);
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1103,7 +1103,3 @@ void ApplyDynamicListener(DYNAMIC_LISTENER *d)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -212,7 +212,3 @@ void ListenerSetProcRecvRpcEnable(bool b);
|
||||
#endif // LISTENER_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+27
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -1396,22 +1396,38 @@ char *BuildHttpLogStr(HTTPLOG *h)
|
||||
|
||||
b = NewBuf();
|
||||
|
||||
if (StartWith(h->Path, "http://"))
|
||||
if (StartWith(h->Path, "http://") || StartWith(h->Path, "https://"))
|
||||
{
|
||||
StrCpy(url, sizeof(url), h->Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
// URL generation
|
||||
if (h->Port == 80)
|
||||
if (h->IsSsl == false)
|
||||
{
|
||||
Format(url, sizeof(url), "http://%s%s",
|
||||
h->Hostname, h->Path);
|
||||
if (h->Port == 80)
|
||||
{
|
||||
Format(url, sizeof(url), "http://%s%s",
|
||||
h->Hostname, h->Path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(url, sizeof(url), "http://%s:%u%s",
|
||||
h->Hostname, h->Port, h->Path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(url, sizeof(url), "http://%s:%u%s",
|
||||
h->Hostname, h->Port, h->Path);
|
||||
if (h->Port == 443)
|
||||
{
|
||||
Format(url, sizeof(url), "https://%s/",
|
||||
h->Hostname);
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(url, sizeof(url), "https://%s:%u/",
|
||||
h->Hostname, h->Port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3001,7 +3017,3 @@ LOG *NewLog(char *dir, char *prefix, UINT switch_type)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -278,7 +278,3 @@ UINT64 GetMaxLogSize();
|
||||
|
||||
#endif // LOGGING_G
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+6
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -784,6 +784,7 @@ bool NmStatus(HWND hWnd, SM_SERVER *s, void *param)
|
||||
LvInsertAdd(b, ICO_PROTOCOL_DHCP, NULL, 2, _UU("NM_STATUS_DHCP"), tmp);
|
||||
|
||||
LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_KERNEL"), t.IsKernelMode ? _UU("SEC_YES") : _UU("SEC_NO"));
|
||||
LvInsertAdd(b, ICO_MACHINE, NULL, 2, _UU("SM_SNAT_IS_RAW"), t.IsRawIpMode ? _UU("SEC_YES") : _UU("SEC_NO"));
|
||||
|
||||
LvInsertEnd(b, hWnd, L_STATUS);
|
||||
|
||||
@@ -1640,7 +1641,3 @@ void NMExec()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -120,7 +120,3 @@ void NMExec();
|
||||
#endif // NM_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -176,7 +176,3 @@ 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.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+8
-10
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -596,7 +596,7 @@ UINT NtGetStatus(NAT *n, RPC_NAT_STATUS *t)
|
||||
|
||||
t->NumDhcpClients = LIST_NUM(v->DhcpLeaseList);
|
||||
|
||||
t->IsKernelMode = NnIsActive(v);
|
||||
t->IsKernelMode = NnIsActiveEx(v, &t->IsRawIpMode);
|
||||
}
|
||||
UnlockVirtual(v);
|
||||
}
|
||||
@@ -1063,6 +1063,7 @@ void InRpcNatStatus(RPC_NAT_STATUS *t, PACK *p)
|
||||
t->NumDnsSessions = PackGetInt(p, "NumDnsSessions");
|
||||
t->NumDhcpClients = PackGetInt(p, "NumDhcpClients");
|
||||
t->IsKernelMode = PackGetBool(p, "IsKernelMode");
|
||||
t->IsRawIpMode = PackGetBool(p, "IsRawIpMode");
|
||||
PackGetStr(p, "HubName", t->HubName, sizeof(t->HubName));
|
||||
}
|
||||
void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t)
|
||||
@@ -1080,6 +1081,7 @@ void OutRpcNatStatus(PACK *p, RPC_NAT_STATUS *t)
|
||||
PackAddInt(p, "NumDnsSessions", t->NumDnsSessions);
|
||||
PackAddInt(p, "NumDhcpClients", t->NumDhcpClients);
|
||||
PackAddBool(p, "IsKernelMode", t->IsKernelMode);
|
||||
PackAddBool(p, "IsRawIpMode", t->IsRawIpMode);
|
||||
}
|
||||
void FreeRpcNatStatus(RPC_NAT_STATUS *t)
|
||||
{
|
||||
@@ -1914,7 +1916,3 @@ void NtFree()
|
||||
nat_lock = NULL;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+6
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -168,6 +168,7 @@ struct RPC_NAT_STATUS
|
||||
UINT NumDnsSessions; // Number of DNS sessions
|
||||
UINT NumDhcpClients; // Number of DHCP clients
|
||||
bool IsKernelMode; // Whether kernel mode
|
||||
bool IsRawIpMode; // Whether raw IP mode
|
||||
};
|
||||
|
||||
// RPC_NAT_INFO *
|
||||
@@ -315,7 +316,3 @@ void OutRpcDummy(PACK *p, RPC_DUMMY *t);
|
||||
#endif // NAT_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+568
-14
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -257,6 +257,109 @@ LABEL_RESTART:
|
||||
Disconnect(a->Sock2);
|
||||
}
|
||||
|
||||
// Start the iptables tracking
|
||||
bool NsStartIpTablesTracking(NATIVE_STACK *a)
|
||||
{
|
||||
if (a->IpTablesThread != NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
a->IpTablesInitOk = false;
|
||||
|
||||
a->IpTablesHalt = false;
|
||||
|
||||
a->IpTablesHaltEvent = NewEvent();
|
||||
|
||||
a->IpTablesThread = NewThread(NsIpTablesThread, a);
|
||||
|
||||
WaitThreadInit(a->IpTablesThread);
|
||||
|
||||
return a->IpTablesInitOk;
|
||||
}
|
||||
|
||||
// iptables thread
|
||||
void NsIpTablesThread(THREAD *thread, void *param)
|
||||
{
|
||||
IPTABLES_STATE *state;
|
||||
NATIVE_STACK *s;
|
||||
UINT counter = 0;
|
||||
BUF *seed_buf;
|
||||
char exe_name[MAX_PATH];
|
||||
if (thread == NULL || param == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s = (NATIVE_STACK *)param;
|
||||
|
||||
seed_buf = NewBuf();
|
||||
|
||||
WriteBuf(seed_buf, s->MacAddress, 6);
|
||||
|
||||
GetExeName(exe_name, sizeof(exe_name));
|
||||
WriteBufStr(seed_buf, exe_name);
|
||||
|
||||
state = StartAddIpTablesEntryForNativeStack(seed_buf->Buf, seed_buf->Size);
|
||||
|
||||
FreeBuf(seed_buf);
|
||||
|
||||
if (state == NULL)
|
||||
{
|
||||
NoticeThreadInit(thread);
|
||||
return;
|
||||
}
|
||||
|
||||
s->IpTablesInitOk = true;
|
||||
NoticeThreadInit(thread);
|
||||
|
||||
while (true)
|
||||
{
|
||||
UINT wait_interval;
|
||||
|
||||
if (s->IpTablesHalt)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (MaintainAddIpTablesEntryForNativeStack(state))
|
||||
{
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
counter++;
|
||||
wait_interval = NS_CHECK_IPTABLES_INTERVAL_INIT * counter;
|
||||
wait_interval = MIN(wait_interval, NS_CHECK_IPTABLES_INTERVAL_MAX);
|
||||
|
||||
//Debug("NsIpTablesThread: wait for %u\n", wait_interval);
|
||||
Wait(s->IpTablesHaltEvent, wait_interval);
|
||||
}
|
||||
|
||||
EndAddIpTablesEntryForNativeStack(state);
|
||||
}
|
||||
|
||||
// Stop the iptables tracking
|
||||
void NsStopIpTablesTracking(NATIVE_STACK *a)
|
||||
{
|
||||
if (a->IpTablesThread == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
a->IpTablesHalt = true;
|
||||
Set(a->IpTablesHaltEvent);
|
||||
|
||||
WaitThread(a->IpTablesThread, INFINITE);
|
||||
|
||||
ReleaseThread(a->IpTablesThread);
|
||||
ReleaseEvent(a->IpTablesHaltEvent);
|
||||
|
||||
a->IpTablesThread = NULL;
|
||||
a->IpTablesHaltEvent = NULL;
|
||||
a->IpTablesInitOk = false;
|
||||
a->IpTablesHalt = false;
|
||||
}
|
||||
|
||||
// Release the stack
|
||||
void FreeNativeStack(NATIVE_STACK *a)
|
||||
{
|
||||
@@ -288,6 +391,8 @@ void FreeNativeStack(NATIVE_STACK *a)
|
||||
CloseEth(a->Eth);
|
||||
FreeIPC(a->Ipc);
|
||||
|
||||
NsStopIpTablesTracking(a);
|
||||
|
||||
ReleaseCancel(a->Cancel);
|
||||
|
||||
ReleaseSock(a->Sock1);
|
||||
@@ -312,12 +417,6 @@ NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cedar == NULL)
|
||||
{
|
||||
cedar = NewCedar(NULL, NULL);
|
||||
release_cedar = true;
|
||||
}
|
||||
|
||||
GetLocalHostIP4(&localhost);
|
||||
|
||||
// Open the Eth device
|
||||
@@ -327,6 +426,12 @@ NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cedar == NULL)
|
||||
{
|
||||
cedar = NewCedar(NULL, NULL);
|
||||
release_cedar = true;
|
||||
}
|
||||
|
||||
a = ZeroMalloc(sizeof(NATIVE_STACK));
|
||||
|
||||
NewSocketPair(&a->Sock1, &a->Sock2, &localhost, 1, &localhost, 1);
|
||||
@@ -353,6 +458,8 @@ NATIVE_STACK *NewNativeStack(CEDAR *cedar, char *device_name, char *mac_address_
|
||||
ReleaseCedar(cedar);
|
||||
}
|
||||
|
||||
a->IsIpRawMode = a->Eth->IsRawIpMode;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -440,8 +547,455 @@ void NsGenMacAddress(void *dest, char *mac_address_seed, char *device_name)
|
||||
Copy(dest, mac, 6);
|
||||
}
|
||||
|
||||
// Add the iptables entries for native stack
|
||||
IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size)
|
||||
{
|
||||
IPTABLES_STATE *ret = NULL;
|
||||
bool ok = false;
|
||||
|
||||
if (IsIpTablesSupported())
|
||||
{
|
||||
IPTABLES_ENTRY *e;
|
||||
UINT i;
|
||||
|
||||
ret = ZeroMalloc(sizeof(IPTABLES_STATE));
|
||||
|
||||
ret->EntryList = NewListFast(NULL);
|
||||
|
||||
HashSha1(ret->SeedHash, seed, seed_size);
|
||||
|
||||
// Create a pair of entry
|
||||
e = ZeroMalloc(sizeof(IPTABLES_ENTRY));
|
||||
GenerateDummyIpAndMark(ret->SeedHash, e, 0);
|
||||
StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT");
|
||||
Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs),
|
||||
"-p tcp --tcp-flags RST RST --sport %u:%u ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP",
|
||||
NN_RAW_IP_PORT_START, NN_RAW_IP_PORT_END,
|
||||
&e->DummySrcIp, &e->DummyDestIP, e->DummyMark);
|
||||
Add(ret->EntryList, e);
|
||||
|
||||
e = ZeroMalloc(sizeof(IPTABLES_ENTRY));
|
||||
GenerateDummyIpAndMark(ret->SeedHash, e, 1);
|
||||
StrCpy(e->Chain, sizeof(e->Chain), "OUTPUT");
|
||||
Format(e->ConditionAndArgs, sizeof(e->ConditionAndArgs),
|
||||
"-p icmp --icmp-type 3/3 ! -s %r/32 ! -d %r/32 -m connmark ! --mark 0x%x -j DROP",
|
||||
&e->DummySrcIp, &e->DummyDestIP, e->DummyMark);
|
||||
Add(ret->EntryList, e);
|
||||
|
||||
ok = true;
|
||||
|
||||
// Insert entries if not exists
|
||||
for (i = 0; i < LIST_NUM(ret->EntryList);i++)
|
||||
{
|
||||
UINT j;
|
||||
IPTABLES_ENTRY *e = LIST_DATA(ret->EntryList, i);
|
||||
|
||||
for (j = 0;j < 100;j++)
|
||||
{
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0)
|
||||
{
|
||||
char cmdline[MAX_PATH];
|
||||
|
||||
Format(cmdline, sizeof(cmdline),
|
||||
"iptables -D %s %s",
|
||||
e->Chain, e->ConditionAndArgs);
|
||||
|
||||
system(cmdline);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0)
|
||||
{
|
||||
char cmdline[MAX_PATH];
|
||||
|
||||
Format(cmdline, sizeof(cmdline),
|
||||
"iptables -I %s %s",
|
||||
e->Chain, e->ConditionAndArgs);
|
||||
|
||||
system(cmdline);
|
||||
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0)
|
||||
{
|
||||
Debug("Run \"%s\" failed.\n", cmdline);
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("Run \"%s\" ok.\n", cmdline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ok == false)
|
||||
{
|
||||
EndAddIpTablesEntryForNativeStack(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Maintain the iptables
|
||||
bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s)
|
||||
{
|
||||
UINT i;
|
||||
bool ret = false;
|
||||
if (s == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (s->HasError)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Insert entries if not exists
|
||||
for (i = 0; i < LIST_NUM(s->EntryList);i++)
|
||||
{
|
||||
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
|
||||
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0)
|
||||
{
|
||||
char cmdline[MAX_PATH];
|
||||
|
||||
Format(cmdline, sizeof(cmdline),
|
||||
"iptables -I %s %s",
|
||||
e->Chain, e->ConditionAndArgs);
|
||||
|
||||
system(cmdline);
|
||||
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) == 0)
|
||||
{
|
||||
Debug("Run \"%s\" failed.\n", cmdline);
|
||||
s->HasError = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("Run \"%s\" ok.\n", cmdline);
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Stop the iptables management
|
||||
void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s)
|
||||
{
|
||||
UINT i;
|
||||
if (s == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete entries
|
||||
for (i = 0; i < LIST_NUM(s->EntryList);i++)
|
||||
{
|
||||
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
|
||||
UINT j;
|
||||
|
||||
for (j = 0;j < 100;j++)
|
||||
{
|
||||
if (GetCurrentIpTableLineNumber(e->Chain, &e->DummySrcIp, &e->DummyDestIP, e->DummyMark) != 0)
|
||||
{
|
||||
char cmdline[MAX_PATH];
|
||||
|
||||
Format(cmdline, sizeof(cmdline),
|
||||
"iptables -D %s %s",
|
||||
e->Chain, e->ConditionAndArgs);
|
||||
|
||||
system(cmdline);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeIpTablesState(s);
|
||||
}
|
||||
|
||||
// Generate a set of dummy IP addresses and mark
|
||||
void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id)
|
||||
{
|
||||
PRAND *p;
|
||||
BUF *b;
|
||||
if (hash_seed == NULL || e == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
b = NewBuf();
|
||||
WriteBufInt(b, id);
|
||||
WriteBuf(b, hash_seed, SHA1_SIZE);
|
||||
WriteBufStr(b, "20151002");
|
||||
|
||||
p = NewPRand(b->Buf, b->Size);
|
||||
FreeBuf(b);
|
||||
|
||||
GenerateDummyIp(p, &e->DummySrcIp);
|
||||
GenerateDummyIp(p, &e->DummyDestIP);
|
||||
e->DummyMark = GenerateDummyMark(p);
|
||||
|
||||
FreePRand(p);
|
||||
}
|
||||
|
||||
// Generate a dummy iptables mark
|
||||
UINT GenerateDummyMark(PRAND *p)
|
||||
{
|
||||
UINT i;
|
||||
if (p == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
i = PRandInt(p);
|
||||
|
||||
if (i >= 1000000000 && i <= 0x7FFFFFFE)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Generate a dummy IP
|
||||
void GenerateDummyIp(PRAND *p, IP *ip)
|
||||
{
|
||||
UINT i;
|
||||
if (p == NULL || ip == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Zero(ip, sizeof(IP));
|
||||
|
||||
for (i = 1;i < 4;i++)
|
||||
{
|
||||
UINT v = 0;
|
||||
while (true)
|
||||
{
|
||||
v = PRandInt(p) % 256;
|
||||
if (v >= 1 && v <= 254)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ip->addr[i] = (UCHAR)v;
|
||||
}
|
||||
|
||||
ip->addr[0] = 127;
|
||||
}
|
||||
|
||||
// Search an entry
|
||||
IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark)
|
||||
{
|
||||
char ip_str1[64];
|
||||
char ip_str2[64];
|
||||
char mark_str1[64];
|
||||
char mark_str2[64];
|
||||
UINT i;
|
||||
if (s == NULL || chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IPToStr(ip_str1, sizeof(ip_str1), src_ip);
|
||||
IPToStr(ip_str2, sizeof(ip_str2), dest_ip);
|
||||
ToStr(mark_str1, mark);
|
||||
Format(mark_str2, sizeof(mark_str2), "%x", mark);
|
||||
|
||||
for (i = 0;i < LIST_NUM(s->EntryList);i++)
|
||||
{
|
||||
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
|
||||
|
||||
if (StrCmpi(e->Chain, chain) == 0)
|
||||
{
|
||||
if (InStr(e->ConditionAndArgs, ip_str1) &&
|
||||
InStr(e->ConditionAndArgs, ip_str2) &&
|
||||
(InStr(e->ConditionAndArgs, mark_str1) || InStr(e->ConditionAndArgs, mark_str2)))
|
||||
{
|
||||
return e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Search an entry and get the line number
|
||||
UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark)
|
||||
{
|
||||
IPTABLES_STATE *s;
|
||||
IPTABLES_ENTRY *e;
|
||||
UINT ret = 0;
|
||||
|
||||
if (chain == NULL || src_ip == NULL || dest_ip == NULL || mark == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
s = GetCurrentIpTables();
|
||||
|
||||
e = SearchIpTables(s, chain, src_ip, dest_ip, mark);
|
||||
|
||||
if (e != NULL)
|
||||
{
|
||||
ret = e->LineNumber;
|
||||
}
|
||||
|
||||
FreeIpTablesState(s);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Free the iptables state
|
||||
void FreeIpTablesState(IPTABLES_STATE *s)
|
||||
{
|
||||
UINT i;
|
||||
if (s == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0;i < LIST_NUM(s->EntryList);i++)
|
||||
{
|
||||
IPTABLES_ENTRY *e = LIST_DATA(s->EntryList, i);
|
||||
|
||||
Free(e);
|
||||
}
|
||||
|
||||
ReleaseList(s->EntryList);
|
||||
|
||||
Free(s);
|
||||
}
|
||||
|
||||
// Get the current iptables state
|
||||
IPTABLES_STATE *GetCurrentIpTables()
|
||||
{
|
||||
IPTABLES_STATE *ret = NULL;
|
||||
TOKEN_LIST *t = NULL;
|
||||
|
||||
#ifdef OS_UNIX
|
||||
t = UnixExec("iptables -L -x -n --line-numbers");
|
||||
#endif // OS_UNIX
|
||||
|
||||
if (t != NULL)
|
||||
{
|
||||
UINT i;
|
||||
UINT tmp_num = 0;
|
||||
|
||||
for (i = 0;i < t->NumTokens;i++)
|
||||
{
|
||||
char *line = t->Token[i];
|
||||
if (StartWith(line, "Chain INPUT") ||
|
||||
StartWith(line, "Chain FORWARD") ||
|
||||
StartWith(line, "Chain OUTPUT"))
|
||||
{
|
||||
tmp_num++;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp_num >= 3)
|
||||
{
|
||||
char current_chain[64];
|
||||
UINT mode = 0;
|
||||
|
||||
Zero(current_chain, sizeof(current_chain));
|
||||
|
||||
for (i = 0;i < t->NumTokens;i++)
|
||||
{
|
||||
char *line = t->Token[i];
|
||||
|
||||
if (StartWith(line, "Chain"))
|
||||
{
|
||||
TOKEN_LIST *t2 = ParseToken(line, " \t");
|
||||
if (t2 != NULL)
|
||||
{
|
||||
if (t2->NumTokens >= 4)
|
||||
{
|
||||
StrCpy(current_chain, sizeof(current_chain), t2->Token[1]);
|
||||
mode = 1;
|
||||
|
||||
if (ret == NULL)
|
||||
{
|
||||
ret = ZeroMalloc(sizeof(IPTABLES_STATE));
|
||||
ret->EntryList = NewListFast(NULL);
|
||||
}
|
||||
|
||||
}
|
||||
FreeToken(t2);
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == 1)
|
||||
{
|
||||
if (StartWith(line, "num"))
|
||||
{
|
||||
mode = 2;
|
||||
}
|
||||
}
|
||||
else if (mode == 2)
|
||||
{
|
||||
TOKEN_LIST *t2 = ParseToken(line, " \t");
|
||||
if (t2 != NULL)
|
||||
{
|
||||
if (t2->NumTokens >= 6 && ToInt(t2->Token[0]) != 0)
|
||||
{
|
||||
IPTABLES_ENTRY *e = ZeroMalloc(sizeof(IPTABLES_ENTRY));
|
||||
|
||||
StrCpy(e->Chain, sizeof(e->Chain), current_chain);
|
||||
e->LineNumber = ToInt(t2->Token[0]);
|
||||
StrCpy(e->ConditionAndArgs, sizeof(e->ConditionAndArgs), line);
|
||||
|
||||
Add(ret->EntryList, e);
|
||||
}
|
||||
|
||||
FreeToken(t2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FreeToken(t);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Get whether iptables is supported
|
||||
bool IsIpTablesSupported()
|
||||
{
|
||||
#ifdef UNIX_LINUX
|
||||
IPTABLES_STATE *s = GetCurrentIpTables();
|
||||
if (s != NULL)
|
||||
{
|
||||
FreeIpTablesState(s);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else // UNIX_LINUX
|
||||
return false;
|
||||
#endif // UNIX_LINUX
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+51
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -117,6 +117,10 @@
|
||||
//// Constants
|
||||
#define NS_MAC_ADDRESS_BYTE_1 0xDA // First byte of the MAC address
|
||||
|
||||
#define NS_CHECK_IPTABLES_INTERVAL_INIT (1 * 1000)
|
||||
|
||||
#define NS_CHECK_IPTABLES_INTERVAL_MAX (5 * 60 * 1000)
|
||||
|
||||
//// Type
|
||||
struct NATIVE_STACK
|
||||
{
|
||||
@@ -132,6 +136,30 @@ struct NATIVE_STACK
|
||||
SOCK *Sock2; // Sock2 (Used in the IPC side)
|
||||
DHCP_OPTION_LIST CurrentDhcpOptionList; // Current DHCP options list
|
||||
IP DnsServerIP; // IP address of the DNS server
|
||||
IP DnsServerIP2; // IP address of the DNS server #2
|
||||
bool IsIpRawMode;
|
||||
IP MyIP_InCaseOfIpRawMode; // My IP
|
||||
|
||||
THREAD *IpTablesThread;
|
||||
EVENT *IpTablesHaltEvent;
|
||||
bool IpTablesHalt;
|
||||
bool IpTablesInitOk;
|
||||
};
|
||||
|
||||
struct IPTABLES_ENTRY
|
||||
{
|
||||
char Chain[64];
|
||||
UINT LineNumber;
|
||||
char ConditionAndArgs[MAX_SIZE];
|
||||
IP DummySrcIp, DummyDestIP;
|
||||
UINT DummyMark;
|
||||
};
|
||||
|
||||
struct IPTABLES_STATE
|
||||
{
|
||||
UCHAR SeedHash[SHA1_SIZE];
|
||||
LIST *EntryList;
|
||||
bool HasError;
|
||||
};
|
||||
|
||||
|
||||
@@ -144,10 +172,24 @@ void NsMainThread(THREAD *thread, void *param);
|
||||
void NsGenMacAddressSignatureForMachine(UCHAR *dst_last_2, UCHAR *src_mac_addr_4);
|
||||
bool NsIsMacAddressOnLocalhost(UCHAR *mac);
|
||||
|
||||
bool NsStartIpTablesTracking(NATIVE_STACK *a);
|
||||
void NsStopIpTablesTracking(NATIVE_STACK *a);
|
||||
void NsIpTablesThread(THREAD *thread, void *param);
|
||||
|
||||
IPTABLES_STATE *GetCurrentIpTables();
|
||||
void FreeIpTablesState(IPTABLES_STATE *s);
|
||||
bool IsIpTablesSupported();
|
||||
IPTABLES_ENTRY *SearchIpTables(IPTABLES_STATE *s, char *chain, IP *src_ip, IP *dest_ip, UINT mark);
|
||||
UINT GetCurrentIpTableLineNumber(char *chain, IP *src_ip, IP *dest_ip, UINT mark);
|
||||
|
||||
IPTABLES_STATE *StartAddIpTablesEntryForNativeStack(void *seed, UINT seed_size);
|
||||
void EndAddIpTablesEntryForNativeStack(IPTABLES_STATE *s);
|
||||
bool MaintainAddIpTablesEntryForNativeStack(IPTABLES_STATE *s);
|
||||
|
||||
void GenerateDummyIpAndMark(void *hash_seed, IPTABLES_ENTRY *e, UINT id);
|
||||
UINT GenerateDummyMark(PRAND *p);
|
||||
void GenerateDummyIp(PRAND *p, IP *ip);
|
||||
|
||||
#endif // NATIVESTACK_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -331,7 +331,3 @@ void NullPaFree(SESSION *s)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -143,7 +143,3 @@ void NullGenerateMacAddress(UCHAR *mac, UINT id, UINT seq);
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+92
-58
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -690,8 +690,11 @@ void UpdateClientThreadMain(UPDATE_CLIENT *c)
|
||||
|
||||
cert_hash = StrToBin(UPDATE_SERVER_CERT_HASH);
|
||||
|
||||
recv = HttpRequestEx2(&data, NULL, UPDATE_CONNECT_TIMEOUT, UPDATE_COMM_TIMEOUT, &ret, false, NULL, NULL,
|
||||
NULL, ((cert_hash != NULL && cert_hash->Size == SHA1_SIZE) ? cert_hash->Buf : NULL),
|
||||
StrCpy(data.SniString, sizeof(data.SniString), DDNS_SNI_VER_STRING);
|
||||
|
||||
recv = HttpRequestEx3(&data, NULL, UPDATE_CONNECT_TIMEOUT, UPDATE_COMM_TIMEOUT, &ret, false, NULL, NULL,
|
||||
NULL, ((cert_hash != NULL && (cert_hash->Size % SHA1_SIZE) == 0) ? cert_hash->Buf : NULL),
|
||||
(cert_hash != NULL ? (cert_hash->Size / SHA1_SIZE) : 0),
|
||||
(bool *)&c->HaltFlag, 0, NULL, NULL);
|
||||
|
||||
FreeBuf(cert_hash);
|
||||
@@ -1312,7 +1315,6 @@ bool ServerAccept(CONNECTION *c)
|
||||
FARM_MEMBER *f = NULL;
|
||||
SERVER *server = NULL;
|
||||
POLICY ticketed_policy;
|
||||
UINT64 timestamp;
|
||||
UCHAR unique[SHA1_SIZE], unique2[SHA1_SIZE];
|
||||
CEDAR *cedar;
|
||||
RPC_WINVER winver;
|
||||
@@ -1324,6 +1326,7 @@ bool ServerAccept(CONNECTION *c)
|
||||
char *error_detail = NULL;
|
||||
char *error_detail_2 = NULL;
|
||||
char ctoken_hash_str[64];
|
||||
EAP_CLIENT *release_me_eap_client = NULL;
|
||||
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
@@ -1449,31 +1452,6 @@ bool ServerAccept(CONNECTION *c)
|
||||
}
|
||||
}
|
||||
|
||||
// Time inspection
|
||||
timestamp = PackGetInt64(p, "timestamp");
|
||||
if (timestamp != 0)
|
||||
{
|
||||
UINT64 now = SystemTime64();
|
||||
UINT64 abs;
|
||||
if (now >= timestamp)
|
||||
{
|
||||
abs = now - timestamp;
|
||||
}
|
||||
else
|
||||
{
|
||||
abs = timestamp - now;
|
||||
}
|
||||
|
||||
if (abs > ALLOW_TIMESTAMP_DIFF)
|
||||
{
|
||||
// Time difference is too large
|
||||
FreePack(p);
|
||||
c->Err = ERR_BAD_CLOCK;
|
||||
error_detail = "ERR_BAD_CLOCK";
|
||||
goto CLEANUP;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the client version
|
||||
PackGetStr(p, "client_str", c->ClientStr, sizeof(c->ClientStr));
|
||||
c->ClientVer = PackGetInt(p, "client_ver");
|
||||
@@ -1653,6 +1631,11 @@ bool ServerAccept(CONNECTION *c)
|
||||
if (hub->Option != NULL)
|
||||
{
|
||||
radius_login_opt.In_CheckVLanId = hub->Option->AssignVLanIdByRadiusAttribute;
|
||||
radius_login_opt.In_DenyNoVlanId = hub->Option->DenyAllRadiusLoginWithNoVlanAssign;
|
||||
if (hub->Option->UseHubNameAsRadiusNasId)
|
||||
{
|
||||
StrCpy(radius_login_opt.NasId, sizeof(radius_login_opt.NasId), hubname);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the various flags
|
||||
@@ -1674,6 +1657,14 @@ bool ServerAccept(CONNECTION *c)
|
||||
if (c->IsInProc)
|
||||
{
|
||||
char tmp[MAX_SIZE];
|
||||
UINT64 ptr;
|
||||
|
||||
ptr = PackGetInt64(p, "release_me_eap_client");
|
||||
if (ptr != 0)
|
||||
{
|
||||
release_me_eap_client = (EAP_CLIENT *)ptr;
|
||||
}
|
||||
|
||||
PackGetStr(p, "inproc_postfix", c->InProcPrefix, sizeof(c->InProcPrefix));
|
||||
Zero(tmp, sizeof(tmp));
|
||||
PackGetStr(p, "inproc_cryptname", tmp, sizeof(tmp));
|
||||
@@ -2203,9 +2194,25 @@ bool ServerAccept(CONNECTION *c)
|
||||
FreePack(p);
|
||||
|
||||
// Check the assigned VLAN ID
|
||||
if (radius_login_opt.Out_VLanId != 0)
|
||||
if (radius_login_opt.Out_IsRadiusLogin)
|
||||
{
|
||||
assigned_vlan_id = radius_login_opt.Out_VLanId;
|
||||
if (radius_login_opt.In_CheckVLanId)
|
||||
{
|
||||
if (radius_login_opt.Out_VLanId != 0)
|
||||
{
|
||||
assigned_vlan_id = radius_login_opt.Out_VLanId;
|
||||
}
|
||||
|
||||
if (radius_login_opt.In_DenyNoVlanId && assigned_vlan_id == 0 || assigned_vlan_id >= 4096)
|
||||
{
|
||||
// Deny this session
|
||||
Unlock(hub->lock);
|
||||
ReleaseHub(hub);
|
||||
c->Err = ERR_ACCESS_DENIED;
|
||||
error_detail = "In_DenyNoVlanId";
|
||||
goto CLEANUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StrCmpi(username, ADMINISTRATOR_USERNAME) != 0)
|
||||
@@ -3807,6 +3814,11 @@ CLEANUP:
|
||||
|
||||
SLog(c->Cedar, "LS_CONNECTION_ERROR", c->Name, GetUniErrorStr(c->Err), c->Err);
|
||||
|
||||
if (release_me_eap_client != NULL)
|
||||
{
|
||||
ReleaseEapClient(release_me_eap_client);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -4543,7 +4555,7 @@ bool ClientSecureSign(CONNECTION *c, UCHAR *sign, UCHAR *random, X **x)
|
||||
|
||||
if (ret)
|
||||
{
|
||||
Copy(sign, ss->Signature, 128);
|
||||
Copy(sign, ss->Signature, sizeof(ss->Signature));
|
||||
*x = ss->ClientCert;
|
||||
}
|
||||
|
||||
@@ -5822,7 +5834,7 @@ bool ClientUploadAuth(CONNECTION *c)
|
||||
// Authentication by secure device
|
||||
if (ClientSecureSign(c, sign, c->Random, &x))
|
||||
{
|
||||
p = PackLoginWithCert(o->HubName, a->Username, x, sign, 128);
|
||||
p = PackLoginWithCert(o->HubName, a->Username, x, sign, x->bits / 8);
|
||||
c->ClientX = CloneX(x);
|
||||
FreeX(x);
|
||||
}
|
||||
@@ -5845,9 +5857,6 @@ bool ClientUploadAuth(CONNECTION *c)
|
||||
PackAddData(p, "ticket", c->Ticket, SHA1_SIZE);
|
||||
}
|
||||
|
||||
// Current time
|
||||
PackAddInt64(p, "timestamp", SystemTime64());
|
||||
|
||||
if (p == NULL)
|
||||
{
|
||||
// Error
|
||||
@@ -6446,12 +6455,15 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls
|
||||
UINT nat_t_err = 0;
|
||||
bool is_additonal_rudp_session = false;
|
||||
UCHAR uc = 0;
|
||||
IP ret_ip;
|
||||
// Validate arguments
|
||||
if (c == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Zero(&ret_ip, sizeof(IP));
|
||||
|
||||
sess = c->Session;
|
||||
|
||||
if (sess != NULL)
|
||||
@@ -6464,12 +6476,25 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls
|
||||
|
||||
o = c->Session->ClientOption;
|
||||
|
||||
if (additional_connect)
|
||||
{
|
||||
if (sess != NULL)
|
||||
{
|
||||
Copy(&ret_ip, &sess->ServerIP_CacheForNextConnect, sizeof(IP));
|
||||
}
|
||||
}
|
||||
|
||||
if (c->RestoreServerNameAndPort && additional_connect)
|
||||
{
|
||||
// Restore to the original server name and port number
|
||||
c->RestoreServerNameAndPort = false;
|
||||
|
||||
StrCpy(c->ServerName, sizeof(c->ServerName), o->Hostname);
|
||||
if (StrCmpi(c->ServerName, o->Hostname) != 0)
|
||||
{
|
||||
StrCpy(c->ServerName, sizeof(c->ServerName), o->Hostname);
|
||||
Zero(&ret_ip, sizeof(IP));
|
||||
}
|
||||
|
||||
c->ServerPort = o->Port;
|
||||
}
|
||||
|
||||
@@ -6489,7 +6514,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);
|
||||
true, no_tls, &ret_ip);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6554,9 +6579,9 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls
|
||||
|
||||
|
||||
// SOCKS connection
|
||||
s = SocksConnectEx(c, host_for_direct_connection, port_for_direct_connection,
|
||||
s = SocksConnectEx2(c, host_for_direct_connection, port_for_direct_connection,
|
||||
c->ServerName, c->ServerPort, o->ProxyUsername,
|
||||
additional_connect, (bool *)cancel_flag, hWnd);
|
||||
additional_connect, (bool *)cancel_flag, hWnd, 0, &ret_ip);
|
||||
if (s == NULL)
|
||||
{
|
||||
// Connection failure
|
||||
@@ -6581,6 +6606,19 @@ SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls
|
||||
Copy(&c->Session->ServerIP, &s->RemoteIP, sizeof(IP));
|
||||
}
|
||||
}
|
||||
|
||||
if (IsZeroIP(&ret_ip) == false)
|
||||
{
|
||||
if (c->Session != NULL)
|
||||
{
|
||||
if (additional_connect == false)
|
||||
{
|
||||
Copy(&c->Session->ServerIP_CacheForNextConnect, &ret_ip, sizeof(IP));
|
||||
|
||||
Debug("Saved ServerIP_CacheForNextConnect: %s = %r\n", c->ServerName, &ret_ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -6601,12 +6639,12 @@ SOCK *SocksConnectEx(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
{
|
||||
return SocksConnectEx2(c, proxy_host_name, proxy_port,
|
||||
server_host_name, server_port, username, additional_connect, cancel_flag,
|
||||
hWnd, 0);
|
||||
hWnd, 0, NULL);
|
||||
}
|
||||
SOCK *SocksConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
char *server_host_name, UINT server_port,
|
||||
char *username, bool additional_connect,
|
||||
bool *cancel_flag, void *hWnd, UINT timeout)
|
||||
bool *cancel_flag, void *hWnd, UINT timeout, IP *ret_ip)
|
||||
{
|
||||
SOCK *s = NULL;
|
||||
IP ip;
|
||||
@@ -6634,7 +6672,7 @@ SOCK *SocksConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
}
|
||||
|
||||
// Connection
|
||||
s = TcpConnectEx3(proxy_host_name, proxy_port, timeout, cancel_flag, hWnd, true, NULL, false, false);
|
||||
s = TcpConnectEx3(proxy_host_name, proxy_port, timeout, cancel_flag, hWnd, true, NULL, false, false, ret_ip);
|
||||
if (s == NULL)
|
||||
{
|
||||
// Failure
|
||||
@@ -6838,7 +6876,7 @@ SOCK *ProxyConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
}
|
||||
|
||||
// Connection
|
||||
s = TcpConnectEx3(proxy_host_name, proxy_port, timeout, cancel_flag, hWnd, true, NULL, false, false);
|
||||
s = TcpConnectEx3(proxy_host_name, proxy_port, timeout, cancel_flag, hWnd, true, NULL, false, false, NULL);
|
||||
if (s == NULL)
|
||||
{
|
||||
// Failure
|
||||
@@ -6990,15 +7028,15 @@ SOCK *ProxyConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
// TCP connection function
|
||||
SOCK *TcpConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool try_start_ssl, bool ssl_no_tls)
|
||||
{
|
||||
return TcpConnectEx3(hostname, port, timeout, cancel_flag, hWnd, false, NULL, try_start_ssl, ssl_no_tls);
|
||||
return TcpConnectEx3(hostname, port, timeout, cancel_flag, hWnd, false, NULL, try_start_ssl, ssl_no_tls, NULL);
|
||||
}
|
||||
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, bool ssl_no_tls)
|
||||
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, bool ssl_no_tls, IP *ret_ip)
|
||||
{
|
||||
#ifdef OS_WIN32
|
||||
if (hWnd == NULL)
|
||||
{
|
||||
#endif // OS_WIN32
|
||||
return ConnectEx3(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, ssl_no_tls, true);
|
||||
return ConnectEx4(hostname, port, timeout, cancel_flag, (no_nat_t ? NULL : VPN_RUDP_SVC_NAME), nat_t_error_code, try_start_ssl, ssl_no_tls, true, ret_ip);
|
||||
#ifdef OS_WIN32
|
||||
}
|
||||
else
|
||||
@@ -7011,9 +7049,9 @@ SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag,
|
||||
// Connect with TCP/IP
|
||||
SOCK *TcpIpConnect(char *hostname, UINT port, bool try_start_ssl, bool ssl_no_tls)
|
||||
{
|
||||
return TcpIpConnectEx(hostname, port, NULL, NULL, NULL, false, try_start_ssl, ssl_no_tls);
|
||||
return TcpIpConnectEx(hostname, port, NULL, NULL, NULL, false, try_start_ssl, ssl_no_tls, NULL);
|
||||
}
|
||||
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, bool ssl_no_tls)
|
||||
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, bool ssl_no_tls, IP *ret_ip)
|
||||
{
|
||||
SOCK *s = NULL;
|
||||
UINT dummy_int = 0;
|
||||
@@ -7028,7 +7066,7 @@ SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, U
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = TcpConnectEx3(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ssl_no_tls);
|
||||
s = TcpConnectEx3(hostname, port, 0, cancel_flag, hWnd, no_nat_t, nat_t_error_code, try_start_ssl, ssl_no_tls, ret_ip);
|
||||
if (s == NULL)
|
||||
{
|
||||
return NULL;
|
||||
@@ -7273,7 +7311,3 @@ void GenerateRC4KeyPair(RC4_KEY_PAIR *k)
|
||||
Rand(k->ServerToClientKey, sizeof(k->ServerToClientKey));
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+9
-13
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -180,7 +180,7 @@ struct UPDATE_CLIENT
|
||||
#define UPDATE_FAMILY_NAME _SS("PRODUCT_FAMILY_NAME")
|
||||
|
||||
// Software update server certificate hash
|
||||
#define UPDATE_SERVER_CERT_HASH "EFAC5FA0CDD14E0F864EED58A73C35D7E33B62F3"
|
||||
#define UPDATE_SERVER_CERT_HASH DDNS_CERT_HASH
|
||||
|
||||
// URL
|
||||
#define UPDATE_SERVER_URL_GLOBAL "https://update-check.softether-network.net/update/update.aspx?family=%s&software=%s&mybuild=%u&lang=%s"
|
||||
@@ -218,7 +218,7 @@ bool ServerAccept(CONNECTION *c);
|
||||
bool ClientConnect(CONNECTION *c);
|
||||
SOCK *ClientConnectToServer(CONNECTION *c);
|
||||
SOCK *TcpIpConnect(char *hostname, UINT port, bool try_start_ssl, bool ssl_no_tls);
|
||||
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, bool ssl_no_tls);
|
||||
SOCK *TcpIpConnectEx(char *hostname, UINT port, bool *cancel_flag, void *hWnd, UINT *nat_t_error_code, bool no_nat_t, bool try_start_ssl, bool ssl_no_tls, IP *ret_ip);
|
||||
bool ClientUploadSignature(SOCK *s);
|
||||
bool ClientDownloadHello(CONNECTION *c, SOCK *s);
|
||||
bool ServerDownloadSignature(CONNECTION *c, char **error_detail_str);
|
||||
@@ -226,7 +226,7 @@ bool ServerUploadHello(CONNECTION *c);
|
||||
bool ClientUploadAuth(CONNECTION *c);
|
||||
SOCK *ClientConnectGetSocket(CONNECTION *c, bool additional_connect, bool no_tls);
|
||||
SOCK *TcpConnectEx2(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool try_start_ssl, bool ssl_no_tls);
|
||||
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, bool ssl_no_tls);
|
||||
SOCK *TcpConnectEx3(char *hostname, UINT port, UINT timeout, bool *cancel_flag, void *hWnd, bool no_nat_t, UINT *nat_t_error_code, bool try_start_ssl, bool ssl_no_tls, IP *ret_ip);
|
||||
|
||||
void InitProtocol();
|
||||
void FreeProtocol();
|
||||
@@ -280,7 +280,7 @@ SOCK *SocksConnectEx(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
SOCK *SocksConnectEx2(CONNECTION *c, char *proxy_host_name, UINT proxy_port,
|
||||
char *server_host_name, UINT server_port,
|
||||
char *username, bool additional_connect,
|
||||
bool *cancel_flag, void *hWnd, UINT timeout);
|
||||
bool *cancel_flag, void *hWnd, UINT timeout, IP *ret_ip);
|
||||
bool SocksSendRequestPacket(CONNECTION *c, SOCK *s, UINT dest_port, IP *dest_ip, char *userid);
|
||||
bool SocksRecvResponsePacket(CONNECTION *c, SOCK *s);
|
||||
void CreateNodeInfo(NODE_INFO *info, CONNECTION *c);
|
||||
@@ -314,7 +314,3 @@ bool DownloadAndSaveIntermediateCertificatesIfNecessary(X *x);
|
||||
|
||||
|
||||
#endif // PROTOCOL_H
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+1655
-11
File diff suppressed because it is too large
Load Diff
+255
-11
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -117,20 +117,268 @@
|
||||
#define RADIUS_DEFAULT_PORT 1812 // The default port number
|
||||
#define RADIUS_RETRY_INTERVAL 500 // Retransmission interval
|
||||
#define RADIUS_RETRY_TIMEOUT (10 * 1000) // Time-out period
|
||||
#define RADIUS_INITIAL_EAP_TIMEOUT 1600 // Initial timeout for EAP
|
||||
|
||||
|
||||
// RADIUS attributes
|
||||
#define RADIUS_ATTRIBUTE_VLAN_ID 81
|
||||
#define RADIUS_ATTRIBUTE_USER_NAME 1
|
||||
#define RADIUS_ATTRIBUTE_NAS_IP 4
|
||||
#define RADIUS_ATTRIBUTE_NAS_PORT 5
|
||||
#define RADIUS_ATTRIBUTE_SERVICE_TYPE 6
|
||||
#define RADIUS_ATTRIBUTE_FRAMED_PROTOCOL 7
|
||||
#define RADIUS_ATTRIBUTE_FRAMED_MTU 12
|
||||
#define RADIUS_ATTRIBUTE_STATE 24
|
||||
#define RADIUS_ATTRIBUTE_VENDOR_SPECIFIC 26
|
||||
#define RADIUS_ATTRIBUTE_CALLED_STATION_ID 30
|
||||
#define RADIUS_ATTRIBUTE_CALLING_STATION_ID 31
|
||||
#define RADIUS_ATTRIBUTE_NAS_ID 32
|
||||
#define RADIUS_ATTRIBUTE_PROXY_STATE 33
|
||||
#define RADIUS_ATTRIBUTE_ACCT_SESSION_ID 44
|
||||
#define RADIUS_ATTRIBUTE_NAS_PORT_TYPE 61
|
||||
#define RADIUS_ATTRIBUTE_TUNNEL_TYPE 64
|
||||
#define RADIUS_ATTRIBUTE_TUNNEL_MEDIUM_TYPE 65
|
||||
#define RADIUS_ATTRIBUTE_TUNNEL_CLIENT_ENDPOINT 66
|
||||
#define RADIUS_ATTRIBUTE_TUNNEL_SERVER_ENDPOINT 67
|
||||
#define RADIUS_ATTRIBUTE_EAP_MESSAGE 79
|
||||
#define RADIUS_ATTRIBUTE_EAP_AUTHENTICATOR 80
|
||||
#define RADIUS_ATTRIBUTE_VLAN_ID 81
|
||||
#define RADIUS_MAX_NAS_ID_LEN 253
|
||||
|
||||
// RADIUS codes
|
||||
#define RADIUS_CODE_ACCESS_REQUEST 1
|
||||
#define RADIUS_CODE_ACCESS_ACCEPT 2
|
||||
#define RADIUS_CODE_ACCESS_REJECT 3
|
||||
#define RADIUS_CODE_ACCESS_CHALLENGE 11
|
||||
|
||||
// RADIUS vendor ID
|
||||
#define RADIUS_VENDOR_MICROSOFT 311
|
||||
|
||||
// RADIUS MS attributes
|
||||
#define RADIUS_MS_RAS_VENDOR 9
|
||||
#define RADIUS_MS_CHAP_CHALLENGE 11
|
||||
#define RADIUS_MS_VERSION 18
|
||||
#define RADIUS_MS_CHAP2_RESPONSE 25
|
||||
#define RADIUS_MS_RAS_CLIENT_NAME 34
|
||||
#define RADIUS_MS_RAS_CLIENT_VERSION 35
|
||||
#define RADIUS_MS_NETWORK_ACCESS_SERVER_TYPE 47
|
||||
#define RADIUS_MS_RAS_CORRELATION 56
|
||||
|
||||
// EAP code
|
||||
#define EAP_CODE_REQUEST 1
|
||||
#define EAP_CODE_RESPONSE 2
|
||||
#define EAP_CODE_SUCCESS 3
|
||||
#define EAP_CODE_FAILURE 4
|
||||
|
||||
// EAP type
|
||||
#define EAP_TYPE_IDENTITY 1
|
||||
#define EAP_TYPE_LEGACY_NAK 3
|
||||
#define EAP_TYPE_PEAP 25
|
||||
#define EAP_TYPE_MS_AUTH 26
|
||||
|
||||
// MS-CHAPv2 opcodes
|
||||
#define EAP_MSCHAPV2_OP_CHALLENGE 1
|
||||
#define EAP_MSCHAPV2_OP_RESPONSE 2
|
||||
#define EAP_MSCHAPV2_OP_SUCCESS 3
|
||||
|
||||
// EAP-TLS flags
|
||||
#define EAP_TLS_FLAGS_LEN 0x80
|
||||
#define EAP_TLS_FLAGS_MORE_FRAGMENTS 0x40
|
||||
#define EAP_TLS_FLAGS_START 0x20
|
||||
|
||||
|
||||
////////// Modern implementation
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#pragma pack(push, 1)
|
||||
#endif // OS_WIN32
|
||||
|
||||
struct EAP_MESSAGE
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Data[1500];
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_MSCHAPV2_GENERAL
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Chap_Opcode;
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_MSCHAPV2_CHALLENGE
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Chap_Opcode;
|
||||
UCHAR Chap_Id;
|
||||
USHORT Chap_Len;
|
||||
UCHAR Chap_ValueSize; // = 16
|
||||
UCHAR Chap_ChallengeValue[16];
|
||||
char Chap_Name[256];
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_MSCHAPV2_RESPONSE
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Chap_Opcode;
|
||||
UCHAR Chap_Id;
|
||||
USHORT Chap_Len;
|
||||
UCHAR Chap_ValueSize; // = 49
|
||||
UCHAR Chap_PeerChallange[16];
|
||||
UCHAR Chap_Reserved[8];
|
||||
UCHAR Chap_NtResponse[24];
|
||||
UCHAR Chap_Flags;
|
||||
char Chap_Name[256];
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_MSCHAPV2_SUCCESS_SERVER
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Chap_Opcode;
|
||||
UCHAR Chap_Id;
|
||||
USHORT Chap_Len;
|
||||
char Message[256];
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_MSCHAPV2_SUCCESS_CLIENT
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR Chap_Opcode;
|
||||
} GCC_PACKED;
|
||||
|
||||
struct EAP_PEAP
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR Id;
|
||||
USHORT Len; // = sizeof(Data) + 5
|
||||
UCHAR Type;
|
||||
UCHAR TlsFlags;
|
||||
} GCC_PACKED;
|
||||
|
||||
#ifdef OS_WIN32
|
||||
#pragma pack(pop)
|
||||
#endif // OS_WIN32
|
||||
|
||||
struct RADIUS_PACKET
|
||||
{
|
||||
UCHAR Code;
|
||||
UCHAR PacketId;
|
||||
LIST *AvpList;
|
||||
UCHAR Authenticator[16];
|
||||
|
||||
UINT Parse_EapAuthMessagePos;
|
||||
UINT Parse_AuthenticatorPos;
|
||||
|
||||
EAP_MESSAGE *Parse_EapMessage;
|
||||
UINT Parse_EapMessage_DataSize;
|
||||
|
||||
UINT Parse_StateSize;
|
||||
UCHAR Parse_State[256];
|
||||
};
|
||||
|
||||
struct RADIUS_AVP
|
||||
{
|
||||
UCHAR Type;
|
||||
UINT VendorId;
|
||||
UCHAR VendorCode;
|
||||
UCHAR Padding[3];
|
||||
UCHAR DataSize;
|
||||
UCHAR Data[256];
|
||||
};
|
||||
|
||||
struct EAP_CLIENT
|
||||
{
|
||||
REF *Ref;
|
||||
|
||||
SOCK *UdpSock;
|
||||
IP ServerIp;
|
||||
UINT ServerPort;
|
||||
char SharedSecret[MAX_SIZE];
|
||||
char ClientIpStr[256];
|
||||
char CalledStationStr[256];
|
||||
char Username[MAX_USERNAME_LEN + 1];
|
||||
UINT ResendTimeout;
|
||||
UINT GiveupTimeout;
|
||||
UCHAR TmpBuffer[4096];
|
||||
UCHAR NextEapId;
|
||||
UCHAR LastRecvEapId;
|
||||
|
||||
bool PeapMode;
|
||||
|
||||
UCHAR LastState[256];
|
||||
UINT LastStateSize;
|
||||
|
||||
EAP_MSCHAPV2_CHALLENGE MsChapV2Challenge;
|
||||
EAP_MSCHAPV2_SUCCESS_SERVER MsChapV2Success;
|
||||
UCHAR ServerResponse[20];
|
||||
|
||||
SSL_PIPE *SslPipe;
|
||||
UCHAR NextRadiusPacketId;
|
||||
|
||||
BUF *PEAP_CurrentReceivingMsg;
|
||||
UINT PEAP_CurrentReceivingTotalSize;
|
||||
UCHAR RecvLastCode;
|
||||
|
||||
UINT LastRecvVLanId;
|
||||
};
|
||||
|
||||
void FreeRadiusPacket(RADIUS_PACKET *p);
|
||||
BUF *GenerateRadiusPacket(RADIUS_PACKET *p, char *shared_secret);
|
||||
RADIUS_PACKET *ParseRadiusPacket(void *data, UINT size);
|
||||
RADIUS_PACKET *NewRadiusPacket(UCHAR code, UCHAR packet_id);
|
||||
RADIUS_AVP *NewRadiusAvp(UCHAR type, UINT vendor_id, UCHAR vendor_code, void *data, UINT size);
|
||||
RADIUS_AVP *GetRadiusAvp(RADIUS_PACKET *p, UCHAR type);
|
||||
void RadiusTest();
|
||||
|
||||
|
||||
EAP_CLIENT *NewEapClient(IP *server_ip, UINT server_port, char *shared_secret, UINT resend_timeout, UINT giveup_timeout, char *client_ip_str, char *username, char *hubname);
|
||||
void ReleaseEapClient(EAP_CLIENT *e);
|
||||
void CleanupEapClient(EAP_CLIENT *e);
|
||||
bool EapClientSendMsChapv2AuthRequest(EAP_CLIENT *e);
|
||||
bool EapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge);
|
||||
void EapSetRadiusGeneralAttributes(RADIUS_PACKET *r, EAP_CLIENT *e);
|
||||
bool EapSendPacket(EAP_CLIENT *e, RADIUS_PACKET *r);
|
||||
RADIUS_PACKET *EapSendPacketAndRecvResponse(EAP_CLIENT *e, RADIUS_PACKET *r);
|
||||
|
||||
bool PeapClientSendMsChapv2AuthRequest(EAP_CLIENT *eap);
|
||||
bool PeapClientSendMsChapv2AuthClientResponse(EAP_CLIENT *e, UCHAR *client_response, UCHAR *client_challenge);
|
||||
|
||||
bool StartPeapClient(EAP_CLIENT *e);
|
||||
bool StartPeapSslClient(EAP_CLIENT *e);
|
||||
bool SendPeapRawPacket(EAP_CLIENT *e, UCHAR *peap_data, UINT peap_size);
|
||||
bool SendPeapPacket(EAP_CLIENT *e, void *msg, UINT msg_size);
|
||||
bool GetRecvPeapMessage(EAP_CLIENT *e, EAP_MESSAGE *msg);
|
||||
|
||||
|
||||
////////// Classical implementation
|
||||
struct RADIUS_LOGIN_OPTION
|
||||
{
|
||||
bool In_CheckVLanId;
|
||||
bool In_DenyNoVlanId;
|
||||
UINT Out_VLanId;
|
||||
bool Out_IsRadiusLogin;
|
||||
char NasId[RADIUS_MAX_NAS_ID_LEN + 1]; // NAS-Identifier
|
||||
};
|
||||
|
||||
// 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,
|
||||
RADIUS_LOGIN_OPTION *opt);
|
||||
RADIUS_LOGIN_OPTION *opt, char *hubname);
|
||||
BUF *RadiusEncryptPassword(char *password, UCHAR *random, UCHAR *secret, UINT secret_size);
|
||||
BUF *RadiusCreateUserName(wchar_t *username);
|
||||
BUF *RadiusCreateUserPassword(void *data, UINT size);
|
||||
@@ -142,7 +390,3 @@ LIST *RadiusParseOptions(BUF *b);
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -472,7 +472,3 @@ RPC *StartRpcClient(SOCK *s, void *param)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -151,7 +151,3 @@ void RpcFree(RPC *rpc);
|
||||
|
||||
#endif // REMOTE_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+29
-12
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -872,17 +872,19 @@ UINT SmDDnsDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param)
|
||||
|
||||
// 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;
|
||||
RPC *rpc;
|
||||
|
||||
// Validate arguments
|
||||
if(d == NULL || d->s == NULL || key == NULL){
|
||||
return ERR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
rpc = d->s->Rpc;
|
||||
|
||||
Zero(&config, sizeof(config));
|
||||
err = ScGetConfig(d->s->Rpc, &config);
|
||||
if(err != ERR_NO_ERROR){
|
||||
@@ -16557,6 +16559,11 @@ void SmSaveKeyPairDlgInit(HWND hWnd, SM_SAVE_KEY_PAIR *s)
|
||||
Check(hWnd, R_X509_AND_KEY, true);
|
||||
}
|
||||
|
||||
if (MsIsWine())
|
||||
{
|
||||
Disable(hWnd, R_SECURE);
|
||||
}
|
||||
|
||||
SmSaveKeyPairDlgUpdate(hWnd, s);
|
||||
}
|
||||
|
||||
@@ -17006,6 +17013,7 @@ void SmSslDlgInit(HWND hWnd, SM_SSL *s)
|
||||
|
||||
// Set the encryption algorithm list
|
||||
cipher_list = GetCipherList();
|
||||
SetFont(hWnd, C_CIPHER, GetFont("Tahoma", 8, false, false, false, false));
|
||||
CbSetHeight(hWnd, C_CIPHER, 18);
|
||||
for (i = 0;i < cipher_list->NumTokens;i++)
|
||||
{
|
||||
@@ -19350,8 +19358,13 @@ ENTER_PASSWORD:
|
||||
Enable(hWnd, IDOK);
|
||||
Enable(hWnd, B_ABOUT);
|
||||
Enable(hWnd, IDCANCEL);
|
||||
Enable(hWnd, B_SECURE_MANAGER);
|
||||
Enable(hWnd, B_SELECT_SECURE);
|
||||
|
||||
if (MsIsWine() == false)
|
||||
{
|
||||
Enable(hWnd, B_SECURE_MANAGER);
|
||||
Enable(hWnd, B_SELECT_SECURE);
|
||||
}
|
||||
|
||||
Enable(hWnd, B_CERT_TOOL);
|
||||
}
|
||||
|
||||
@@ -20150,6 +20163,12 @@ void SmMainDlgInit(HWND hWnd)
|
||||
|
||||
DlgFont(hWnd, IDOK, 10, true);
|
||||
|
||||
if (MsIsWine())
|
||||
{
|
||||
Disable(hWnd, B_SECURE_MANAGER);
|
||||
Disable(hWnd, B_SELECT_SECURE);
|
||||
}
|
||||
|
||||
Focus(hWnd, L_SETTING);
|
||||
|
||||
SmMainDlgUpdate(hWnd);
|
||||
@@ -20479,6 +20498,8 @@ void SmMainDlg()
|
||||
// Server Manager main process
|
||||
void MainSM()
|
||||
{
|
||||
// MsgBoxEx(NULL, 0, L"MsIsWine: %u\n", MsIsWine());
|
||||
|
||||
if (sm->TempSetting == NULL)
|
||||
{
|
||||
// Open the main window
|
||||
@@ -20677,7 +20698,3 @@ void SMExec()
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -119,7 +119,3 @@ void SMExec();
|
||||
#endif // SM_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+11
-15
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -112,18 +112,18 @@
|
||||
// The internal header of SM.c
|
||||
|
||||
// Constants
|
||||
#define SM_REG_KEY "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager"
|
||||
#define SM_CERT_REG_KEY "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Cert Tool"
|
||||
#define SM_SETTING_REG_KEY "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings"
|
||||
#define SM_LASTHUB_REG_KEY "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Last HUB Name"
|
||||
#define SM_HIDE_CERT_UPDATE_MSG_KEY "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Hide Cert Update Msg"
|
||||
#define SM_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager"
|
||||
#define SM_CERT_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Cert Tool"
|
||||
#define SM_SETTING_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Settings"
|
||||
#define SM_LASTHUB_REG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Last HUB Name"
|
||||
#define SM_HIDE_CERT_UPDATE_MSG_KEY "Software\\SoftEther VPN Developer Edition\\SoftEther VPN\\Server Manager\\Hide Cert Update Msg"
|
||||
|
||||
#define NAME_OF_VPN_SERVER_MANAGER "vpnsmgr"
|
||||
#define NAME_OF_VPN_SERVER_TARGET "vpnserver@%s"
|
||||
#define NAME_OF_VPN_BRIDGE_TARGET "vpnbridge@%s"
|
||||
|
||||
// Constants (Old value)
|
||||
#define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\SoftEther VPN 2.0\\Server Manager\\Settings"
|
||||
#define SM_SETTING_REG_KEY_OLD "Software\\SoftEther Corporation\\PacketiX VPN\\Server Manager\\Settings"
|
||||
|
||||
// Connection setting
|
||||
typedef struct SETTING
|
||||
@@ -828,7 +828,3 @@ void SmProxyDlgInit(HWND hWnd, INTERNET_SETTING *t);
|
||||
void SmProxyDlgUpdate(HWND hWnd, INTERNET_SETTING *t);
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-30
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -4600,24 +4600,6 @@ UINT SwReady(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, WIZARD *wizard,
|
||||
break;
|
||||
|
||||
case WM_WIZ_NEXT:
|
||||
if (IsUseAlternativeHostname())
|
||||
{
|
||||
wchar_t src_dll1[MAX_PATH];
|
||||
wchar_t src_dll2[MAX_PATH];
|
||||
wchar_t *exe_dir = MsGetExeFileDirW();
|
||||
|
||||
CombinePathW(src_dll1, sizeof(src_dll1), exe_dir, VG_DLL_X86);
|
||||
CombinePathW(src_dll2, sizeof(src_dll2), exe_dir, VG_DLL_X64);
|
||||
|
||||
if (IsFileExistsW(src_dll1) || IsFileExistsW(src_dll2))
|
||||
{
|
||||
if (MsgBoxEx(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2,
|
||||
_UU("SW_VG_CONFIRM_MSG")) == IDNO)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return D_SW_PERFORM;
|
||||
|
||||
case WM_WIZ_BACK:
|
||||
@@ -5881,9 +5863,6 @@ void SwUiMain(SW *sw)
|
||||
GetCedarVersion(ver, sizeof(ver));
|
||||
UniFormat(verstr, sizeof(verstr), _UU("SW_TITLE"), ver);
|
||||
|
||||
// DO NOT REMOVE THIS INDICATION !!!
|
||||
UniStrCat(verstr, sizeof(verstr), L" - Customized Version");
|
||||
|
||||
w = NewWizard(ICO_SETUP, BMP_SELOGO49x49, verstr, sw);
|
||||
|
||||
w->CloseConfirmMsg = _UU("SW_EXIT_CONFIRM");
|
||||
@@ -6699,7 +6678,3 @@ UINT SWExecMain()
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -129,7 +129,3 @@ bool SwWaitForVpnClientPortReady(UINT timeout);
|
||||
#endif // SW_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -450,7 +450,3 @@ bool SwSfxCopyVgFiles(HWND hWnd, wchar_t *src, wchar_t *dst);
|
||||
#endif // SW_INNER_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+26
-11
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -211,7 +211,18 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
|
||||
AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData;
|
||||
if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0)
|
||||
{
|
||||
name = CopyStrToUni(username);
|
||||
if( IsEmptyStr(h->RadiusRealm) == false )
|
||||
{
|
||||
char name_and_realm[MAX_SIZE];
|
||||
StrCpy(name_and_realm, sizeof(name_and_realm), username);
|
||||
StrCat(name_and_realm, sizeof(name_and_realm), "@");
|
||||
StrCat(name_and_realm, sizeof(name_and_realm), h->RadiusRealm);
|
||||
name = CopyStrToUni(name_and_realm);
|
||||
}
|
||||
else
|
||||
{
|
||||
name = CopyStrToUni(username);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -267,7 +278,15 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
|
||||
// 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, opt);
|
||||
name, password, interval, mschap_v2_server_response_20, opt, hub->Name);
|
||||
|
||||
if (b)
|
||||
{
|
||||
if (opt != NULL)
|
||||
{
|
||||
opt->Out_IsRadiusLogin = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Lock(hub->lock);
|
||||
@@ -689,7 +708,3 @@ UINT SamGetUserAuthType(HUB *h, char *username)
|
||||
return authtype;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+5
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -130,7 +130,3 @@ X *GetIssuerFromList(LIST *cert_list, X *cert);
|
||||
|
||||
#endif // SAM_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+251
-17
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// SeLow: SoftEther Lightweight Network Protocol
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -126,6 +126,131 @@
|
||||
#include <Mayaqua/Mayaqua.h>
|
||||
#include <Cedar/Cedar.h>
|
||||
|
||||
// Load the drivers hive
|
||||
bool SuLoadDriversHive()
|
||||
{
|
||||
wchar_t config_dir[MAX_PATH];
|
||||
wchar_t filename[MAX_PATH];
|
||||
if (MsIsWindows10() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MsEnablePrivilege(SE_RESTORE_NAME, true);
|
||||
MsEnablePrivilege(SE_BACKUP_NAME, true);
|
||||
|
||||
CombinePathW(config_dir, sizeof(config_dir), MsGetSystem32DirW(), L"config");
|
||||
CombinePathW(filename, sizeof(filename), config_dir, L"DRIVERS");
|
||||
|
||||
return MsRegLoadHive(REG_LOCAL_MACHINE, L"DRIVERS", filename);
|
||||
}
|
||||
|
||||
// Unload the drivers hive
|
||||
bool SuUnloadDriversHive()
|
||||
{
|
||||
// todo: always failed.
|
||||
if (MsIsWindows10() == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return MsRegUnloadHive(REG_LOCAL_MACHINE, L"DRIVERS");
|
||||
}
|
||||
|
||||
// Delete garbage inf files
|
||||
void SuDeleteGarbageInfs()
|
||||
{
|
||||
void *wow;
|
||||
bool load_hive = false;
|
||||
Debug("SuDeleteGarbageInfs()\n");
|
||||
|
||||
wow = MsDisableWow64FileSystemRedirection();
|
||||
|
||||
load_hive = SuLoadDriversHive();
|
||||
Debug("SuLoadDriversHive: %u\n", load_hive);
|
||||
|
||||
SuDeleteGarbageInfsInner();
|
||||
|
||||
/*
|
||||
if (load_hive)
|
||||
{
|
||||
Debug("SuUnloadDriversHive: %u\n", SuUnloadDriversHive());
|
||||
}*/
|
||||
|
||||
MsRestoreWow64FileSystemRedirection(wow);
|
||||
}
|
||||
void SuDeleteGarbageInfsInner()
|
||||
{
|
||||
char *base_key_name = "DRIVERS\\DriverDatabase\\DriverPackages";
|
||||
TOKEN_LIST *keys;
|
||||
HINSTANCE hSetupApiDll = NULL;
|
||||
BOOL (WINAPI *_SetupUninstallOEMInfA)(PCSTR, DWORD, PVOID) = NULL;
|
||||
|
||||
if (MsIsWindows10() == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hSetupApiDll = LoadLibraryA("setupapi.dll");
|
||||
if (hSetupApiDll == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_SetupUninstallOEMInfA =
|
||||
(UINT (__stdcall *)(PCSTR,DWORD,PVOID))
|
||||
GetProcAddress(hSetupApiDll, "SetupUninstallOEMInfA");
|
||||
|
||||
if (_SetupUninstallOEMInfA != NULL)
|
||||
{
|
||||
keys = MsRegEnumKeyEx2(REG_LOCAL_MACHINE, base_key_name, false, true);
|
||||
|
||||
if (keys != NULL)
|
||||
{
|
||||
char full_key[MAX_PATH];
|
||||
UINT i;
|
||||
|
||||
for (i = 0;i < keys->NumTokens;i++)
|
||||
{
|
||||
char *oem_name, *inf_name, *provider;
|
||||
|
||||
Format(full_key, sizeof(full_key), "%s\\%s", base_key_name, keys->Token[i]);
|
||||
|
||||
oem_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "", false, true);
|
||||
inf_name = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "InfName", false, true);
|
||||
provider = MsRegReadStrEx2(REG_LOCAL_MACHINE, full_key, "Provider", false, true);
|
||||
|
||||
if (IsEmptyStr(oem_name) == false && IsEmptyStr(inf_name) == false)
|
||||
{
|
||||
if (StartWith(oem_name, "oem"))
|
||||
{
|
||||
if (StartWith(inf_name, "selow"))
|
||||
{
|
||||
if (InStr(provider, "softether"))
|
||||
{
|
||||
Debug("Delete OEM INF %s (%s): %u\n",
|
||||
oem_name, inf_name,
|
||||
_SetupUninstallOEMInfA(oem_name, 0x00000001, NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Free(oem_name);
|
||||
Free(inf_name);
|
||||
Free(provider);
|
||||
}
|
||||
|
||||
FreeToken(keys);
|
||||
}
|
||||
}
|
||||
|
||||
if (hSetupApiDll != NULL)
|
||||
{
|
||||
FreeLibrary(hSetupApiDll);
|
||||
}
|
||||
}
|
||||
|
||||
// Install the driver
|
||||
bool SuInstallDriver(bool force)
|
||||
{
|
||||
@@ -175,11 +300,13 @@ bool SuInstallDriverInner(bool force)
|
||||
char *path;
|
||||
|
||||
// Read the current version from the registry
|
||||
current_sl_ver = MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, SL_REG_VER_VALUE, false, true);
|
||||
current_sl_ver = MsRegReadIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME,
|
||||
(MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE),
|
||||
false, true);
|
||||
|
||||
path = MsRegReadStrEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "ImagePath", false, true);
|
||||
|
||||
if (IsEmptyStr(path))
|
||||
if (IsEmptyStr(path) || IsFileExists(path) == false || MsIsServiceInstalled(SL_PROTOCOL_NAME) == false)
|
||||
{
|
||||
current_sl_ver = 0;
|
||||
}
|
||||
@@ -195,12 +322,34 @@ bool SuInstallDriverInner(bool force)
|
||||
}
|
||||
|
||||
// Copy necessary files to a temporary directory
|
||||
UniFormat(src_sys, sizeof(src_sys), L"|SeLow_%S.sys", cpu_type);
|
||||
UniFormat(src_cat, sizeof(src_cat), L"|inf\\selow_%S\\inf.cat", cpu_type);
|
||||
UniFormat(src_inf, sizeof(src_inf), L"|inf\\selow_%S\\SeLow_%S.inf", cpu_type, cpu_type);
|
||||
UniFormat(src_sys, sizeof(src_sys), L"|DriverPackages\\%S\\%S\\SeLow_%S.sys",
|
||||
(MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"),
|
||||
cpu_type, cpu_type);
|
||||
if (MsIsWindows8() == false)
|
||||
{
|
||||
// Windows Vista and Windows 7 uses SHA-1 catalog files
|
||||
UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf.cat", cpu_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 8 or above uses SHA-256 catalog files
|
||||
UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win8\\%S\\inf2.cat", cpu_type);
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
// Windows 10 uses WHQL catalog files
|
||||
UniFormat(src_cat, sizeof(src_cat), L"|DriverPackages\\SeLow_Win10\\%S\\SeLow_Win10_%S.cat", cpu_type, cpu_type);
|
||||
}
|
||||
}
|
||||
UniFormat(src_inf, sizeof(src_inf), L"|DriverPackages\\%S\\%S\\SeLow_%S.inf",
|
||||
(MsIsWindows10() ? "SeLow_Win10" : "SeLow_Win8"),
|
||||
cpu_type, cpu_type);
|
||||
|
||||
UniFormat(dst_sys, sizeof(dst_cat), L"%s\\SeLow_%S.sys", tmp_dir, cpu_type);
|
||||
UniFormat(dst_cat, sizeof(dst_cat), L"%s\\inf_selow.cat", tmp_dir);
|
||||
UniFormat(dst_cat, sizeof(dst_cat), L"%s\\SeLow_%S_%S.cat", tmp_dir,
|
||||
(MsIsWindows10() ? "Win10" : "Win8"),
|
||||
cpu_type);
|
||||
|
||||
UniFormat(dst_inf, sizeof(dst_inf), L"%s\\SeLow_%S.inf", tmp_dir, cpu_type);
|
||||
|
||||
if (FileCopyW(src_sys, dst_sys) &&
|
||||
@@ -211,6 +360,21 @@ bool SuInstallDriverInner(bool force)
|
||||
|
||||
nw = MsInitNoWarningEx(SL_USER_AUTO_PUSH_TIMER);
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
if (MsIsServiceInstalled(SL_PROTOCOL_NAME) == false && MsIsServiceRunning(SL_PROTOCOL_NAME) == false)
|
||||
{
|
||||
// On Windows 10, if there are no SwLow service installed, then uinstall the protocol driver first.
|
||||
// TODO: currently do nothing. On some versions of Windows 10 beta builds it is necessary to do something...
|
||||
}
|
||||
}
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
// Delete garbage INFs
|
||||
SuDeleteGarbageInfs();
|
||||
}
|
||||
|
||||
// Call the installer
|
||||
if (InstallNdisProtocolDriver(dst_inf, L"SeLow", SL_USER_INSTALL_LOCK_TIMEOUT) == false)
|
||||
{
|
||||
@@ -221,12 +385,14 @@ bool SuInstallDriverInner(bool force)
|
||||
Debug("InstallNdisProtocolDriver Ok.\n");
|
||||
|
||||
// Copy manually because there are cases where .sys file is not copied successfully for some reason
|
||||
FileCopyW(src_sys, sys_fullpath);
|
||||
Debug("SuCopySysFile from %S to %s: ret = %u\n", src_sys, sys_fullpath, SuCopySysFile(src_sys, sys_fullpath));
|
||||
|
||||
ret = true;
|
||||
|
||||
// Write the version number into the registry
|
||||
MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, SL_REG_VER_VALUE, SL_VER, false, true);
|
||||
MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME,
|
||||
(MsIsWindows10() ? SL_REG_VER_VALUE_WIN10 : SL_REG_VER_VALUE),
|
||||
SL_VER, false, true);
|
||||
|
||||
// Set to automatic startup
|
||||
MsRegWriteIntEx2(REG_LOCAL_MACHINE, SL_REG_KEY_NAME, "Start", SERVICE_SYSTEM_START, false, true);
|
||||
@@ -248,6 +414,64 @@ bool SuInstallDriverInner(bool force)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Copy a sys file
|
||||
bool SuCopySysFile(wchar_t *src, wchar_t *dst)
|
||||
{
|
||||
wchar_t dst_rename[MAX_PATH];
|
||||
UINT i;
|
||||
if (src == NULL || dst == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (FileCopyW(src, dst))
|
||||
{
|
||||
for (i = 1;i <= 100;i++)
|
||||
{
|
||||
UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i);
|
||||
|
||||
FileDeleteW(dst_rename);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 1;;i++)
|
||||
{
|
||||
UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i);
|
||||
|
||||
if (IsFileExistsW(dst_rename) == false)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (i >= 100)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (MoveFileW(dst, dst_rename) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FileCopyW(src, dst))
|
||||
{
|
||||
for (i = 1;i <= 100;i++)
|
||||
{
|
||||
UniFormat(dst_rename, sizeof(dst_rename), L"%s.old%u", dst, i);
|
||||
|
||||
FileDeleteW(dst_rename);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MoveFileW(dst_rename, dst);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get whether the current OS is supported by SeLow
|
||||
bool SuIsSupportedOs(bool on_install)
|
||||
{
|
||||
@@ -738,6 +962,7 @@ SU *SuInitEx(UINT wait_for_bind_complete_tick)
|
||||
UINT read_size;
|
||||
bool flag = false;
|
||||
UINT64 giveup_tick = 0;
|
||||
static bool flag2 = false; // flag2 must be global
|
||||
|
||||
if (SuIsSupportedOs(false) == false)
|
||||
{
|
||||
@@ -761,6 +986,19 @@ LABEL_RETRY:
|
||||
if (MsStartService(SL_PROTOCOL_NAME) == false)
|
||||
{
|
||||
Debug("MsStartService(%s) Failed.\n", SL_PROTOCOL_NAME);
|
||||
|
||||
if (MsIsWindows10())
|
||||
{
|
||||
if (flag2 == false)
|
||||
{
|
||||
flag2 = true;
|
||||
|
||||
if (SuInstallDriver(true))
|
||||
{
|
||||
goto LABEL_RETRY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -845,7 +1083,3 @@ void SuFree(SU *u)
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
+11
-9
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// SeLow: SoftEther Lightweight Network Protocol
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -173,12 +173,14 @@ int SuCmpAdaterList(void *p1, void *p2);
|
||||
bool SuInstallDriver(bool force);
|
||||
bool SuInstallDriverInner(bool force);
|
||||
bool SuIsSupportedOs(bool on_install);
|
||||
bool SuCopySysFile(wchar_t *src, wchar_t *dst);
|
||||
|
||||
void SuDeleteGarbageInfs();
|
||||
void SuDeleteGarbageInfsInner();
|
||||
bool SuLoadDriversHive();
|
||||
bool SuUnloadDriversHive();
|
||||
|
||||
#endif // SELOWUSER_H
|
||||
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -114,7 +114,3 @@
|
||||
#include "CedarPch.h"
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -118,7 +118,3 @@
|
||||
#endif // SECUREINFO_H
|
||||
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -252,7 +252,3 @@ SNAT *SnNewSecureNAT(HUB *h, VH_OPTION *o)
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
// SoftEther VPN Source Code
|
||||
// SoftEther VPN Source Code - Developer Edition Master Branch
|
||||
// Cedar Communication Module
|
||||
//
|
||||
// SoftEther VPN Server, Client and Bridge are free software under GPLv2.
|
||||
//
|
||||
// Copyright (c) 2012-2014 Daiyuu Nobori.
|
||||
// Copyright (c) 2012-2014 SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) 2012-2014 SoftEther Corporation.
|
||||
// Copyright (c) Daiyuu Nobori.
|
||||
// Copyright (c) SoftEther VPN Project, University of Tsukuba, Japan.
|
||||
// Copyright (c) SoftEther Corporation.
|
||||
//
|
||||
// All Rights Reserved.
|
||||
//
|
||||
// http://www.softether.org/
|
||||
//
|
||||
// Author: Daiyuu Nobori
|
||||
// Author: Daiyuu Nobori, Ph.D.
|
||||
// Comments: Tetsuo Sugiyama, Ph.D.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@@ -132,7 +132,3 @@ void SnSecureNATThread(THREAD *t, void *param);
|
||||
|
||||
#endif // SECURENAT_H
|
||||
|
||||
|
||||
// Developed by SoftEther VPN Project at University of Tsukuba in Japan.
|
||||
// Department of Computer Science has dozens of overly-enthusiastic geeks.
|
||||
// Join us: http://www.tsukuba.ac.jp/english/admission/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user