mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
Compare commits
4 Commits
0639843809
...
7464e4d4cb
Author | SHA1 | Date | |
---|---|---|---|
|
7464e4d4cb | ||
|
c2a7aa5481 | ||
|
6f57449164 | ||
|
9a7e55b3e0 |
19
.github/workflows/build_source_release.yml
vendored
19
.github/workflows/build_source_release.yml
vendored
@ -8,15 +8,16 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v1
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: archive
|
- name: Archive
|
||||||
id: archive
|
id: archive
|
||||||
run: |
|
run: |
|
||||||
VERSION=${{ github.event.release.tag_name }}
|
VERSION=${{ github.event.release.tag_name }}
|
||||||
@ -28,12 +29,8 @@ jobs:
|
|||||||
tar cJf $TARBALL $PKGNAME
|
tar cJf $TARBALL $PKGNAME
|
||||||
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
|
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: upload tarball
|
- name: Upload tarball
|
||||||
uses: actions/upload-release-asset@v1
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ github.event.release.upload_url }}
|
files: ./${{ steps.archive.outputs.tarball }}
|
||||||
asset_path: ./${{ steps.archive.outputs.tarball }}
|
name: ${{ steps.archive.outputs.tarball }}
|
||||||
asset_name: ${{ steps.archive.outputs.tarball }}
|
|
||||||
asset_content_type: application/gzip
|
|
||||||
|
13
.github/workflows/coverity.yml
vendored
13
.github/workflows/coverity.yml
vendored
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
name: Coverity
|
name: Coverity
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@ -10,28 +9,36 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
scan:
|
scan:
|
||||||
|
name: Scan
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ github.repository_owner == 'SoftEtherVPN' }}
|
if: github.repository_owner == 'SoftEtherVPN'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Install apt dependencies
|
- name: Install apt dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev libsodium-dev
|
sudo apt-get install -y cmake gcc g++ libncurses5-dev libreadline-dev libssl-dev make zlib1g-dev libsodium-dev
|
||||||
|
|
||||||
- name: Download Coverity build tool
|
- name: Download Coverity build tool
|
||||||
run: |
|
run: |
|
||||||
wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=SoftEtherVPN%2FSoftEtherVPN" -O coverity_tool.tar.gz
|
wget -c -N https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=SoftEtherVPN%2FSoftEtherVPN" -O coverity_tool.tar.gz
|
||||||
mkdir coverity_tool
|
mkdir coverity_tool
|
||||||
tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool
|
tar xzf coverity_tool.tar.gz --strip 1 -C coverity_tool
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
./configure
|
./configure
|
||||||
|
|
||||||
- name: Build with Coverity build tool
|
- name: Build with Coverity build tool
|
||||||
run: |
|
run: |
|
||||||
export PATH=`pwd`/coverity_tool/bin:$PATH
|
export PATH=`pwd`/coverity_tool/bin:$PATH
|
||||||
cov-build --dir cov-int make -C build
|
cov-build --dir cov-int make -C build
|
||||||
|
|
||||||
- name: Submit build result to Coverity Scan
|
- name: Submit build result to Coverity Scan
|
||||||
run: |
|
run: |
|
||||||
tar czvf cov.tar.gz cov-int
|
tar czvf cov.tar.gz cov-int
|
||||||
|
11
.github/workflows/fedora-rawhide.yml
vendored
11
.github/workflows/fedora-rawhide.yml
vendored
@ -19,15 +19,18 @@ jobs:
|
|||||||
container:
|
container:
|
||||||
image: fedora:rawhide
|
image: fedora:rawhide
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang
|
dnf -y install git cmake ncurses-devel openssl-devel libsodium-devel readline-devel zlib-devel gcc-c++ clang
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
- name: Compile with ${{ matrix.cc }}
|
- name: Compile with ${{ matrix.cc }}
|
||||||
run: |
|
run: |
|
||||||
export CC=${{ matrix.cc }}
|
export CC=${{ matrix.cc }}
|
||||||
./configure
|
./configure
|
||||||
make -C build
|
make -C build
|
||||||
|
|
||||||
|
5
.github/workflows/linux.yml
vendored
5
.github/workflows/linux.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
name: Linux
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@ -5,14 +6,16 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_and_test:
|
build_and_test:
|
||||||
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: sudo apt update && sudo apt-get -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libsodium-dev libssl-dev make zlib1g-dev liblz4-dev libnl-genl-3-dev
|
run: sudo apt-get update && sudo apt-get -y install cmake gcc g++ ninja-build libncurses5-dev libreadline-dev libsodium-dev libssl-dev make zlib1g-dev liblz4-dev libnl-genl-3-dev
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
|
8
.github/workflows/macos.yml
vendored
8
.github/workflows/macos.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
name: macOS
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@ -11,18 +12,21 @@ jobs:
|
|||||||
name: ${{ matrix.os }}
|
name: ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
brew install libsodium
|
brew install libsodium
|
||||||
|
|
||||||
- name: Compile
|
- name: Compile
|
||||||
run: |
|
run: |
|
||||||
./configure
|
./configure
|
||||||
make -C build
|
make -C build
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: |
|
run: |
|
||||||
otool -L build/vpnserver
|
otool -L build/vpnserver
|
||||||
.ci/memory-leak-test.sh
|
.ci/memory-leak-test.sh
|
||||||
|
|
||||||
|
23
.github/workflows/musl.yml
vendored
23
.github/workflows/musl.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: alpine/musl
|
name: Alpine/musl
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
@ -7,17 +7,22 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
musl:
|
musl:
|
||||||
name: gcc
|
name: gcc
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: apk add binutils --no-cache build-base readline-dev openssl-dev ncurses-dev git cmake zlib-dev libsodium-dev gnu-libiconv
|
run: apk add binutils --no-cache build-base readline-dev openssl-dev ncurses-dev git cmake zlib-dev libsodium-dev gnu-libiconv
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: ./configure
|
run: ./configure
|
||||||
|
|
||||||
- name: make
|
- name: make
|
||||||
run: make -C build
|
run: make -C build
|
7
.github/workflows/stb_check.yml
vendored
7
.github/workflows/stb_check.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
name: STB Check
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@ -5,11 +6,15 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
name: Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Check
|
- name: Check
|
||||||
run: |
|
run: |
|
||||||
cd developer_tools/stbchecker
|
cd developer_tools/stbchecker
|
||||||
|
17
.github/workflows/windows.yml
vendored
17
.github/workflows/windows.yml
vendored
@ -1,3 +1,4 @@
|
|||||||
|
name: Windows
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@ -14,19 +15,24 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
name: ${{ matrix.platform.ARCHITECTURE }}
|
name: ${{ matrix.platform.ARCHITECTURE }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Cache vcpkg
|
- name: Cache vcpkg
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: 'build/vcpkg_installed/'
|
path: 'build/vcpkg_installed/'
|
||||||
key: vcpkg-${{ matrix.platform.VCPKG_TRIPLET }}
|
key: vcpkg-${{ matrix.platform.VCPKG_TRIPLET }}
|
||||||
|
|
||||||
- name: Set version variables
|
- name: Set version variables
|
||||||
run: |
|
run: |
|
||||||
$v = python version.py
|
$v = python version.py
|
||||||
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
|
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
|
||||||
@ -44,11 +50,14 @@ jobs:
|
|||||||
vpnsetup /SFXMODE:vpnclient /SFXOUT:"installers\softether-vpnclient-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
vpnsetup /SFXMODE:vpnclient /SFXOUT:"installers\softether-vpnclient-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||||
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
. .ci/appveyor-vpntest.ps1
|
. .ci/appveyor-vpntest.ps1
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
|
- name: Upload built binaries
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
name: Binaries-${{ matrix.platform.ARCHITECTURE }}
|
name: Binaries-${{ matrix.platform.ARCHITECTURE }}
|
||||||
@ -56,7 +65,9 @@ jobs:
|
|||||||
build/*.exe
|
build/*.exe
|
||||||
build/*.pdb
|
build/*.pdb
|
||||||
build/*.se2
|
build/*.se2
|
||||||
- uses: actions/upload-artifact@v4
|
|
||||||
|
- name: Upload installers
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
name: Installers-${{ matrix.platform.ARCHITECTURE }}
|
name: Installers-${{ matrix.platform.ARCHITECTURE }}
|
||||||
|
35
.github/workflows/windows_release.yml
vendored
35
.github/workflows/windows_release.yml
vendored
@ -14,16 +14,19 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
name: Release
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
outputs:
|
outputs:
|
||||||
upload_url: "${{ steps.create_release.outputs.upload_url }}"
|
upload_url: "${{ steps.create_release.outputs.upload_url }}"
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: "Checkout repository"
|
- name: "Checkout repository"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: "Create GitHub release"
|
- name: "Create GitHub release"
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
name: ${{ matrix.platform.ARCHITECTURE }}
|
name: ${{ matrix.platform.ARCHITECTURE }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@ -35,15 +38,18 @@ jobs:
|
|||||||
{ 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"}
|
{ 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"}
|
||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: "Checkout repository"
|
- name: "Checkout repository"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Cache vcpkg
|
- name: Cache vcpkg
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: 'build/vcpkg_installed/'
|
path: 'build/vcpkg_installed/'
|
||||||
key: vcpkg-release-${{ matrix.platform.VCPKG_TRIPLET }}
|
key: vcpkg-release-${{ matrix.platform.VCPKG_TRIPLET }}
|
||||||
|
|
||||||
- name: Set version variables
|
- name: Set version variables
|
||||||
run: |
|
run: |
|
||||||
$b=(Get-Content CMakeSettings.json | Out-String | ConvertFrom-Json).environments.BuildNumber
|
$b=(Get-Content CMakeSettings.json | Out-String | ConvertFrom-Json).environments.BuildNumber
|
||||||
@ -51,6 +57,7 @@ jobs:
|
|||||||
$v = python version.py
|
$v = python version.py
|
||||||
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
|
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
|
||||||
@ -68,27 +75,19 @@ jobs:
|
|||||||
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
vpnsetup /SFXMODE:vpnserver_vpnbridge /SFXOUT:"installers\softether-vpnserver_vpnbridge-%VERSION%.%BUILD_NUMBER%.%ARCHITECTURE%.exe"
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
||||||
- name: dir
|
- name: Show directory items
|
||||||
run: |
|
run: |
|
||||||
Get-ChildItem -Recurse build/installers
|
Get-ChildItem -Recurse build/installers
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
- name: "Upload softether-vpnclient"
|
- name: "Upload softether-vpnclient"
|
||||||
uses: actions/upload-release-asset@v1
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{ github.token }}"
|
|
||||||
with:
|
with:
|
||||||
upload_url: "${{ needs.release.outputs.upload_url }}"
|
files: "build/installers/softether-vpnclient-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
||||||
asset_path: "build/installers/softether-vpnclient-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
name: "softether-vpnclient-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
||||||
asset_name: "softether-vpnclient-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
|
||||||
asset_content_type: "application/octet-stream"
|
|
||||||
- name: "Upload softether-vpnserver_vpnbridge"
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: "${{ github.token }}"
|
|
||||||
with:
|
|
||||||
upload_url: "${{ needs.release.outputs.upload_url }}"
|
|
||||||
asset_path: "build/installers/softether-vpnserver_vpnbridge-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
|
||||||
asset_name: "softether-vpnserver_vpnbridge-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
|
||||||
asset_content_type: "application/octet-stream"
|
|
||||||
|
|
||||||
|
- name: "Upload softether-vpnserver_vpnbridge"
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: "build/installers/softether-vpnserver_vpnbridge-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
||||||
|
name: "softether-vpnserver_vpnbridge-${{ env.VERSION }}.${{ env.BUILD_NUMBER }}.${{ matrix.platform.ARCHITECTURE }}.exe"
|
||||||
|
@ -463,39 +463,13 @@ void ProcIPsecEspPacketRecv(IKE_SERVER *ike, UDPPACKET *p)
|
|||||||
seq = READ_UINT(src + sizeof(UINT));
|
seq = READ_UINT(src + sizeof(UINT));
|
||||||
|
|
||||||
// Search and retrieve the IPsec SA from SPI
|
// Search and retrieve the IPsec SA from SPI
|
||||||
|
|
||||||
|
// thank to @phillibert report, responding to bad SA might lead to amplification
|
||||||
|
// according to RFC4303 we should drop such packets
|
||||||
|
|
||||||
ipsec_sa = SearchClientToServerIPsecSaBySpi(ike, spi);
|
ipsec_sa = SearchClientToServerIPsecSaBySpi(ike, spi);
|
||||||
if (ipsec_sa == NULL)
|
if (ipsec_sa == NULL)
|
||||||
{
|
{
|
||||||
// Invalid SPI
|
|
||||||
UINT64 init_cookie = Rand64();
|
|
||||||
UINT64 resp_cookie = 0;
|
|
||||||
IKE_CLIENT *c = NULL;
|
|
||||||
IKE_CLIENT t;
|
|
||||||
|
|
||||||
|
|
||||||
Copy(&t.ClientIP, &p->SrcIP, sizeof(IP));
|
|
||||||
t.ClientPort = p->SrcPort;
|
|
||||||
Copy(&t.ServerIP, &p->DstIP, sizeof(IP));
|
|
||||||
t.ServerPort = p->DestPort;
|
|
||||||
t.CurrentIkeSa = NULL;
|
|
||||||
|
|
||||||
if (p->DestPort == IPSEC_PORT_IPSEC_ESP_RAW)
|
|
||||||
{
|
|
||||||
t.ClientPort = t.ServerPort = IPSEC_PORT_IPSEC_ISAKMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
c = Search(ike->ClientList, &t);
|
|
||||||
|
|
||||||
if (c != NULL && c->CurrentIkeSa != NULL)
|
|
||||||
{
|
|
||||||
init_cookie = c->CurrentIkeSa->InitiatorCookie;
|
|
||||||
resp_cookie = c->CurrentIkeSa->ResponderCookie;
|
|
||||||
}
|
|
||||||
|
|
||||||
SendInformationalExchangePacketEx(ike, (c == NULL ? &t : c), IkeNewNoticeErrorInvalidSpiPayload(spi), false,
|
|
||||||
init_cookie, resp_cookie);
|
|
||||||
|
|
||||||
SendDeleteIPsecSaPacket(ike, (c == NULL ? &t : c), spi);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user