1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 00:04:57 +03:00

17 Commits

Author SHA1 Message Date
cd86bd810d Merge pull request #1983 from chipitsine/master
cleanup deprecated CI
2024-04-17 09:29:16 +02:00
831905d281 doc: remove badges of deprecated CI 2024-04-17 09:18:00 +02:00
5ee8e3f00c CI: cleanup azure pipeline helpers 2024-04-17 09:10:07 +02:00
2f9f157a1e Merge pull request #1982 from chipitsine/master
simplify windows CI, create windows installer automatically on release
2024-04-17 08:32:17 +02:00
5cf45ad62b Merge pull request #1981 from hiura2023/master
Fix 'RemoveDefGwOnDhcpForLocalhost' function No.2: Change the minimum size of DHCP reply
2024-04-16 22:31:21 +02:00
c838ba0009 CI: create windows installer on release 2024-04-16 22:26:51 +02:00
9982e128ef CI: simplify GHA windows workflow 2024-04-16 22:26:00 +02:00
ac28302b59 Merge branch 'SoftEtherVPN:master' into master 2024-04-16 19:16:20 +09:00
9a009d750a Use macro 'MAX' instead of 'max' 2024-04-16 19:14:44 +09:00
c36d7187a8 Fix 'RemoveDefGwOnDhcpForLocalhost' function No.2: Change the minimum size of DHCP reply 2024-04-16 10:30:10 +09:00
465df16505 Merge pull request #1980 from Alexey-I/master
OpenVPN certificate authorization with cn_username in 'email' format
2024-04-14 10:58:27 +02:00
723d8e0682 Merge pull request #1979 from chipitsine/master
CI: drop app veyor in favour of GHA
2024-04-14 10:37:35 +02:00
6582955cfa Update src/Cedar/Protocol.c
Co-authored-by: Davide Beatrici <github@davidebeatrici.dev>
2024-04-14 10:36:55 +02:00
71d71e51db OpenVPN certificate authorization with cn_username in 'email' format 2024-04-12 23:08:24 +05:00
74ea87d725 CI: drop app veyor in favour of GHA 2024-04-12 12:44:19 +02:00
ca832a9cef Merge pull request #1977 from chipitsine/master
CI: move linux builds to GHA, drop ADO
2024-04-10 21:33:16 +02:00
23e9f74e7e CI: move linux builds to GHA, drop ADO 2024-04-07 17:16:45 +02:00
15 changed files with 164 additions and 207 deletions

View File

@ -1,33 +0,0 @@
version: '{build}'
image: Ubuntu2004
configuration: Release
skip_branch_with_pr: true
clone_depth: 1
skip_commits:
files:
- .travis.yml
- .gitlab-ci.yml
- .azure-pipelines.yml
- .cirrus.yml
init:
- ps: Update-AppveyorBuild -Version "build-$env:APPVEYOR_BUILD_NUMBER-$($env:APPVEYOR_REPO_COMMIT.substring(0,7))"
install:
- sudo apt-get -y install libsodium-dev libcap-ng-dev
before_build:
- git submodule update --init --recursive
- ./configure
build_script:
- make package -C build -j $(nproc || sysctl -n hw.ncpu || echo 4)
- .ci/memory-leak-test.sh
test_script:
- .ci/appveyor-deb-install-test.sh
- sudo apt-get update && sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip liblz4-dev libnl-genl-3-dev # openvpn build deps
- sudo .ci/start-se-openvpn.sh
- sudo .ci/run-openvpn-tests.sh

View File

@ -1,4 +0,0 @@
jobs:
- template: .ci/azure-pipelines/linux.yml
- template: .ci/azure-pipelines/windows.yml
- template: .ci/azure-pipelines/macos.yml

View File

