mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 17:39:53 +03:00
Compare commits
23 Commits
29197bda1a
...
5aa32d0ab9
Author | SHA1 | Date | |
---|---|---|---|
|
5aa32d0ab9 | ||
|
7b9fd5bdcd | ||
|
53b7db3578 | ||
|
4c1eeb717b | ||
|
7981e16e0b | ||
|
62e7f0ba8a | ||
|
2dbebe271d | ||
|
eb793dc257 | ||
|
97203568e7 | ||
|
9c0b5f7001 | ||
|
a39560749d | ||
|
495cddd518 | ||
|
0d9b4faae3 | ||
|
e8c14cba68 | ||
|
ff37c35cfa | ||
|
56c12de929 | ||
|
2789b16c12 | ||
|
f6c185f279 | ||
|
44821c7130 | ||
|
64cb8e1eff | ||
|
645d5ebb55 | ||
|
d6d0f2dadd | ||
|
68b72d8867 |
@ -14,6 +14,12 @@ if %SE_BUILD_NUMBER_TOKEN_LENGTH% equ 64 (
|
||||
set BUILD_NUMBER=0
|
||||
)
|
||||
|
||||
|
||||
if "%BUILD_BINARIESDIRECTORY%"=="" (set BUILD_BINARIESDIRECTORY=build)
|
||||
if "%BUILD_SOURCESDIRECTORY%"=="" (set BUILD_SOURCESDIRECTORY=%cd%)
|
||||
|
||||
if not exist %BUILD_BINARIESDIRECTORY% mkdir %BUILD_BINARIESDIRECTORY%
|
||||
|
||||
cd %BUILD_BINARIESDIRECTORY%
|
||||
|
||||
call "%VCVARS_PATH%"
|
||||
@ -21,6 +27,7 @@ call "%VCVARS_PATH%"
|
||||
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=%VCPKG_TRIPLET% -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER="%COMPILER_PATH%" -DCMAKE_CXX_COMPILER="%COMPILER_PATH%" -DBUILD_NUMBER=%BUILD_NUMBER% "%BUILD_SOURCESDIRECTORY%"
|
||||
cmake --build .
|
||||
|
||||
if "%BUILD_STAGINGDIRECTORY%"=="" (set BUILD_STAGINGDIRECTORY=%cd%)
|
||||
mkdir "%BUILD_STAGINGDIRECTORY%\installers"
|
||||
vpnsetup /SFXMODE:vpnclient /SFXOUT:"%BUILD_STAGINGDIRECTORY%\installers\softether-vpnclient-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"%BUILD_STAGINGDIRECTORY%\installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||
|
48
.github/workflows/windows.yml
vendored
Normal file
48
.github/workflows/windows.yml
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
on: [push, pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [
|
||||
{ ARCHITECTURE: x86, COMPILER_PATH: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/bin/clang-cl.exe", VCPKG_TRIPLET: "x86-windows-static", VCVARS_PATH: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars32.bat"},
|
||||
{ ARCHITECTURE: x64, COMPILER_PATH: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe", VCPKG_TRIPLET: "x64-windows-static", VCVARS_PATH: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"}
|
||||
]
|
||||
runs-on: windows-latest
|
||||
name: ${{ matrix.platform.ARCHITECTURE }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Cache vcpkg
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: 'build/vcpkg_installed/'
|
||||
key: vcpkg-${{ matrix.platform.VCPKG_TRIPLET }}
|
||||
- name: Build
|
||||
env:
|
||||
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
|
||||
COMPILER_PATH: ${{ matrix.platform.COMPILER_PATH }}
|
||||
VCPKG_TRIPLET: ${{ matrix.platform.VCPKG_TRIPLET }}
|
||||
VCVARS_PATH: ${{ matrix.platform.VCVARS_PATH }}
|
||||
run: .ci/azure-pipelines/windows_build.bat
|
||||
- name: Test
|
||||
shell: powershell
|
||||
run: |
|
||||
. .ci/appveyor-vpntest.ps1
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: Binaries-${{ matrix.platform.ARCHITECTURE }}
|
||||
path: |
|
||||
build/*.exe
|
||||
build/*.pdb
|
||||
build/*.se2
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
if-no-files-found: error
|
||||
name: Installers-${{ matrix.platform.ARCHITECTURE }}
|
||||
path: build/installers
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"cmake.configureOnOpen": false
|
||||
}
|
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10)
|
||||
set(BUILD_NUMBER CACHE STRING "The number of the current build.")
|
||||
|
||||
if ("${BUILD_NUMBER}" STREQUAL "")
|
||||
set(BUILD_NUMBER "5182")
|
||||
set(BUILD_NUMBER "5183")
|
||||
endif()
|
||||
|
||||
if (BUILD_NUMBER LESS 5180)
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"environments": [ { "BuildNumber": "5182" } ],
|
||||
"environments": [ { "BuildNumber": "5183" } ],
|
||||
"configurations": [
|
||||
{
|
||||
"name": "x64-native",
|
||||
|
@ -33,6 +33,7 @@ You need to install the following software to build SoftEther VPN for UNIX.
|
||||
|
||||
```bash
|
||||
sudo yum -y groupinstall "Development Tools"
|
||||
sudo yum -y install epel-release
|
||||
sudo yum -y install cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel
|
||||
```
|
||||
|
||||
|
@ -1161,7 +1161,8 @@ void Win32EthMakeCombinedName(char *dst, UINT dst_size, char *nicname, char *gui
|
||||
|
||||
if (IsEmptyStr(guid) == false)
|
||||
{
|
||||
Format(dst, dst_size, "%s (ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
||||
// Allow to combine "FriendlyName" consisting of a NULL character and ID.
|
||||
Format(dst, dst_size, "%s(ID=%010u)", nicname, Win32EthGenIdFromGuid(guid));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1185,18 +1186,19 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
||||
|
||||
len = StrLen(str);
|
||||
|
||||
if (len >= 16)
|
||||
// Allow to combine "FriendlyName" consisting of a NULL character and ID beginning with "(ID=".
|
||||
if (len >= 15)
|
||||
{
|
||||
StrCpy(id_str, sizeof(id_str), str + len - 16);
|
||||
StrCpy(id_str, sizeof(id_str), str + len - 15);
|
||||
|
||||
if (StartWith(id_str, " (ID="))
|
||||
if (StartWith(id_str, "(ID="))
|
||||
{
|
||||
if (EndWith(id_str, ")"))
|
||||
{
|
||||
char num[MAX_SIZE];
|
||||
|
||||
Zero(num, sizeof(num));
|
||||
StrCpy(num, sizeof(num), id_str + 5);
|
||||
StrCpy(num, sizeof(num), id_str + 4);
|
||||
|
||||
num[StrLen(num) - 1] = 0;
|
||||
|
||||
@ -1204,7 +1206,7 @@ UINT Win32EthGetNameAndIdFromCombinedName(char *name, UINT name_size, char *str)
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
name[len - 16] = 0;
|
||||
name[len - 15] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1346,6 +1348,8 @@ TOKEN_LIST *GetEthListEx(UINT *total_num_including_hidden, bool enum_normal, boo
|
||||
|
||||
Debug("%s - %s\n", a->Guid, a->Title);
|
||||
}
|
||||
// Make sure that "FriendlyName" does not cosist a NULL character.
|
||||
Debug("%s,- s=%d, t=%s, %s,\n", a->Guid, show, tmp, a->Title[0] == 0 ? "check=NG FriendlyName(Title) is NULL !" : "check=OK");
|
||||
}
|
||||
|
||||
*total_num_including_hidden = ret->NumTokens;
|
||||
@ -1405,7 +1409,7 @@ LIST *GetEthAdapterListInternal()
|
||||
UINT size;
|
||||
char *buf;
|
||||
UINT i, j;
|
||||
char *qos_tag = " (Microsoft's Packet Scheduler)";
|
||||
char *qos_tag = "(Microsoft's Packet Scheduler)"; // Allow to combine "FriendlyName" consisting of a NULL character and QOS tag.
|
||||
SU *su = NULL;
|
||||
LIST *su_adapter_list = NULL;
|
||||
|
||||
@ -1660,7 +1664,8 @@ ANSI_STR:
|
||||
}
|
||||
else
|
||||
{
|
||||
Format(tmp, sizeof(tmp), "%s (%u)", a->Title, k + 1);
|
||||
// Allow to combine "FriendlyName" consisting of a NULL character and SEQ number.
|
||||
Format(tmp, sizeof(tmp), "%s(%u)", a->Title, k + 1);
|
||||
}
|
||||
|
||||
ok = true;
|
||||
|
@ -753,11 +753,45 @@ LIST *SuGetAdapterList(SU *u)
|
||||
for (i = 0;i < u->AdapterInfoList.NumAdapters;i++)
|
||||
{
|
||||
SL_ADAPTER_INFO *info = &u->AdapterInfoList.Adapters[i];
|
||||
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
||||
|
||||
if (a != NULL)
|
||||
if (IsEmptyStr(info->FriendlyName))
|
||||
{
|
||||
Add(ret, a);
|
||||
// Some NetAdapterCx drivers doesn't report the FriendlyName in the kernel mode.
|
||||
// So we attempt to obtain the DriverDesc string from NetCfg registry key alternatively.
|
||||
char regkey[MAX_PATH] = {0};
|
||||
char tmp[MAX_PATH] = {0};
|
||||
char adapter_guid[MAX_PATH] = {0};
|
||||
|
||||
UniToStr(adapter_guid, sizeof(adapter_guid), info->AdapterId + StrLen(SL_ADAPTER_ID_PREFIX));
|
||||
|
||||
if (GetClassRegKeyWin32(regkey, sizeof(regkey), tmp, sizeof(tmp), adapter_guid))
|
||||
{
|
||||
char *driver_desc = MsRegReadStrEx2(REG_LOCAL_MACHINE, regkey, "DriverDesc", false, true);
|
||||
|
||||
if (driver_desc != NULL)
|
||||
{
|
||||
StrCpy(info->FriendlyName, sizeof(info->FriendlyName), driver_desc);
|
||||
Free(driver_desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
SU_ADAPTER_LIST *a = SuAdapterInfoToAdapterList(info);
|
||||
|
||||
char macstr[128] = {0};
|
||||
BinToStr(macstr, sizeof(macstr), info->MacAddress, sizeof(info->MacAddress));
|
||||
|
||||
if (a != NULL)
|
||||
{
|
||||
// Debug("SU: Adapter %u (OK): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
||||
|
||||
Add(ret, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Debug("SU: Adapter %u (NG): ID=%S, MAC=%s, FriendlyName=%s\n", i, info->AdapterId, macstr, info->FriendlyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -827,7 +861,8 @@ SU_ADAPTER_LIST *SuAdapterInfoToAdapterList(SL_ADAPTER_INFO *info)
|
||||
Copy(&t.Info, info, sizeof(SL_ADAPTER_INFO));
|
||||
|
||||
UniToStr(tmp, sizeof(tmp), info->AdapterId);
|
||||
if (IsEmptyStr(tmp) || IsEmptyStr(info->FriendlyName) || StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
||||
// Make the NIC appear in the "Local Bridge Settings" list regardless of a NULL character consisted in "FriendlyName".
|
||||
if (IsEmptyStr(tmp) || /* IsEmptyStr(info->FriendlyName) || */ StartWith(tmp, SL_ADAPTER_ID_PREFIX) == false)
|
||||
{
|
||||
// Name is invalid
|
||||
return NULL;
|
||||
|
@ -615,7 +615,7 @@ void SessionMain(SESSION *s)
|
||||
UINT max_conn = s->ClientOption->MaxConnection;
|
||||
|
||||
if ((s->CurrentConnectionEstablishTime +
|
||||
(UINT64)(s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2))
|
||||
(UINT64)(num_tcp_conn * s->ClientOption->AdditionalConnectionInterval * 1000 * 2 + CONNECTING_TIMEOUT * 2))
|
||||
<= Tick64())
|
||||
{
|
||||
if (s->ClientOption->BindLocalPort != 0 || num_tcp_conn == 0)
|
||||
|
@ -2124,6 +2124,24 @@ IO *FileOpenEx(char *name, bool write_mode, bool read_lock)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Replace the specified character in the string with a new character
|
||||
wchar_t *UniReplaceCharW(wchar_t *src, UINT size, wchar_t c, wchar_t newc) {
|
||||
if (src == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
for (; *src; src++, size -= sizeof(wchar_t)) {
|
||||
if (size < sizeof(wchar_t)) {
|
||||
break;
|
||||
}
|
||||
if (*src == c) {
|
||||
*src = newc;
|
||||
}
|
||||
}
|
||||
return (wchar_t *)src;
|
||||
}
|
||||
|
||||
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
||||
{
|
||||
wchar_t tmp[MAX_SIZE];
|
||||
@ -2140,9 +2158,12 @@ IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
|
||||
IO *o = ZeroMalloc(sizeof(IO));
|
||||
name++;
|
||||
UniStrCpy(o->NameW, sizeof(o->NameW), name);
|
||||
#ifdef OS_WIN32
|
||||
UniReplaceCharW(o->NameW, sizeof(o->NameW), L'\\', L'/'); // Path separator "/" is used.
|
||||
#endif // OS_WIN32
|
||||
UniToStr(o->Name, sizeof(o->Name), o->NameW);
|
||||
o->HamMode = true;
|
||||
o->HamBuf = ReadHamcoreW(name);
|
||||
o->HamBuf = ReadHamcoreW(o->NameW);
|
||||
if (o->HamBuf == NULL)
|
||||
{
|
||||
Free(o);
|
||||
|
@ -2568,6 +2568,7 @@ MS_ADAPTER_LIST *MsCreateAdapterListInnerExVista(bool no_info)
|
||||
UniStrCpy(a->TitleW, sizeof(a->TitleW), title);
|
||||
UniToStr(a->Title, sizeof(a->Title), title);
|
||||
a->Index = r->InterfaceIndex;
|
||||
a->MediaConnectState = r->MediaConnectState;
|
||||
a->Type = r->Type;
|
||||
a->Status = ConvertMidStatusVistaToXp(r->OperStatus);
|
||||
a->Mtu = r->Mtu;
|
||||
|
@ -281,6 +281,7 @@ typedef struct MS_ADAPTER
|
||||
char Title[MAX_PATH]; // Display name
|
||||
wchar_t TitleW[MAX_PATH]; // Display Name (Unicode)
|
||||
UINT Index; // Index
|
||||
UINT MediaConnectState; // Media Connect State
|
||||
UINT Type; // Type
|
||||
UINT Status; // Status
|
||||
UINT Mtu; // MTU
|
||||
|
@ -540,6 +540,13 @@ LIST *Win32GetNicList()
|
||||
|
||||
if (a->Type == 6 && a->AddressSize == 6)
|
||||
{
|
||||
// If the connection state of the interface is unknown, then exclude it.
|
||||
// Unknown means that the device is not plugged into the local host.
|
||||
if (a->MediaConnectState == MediaConnectStateUnknown)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NIC_ENTRY *e = ZeroMalloc(sizeof(NIC_ENTRY));
|
||||
|
||||
StrCpy(e->IfName, sizeof(e->IfName), a->Title);
|
||||
|
Loading…
Reference in New Issue
Block a user