@ -1,20 +0,0 @@
jobs:
- job: Ubuntu_x64
pool:
vmImage: ubuntu-22.04
steps:
- checkout: self
submodules: true
persistCredentials: true
- script: 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
displayName: 'Prepare environment'
- script: "$(Build.SourcesDirectory)/.ci/azure-pipelines/linux_build.sh"
env:
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
displayName: 'Build'
- script: |
.ci/appveyor-deb-install-test.sh
sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip libcap-ng-dev # To build OpenVPN
sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/start-se-openvpn.sh
sudo BUILD_BINARIESDIRECTORY=$BUILD_BINARIESDIRECTORY .ci/run-openvpn-tests.sh
displayName: 'Test'

View File

@ -1,15 +0,0 @@
#!/bin/bash
if [[ "${#SE_BUILD_NUMBER_TOKEN}" -eq 64 ]]; then
VERSION=$(python3 "version.py")
BUILD_NUMBER=$(curl "https://softether.network/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${SE_BUILD_NUMBER_TOKEN}")
else
BUILD_NUMBER=0
fi
cd ${BUILD_BINARIESDIRECTORY}
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_NUMBER=${BUILD_NUMBER} ${BUILD_SOURCESDIRECTORY}
cmake --build .
cpack -C Release -G DEB

View File

@ -1,14 +0,0 @@
jobs:
- job: macOS
pool:
vmImage: macOS-latest
steps:
- checkout: self
submodules: true
persistCredentials: true
- script: brew install pkg-config cmake ninja ncurses readline libsodium openssl zlib
displayName: 'Prepare environment'
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/macos_build.sh'
env:
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
displayName: 'Build'

View File

@ -1,13 +0,0 @@
#!/bin/bash
if [[ "${#SE_BUILD_NUMBER_TOKEN}" -eq 64 ]]; then
VERSION=$(python3 "version.py")
BUILD_NUMBER=$(curl "https://softether.network/get-build-number?commit=${BUILD_SOURCEVERSION}&version=${VERSION}&token=${SE_BUILD_NUMBER_TOKEN}")
else
BUILD_NUMBER=0
fi
cd ${BUILD_BINARIESDIRECTORY}
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_NUMBER=${BUILD_NUMBER} -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" ${BUILD_SOURCESDIRECTORY}
cmake --build .

View File

@ -1,41 +0,0 @@
parameters:
- name: architecture
type: string
- name: compilerPath
type: string
- name: vcpkgTriplet
type: string
- name: vcvarsPath
type: string
steps:
- task: Cache@2
inputs:
key: '"vcpkg-manifest" | "$(Agent.OS)" | "${{parameters.vcpkgTriplet}}" | C:/vcpkg/.git/refs/heads/master'
path: '$(Build.BinariesDirectory)/vcpkg_installed'
displayName: 'Environment storage'
- script: '$(Build.SourcesDirectory)/.ci/azure-pipelines/windows_build.bat'
env:
ARCHITECTURE: ${{parameters.architecture}}
COMPILER_PATH: ${{parameters.compilerPath}}
VCPKG_TRIPLET: ${{parameters.vcpkgTriplet}}
VCVARS_PATH: ${{parameters.vcvarsPath}}
SE_BUILD_NUMBER_TOKEN: $(BUILD_NUMBER_TOKEN)
displayName: 'Build'
- powershell: |
. .ci/appveyor-vpntest.ps1
displayName: 'Test'
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.BinariesDirectory)'
contents: '?(*.exe|*.se2|*.pdb)'
TargetFolder: '$(Build.StagingDirectory)/binaries/${{parameters.architecture}}'
flattenFolders: true
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.StagingDirectory)/binaries/${{parameters.architecture}}'
artifactName: 'Binaries_${{parameters.architecture}}'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.StagingDirectory)/installers'
artifactName: 'Installers'

View File

@ -1,27 +0,0 @@
jobs:
- job: Windows_x64
pool:
vmImage: windows-latest
steps:
- checkout: self
submodules: true
persistCredentials: true
- template: "windows-steps.yml"
parameters:
architecture: "x64"
compilerPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe"
vcpkgTriplet: "x64-windows-static"
vcvarsPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- job: Windows_x86
pool:
vmImage: windows-latest
steps:
- checkout: self
submodules: true
persistCredentials: true
- template: "windows-steps.yml"
parameters:
architecture: "x86"
compilerPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/Llvm/bin/clang-cl.exe"
vcpkgTriplet: "x86-windows-static"
vcvarsPath: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars32.bat"

View File

@ -1,33 +0,0 @@
@echo on
:: The method we use to store a command's output into a variable:
:: https://stackoverflow.com/a/6362922
for /f "tokens=* USEBACKQ" %%g in (`python "version.py"`) do (set "VERSION=%%g")
:: https://stackoverflow.com/a/8566001
echo %SE_BUILD_NUMBER_TOKEN%> "%tmp%\length.txt"
for %%? in ("%tmp%\length.txt") do ( set /A SE_BUILD_NUMBER_TOKEN_LENGTH=%%~z? - 2 )
if %SE_BUILD_NUMBER_TOKEN_LENGTH% equ 64 (
for /f "tokens=* USEBACKQ" %%g in (`curl "https://softether.network/get-build-number?commit=%BUILD_SOURCEVERSION%&version=%VERSION%&token=%SE_BUILD_NUMBER_TOKEN%"`) do (set "BUILD_NUMBER=%%g")
) else (
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%"
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"

34
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,34 @@
on: [push, pull_request]
permissions:
contents: read
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- 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
- name: Build
run: |
mkdir build
cd build
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build .
- name: Build deb packages
run: |
cd build
cpack -C Release -G DEB
- name: Test
run: |
.ci/appveyor-deb-install-test.sh
sudo apt-get -y install autoconf libtool liblzo2-dev libpam-dev fping unzip libcap-ng-dev # To build OpenVPN
sudo .ci/start-se-openvpn.sh
sudo .ci/run-openvpn-tests.sh

View File

@ -22,13 +22,28 @@ jobs:
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
run: |
$v = python version.py
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Build - name: Build
env: env:
ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }} ARCHITECTURE: ${{ matrix.platform.ARCHITECTURE }}
COMPILER_PATH: ${{ matrix.platform.COMPILER_PATH }} COMPILER_PATH: ${{ matrix.platform.COMPILER_PATH }}
VCPKG_TRIPLET: ${{ matrix.platform.VCPKG_TRIPLET }} VCPKG_TRIPLET: ${{ matrix.platform.VCPKG_TRIPLET }}
VCVARS_PATH: ${{ matrix.platform.VCVARS_PATH }} VCVARS_PATH: ${{ matrix.platform.VCVARS_PATH }}
run: .ci/azure-pipelines/windows_build.bat run: |
set BUILD_NUMBER=0
mkdir build
cd build
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% ..
cmake --build .
mkdir installers
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"
shell: cmd
- name: Test - name: Test
shell: powershell shell: powershell
run: | run: |

94
.github/workflows/windows_release.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: "Release"
on:
push:
tags:
- '*'
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
permissions:
contents: write
jobs:
release:
runs-on: windows-latest
outputs:
upload_url: "${{ steps.create_release.outputs.upload_url }}"
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Create GitHub release"
id: create_release
uses: softprops/action-gh-release@v1
build-windows:
name: ${{ matrix.platform.ARCHITECTURE }}
runs-on: windows-latest
needs: ["release"]
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"}
]
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
with:
submodules: true
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: 'build/vcpkg_installed/'
key: vcpkg-release-${{ matrix.platform.VCPKG_TRIPLET }}
- name: Set version variables
run: |
$b=(Get-Content CMakeSettings.json | Out-String | ConvertFrom-Json).environments.BuildNumber
echo "BUILD_NUMBER=$b" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
$v = python version.py
echo "VERSION=$v" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- 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: |
mkdir build
cd build
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% ..
cmake --build .
mkdir installers
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"
shell: cmd
- name: dir
run: |
Get-ChildItem -Recurse build/installers
shell: pwsh
- name: "Upload softether-vpnclient"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: "${{ github.token }}"
with:
upload_url: "${{ needs.release.outputs.upload_url }}"
asset_path: "build/installers/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"

View File

@ -2,10 +2,8 @@
||Badges| ||Badges|
|---|---| |---|---|
|AppVeyor|[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/softethervpn/softethervpn?branch=master&svg=true)](https://ci.appveyor.com/project/softethervpn/softethervpn) |
|GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)| |GitLab CI|[![GitLab CI build status](https://gitlab.com/SoftEther/SoftEtherVPN/badges/master/pipeline.svg)](https://gitlab.com/SoftEther/SoftEtherVPN/pipelines)|
|Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)| |Coverity Scan|[![Coverity Scan build status](https://scan.coverity.com/projects/16304/badge.svg)](https://scan.coverity.com/projects/softethervpn-softethervpn)|
|Azure Pipelines|[![Azure Pipelines build status for Nightly](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_apis/build/status/6?api-version=6.0-preview.1)](https://dev.azure.com/SoftEther-VPN/SoftEther%20VPN/_build?definitionId=6)|
|Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)| |Cirrus CI|[![Cirrus CI build status](https://api.cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN.svg)](https://cirrus-ci.com/github/SoftEtherVPN/SoftEtherVPN)|
- [SoftEther VPN](#softether-vpn) - [SoftEther VPN](#softether-vpn)

View File

@ -6773,7 +6773,6 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
p = NewPack(); p = NewPack();
PackAddStr(p, "method", "login"); PackAddStr(p, "method", "login");
PackAddStr(p, "hubname", hubname);
if (IsEmptyStr(username)) if (IsEmptyStr(username))
{ {
@ -6782,12 +6781,26 @@ PACK *PackLoginWithOpenVPNCertificate(char *hubname, char *username, X *x)
FreePack(p); FreePack(p);
return NULL; return NULL;
} }
UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName); UniToStr(cn_username, sizeof(cn_username), x->subject_name->CommonName);
if (strchr(cn_username, '@') != NULL)
{
PackAddStr(p, "username", strtok(cn_username, "@"));
PackAddStr(p, "hubname", strtok(NULL, ""));
}
else
{
PackAddStr(p, "username", cn_username); PackAddStr(p, "username", cn_username);
PackAddStr(p, "hubname", hubname);
}
} }
else else
{ {
PackAddStr(p, "username", username); PackAddStr(p, "username", username);
PackAddStr(p, "hubname", hubname);
} }
PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT); PackAddInt(p, "authtype", AUTHTYPE_OPENVPN_CERT);

View File

@ -4168,6 +4168,7 @@ BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size)
LIST *opt_list2 = NULL; LIST *opt_list2 = NULL;
UINT src_size = size; UINT src_size = size;
UINT i; UINT i;
UINT dhcp_min_size;
// Validate arguments // Validate arguments
if (m == NULL || data == NULL || size == 0) if (m == NULL || data == NULL || size == 0)
{ {
@ -4270,11 +4271,13 @@ BUF *DhcpModify(DHCP_MODIFY_OPTION *m, void *data, UINT size)
// Rewrite if anything changes. Do not rewrite if there is no change // Rewrite if anything changes. Do not rewrite if there is no change
ret_ok = true; ret_ok = true;
if (ret->Size < DHCP_MIN_SIZE) // If src_size is greater than DHCP_MIN_SIZE, then use the src_size as minimum size of DHCP.
dhcp_min_size = MAX(src_size, DHCP_MIN_SIZE);
if (ret->Size < dhcp_min_size)
{ {
// Padding // Padding
UCHAR *pad_buf; UCHAR *pad_buf;
UINT pad_size = DHCP_MIN_SIZE - ret->Size; UINT pad_size = dhcp_min_size - ret->Size;
pad_buf = ZeroMalloc(pad_size); pad_buf = ZeroMalloc(pad_size);