Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dbosoft changes back into dbosoft-master #23

Merged
merged 32 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f876d3
Windows build for master branch (#8)
fw2568 Sep 9, 2022
8fa8522
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Oct 28, 2022
879a519
Update build-and-test.yml
fw2568 Oct 28, 2022
7d3df74
Update build-windows.yml
fw2568 Oct 28, 2022
abbf9bc
fix json inlining (#9)
fw2568 Oct 28, 2022
4171d35
remove pthreads code after build (#10)
fw2568 Nov 1, 2022
d0170ee
improved windows build workflow (#12)
fw2568 Nov 1, 2022
0278e8b
added TargetVersion for Analyze configurations (#11)
fw2568 Nov 2, 2022
faab3ef
Update README.rst
fw2568 Nov 2, 2022
8f437fd
driver branding (#13)
fw2568 Nov 2, 2022
f513cfc
Revert "driver branding (#13)" (#14)
fw2568 Nov 2, 2022
bc19d19
dbosoft branding (#15)
fw2568 Nov 2, 2022
bfd7edc
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Nov 2, 2022
26e4aa2
Update build-windows.yml (#16)
fw2568 Nov 4, 2022
78debae
fixed version variable (#17)
fw2568 Nov 4, 2022
eee1bd0
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Nov 7, 2022
6d3799a
Build with SSL enabled (#18)
fw2568 Nov 9, 2022
05b2d7a
OpenSSL DLLs are missing in build output (#19)
fw2568 Nov 10, 2022
29f81af
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Nov 20, 2022
ab08f09
fix BSOD in kernel driver (#20)
fw2568 Dec 5, 2022
89b5f25
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Dec 5, 2022
4dbf785
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Dec 9, 2022
bad136b
Driver: windows server 2016 compatibility (#21)
fw2568 Jan 5, 2023
11f45d8
Update build-windows.yml
fw2568 Mar 12, 2023
5274ab6
Merge branch 'master' into dbosoft-master
fw2568 Mar 12, 2023
4f700e9
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 Mar 31, 2023
9cec695
Merge branch 'openvswitch:master' into dbosoft-master
fw2568 May 15, 2023
3f2b1df
Merge branch 'dbosoft-master' into dbosoft-mods
fw2568 Feb 5, 2024
7f6f023
temp. disable SSL build
fw2568 Feb 5, 2024
23df7e2
disable parallel build on windows
fw2568 Feb 5, 2024
a42c8ee
Update build-windows.yml
fw2568 Feb 5, 2024
797ede1
Update build-windows.yml
fw2568 Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .ci/windows-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -o errexit
set -x

CFLAGS_FOR_OVS="-g -O2"
EXTRA_OPTS="--with-pthread=`realpath ./PTHREADS-BUILT | xargs cygpath -m`"

function configure_ovs()
{
./boot.sh
./configure CC="./build-aux/cccl" LD="`which link`" \
LIBS="-lws2_32 -lShlwapi -liphlpapi -lwbemuuid -lole32 -loleaut32" \
CFLAGS="${CFLAGS_FOR_OVS}" $* || { cat config.log; exit 1; }
}


OPTS="${EXTRA_OPTS} ${OPTS} $*"
configure_ovs $OPTS
make || { cat config.log; exit 1; }

if [ "$TESTSUITE" ]; then
if ! make check RECHECK=yes; then
# testsuite.log is necessary for debugging.
cat ./tests/testsuite.log
exit 1
fi
fi

exit 0
9 changes: 9 additions & 0 deletions .ci/windows-prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -ev

# clone and build pthreads4w
git clone https://git.code.sf.net/p/pthreads4w/code pthreads4w-code
cd pthreads4w-code
nmake all install
cd ..
rm -rf pthreads4w-code
100 changes: 100 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Build for Windows

on: [push, pull_request]

jobs:
build-windows:
name: windows ${{ join(matrix.*, ' ') }}
env:
OPTS: --with-vstudiotarget=${{ matrix.target }} --with-vstudiotargetver=Win10 --prefix=C:/openvswitch/usr --localstatedir=C:/ProgramData/openvswitch/var --sysconfdir=C:/ProgramData/openvswitch/etc --disable-ssl ${{ matrix.opts }}
TESTSUITE: ${{ matrix.testsuite }}

runs-on: windows-latest
timeout-minutes: 60

strategy:
fail-fast: false
matrix:
include:
# run only one job for windows, as more than one be enough currently to verify
# PRs
# tests are not enabled as they take very long and a lot of them will fail
- target: Release

defaults:
run:
shell: msys2 {0}

steps:
- name: checkout
uses: actions/checkout@v2
- name: install msys
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: base-devel git mingw-w64-ucrt-x86_64-toolchain autotools
- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.x'

# pypiwin32 has to be installed with a Windows python version therefore
# this step will configure python first on Windows and exports
# its location for MSYS bash.
- name: configure python in Windows cmdline
shell: cmd
run: |
python -m pip install --upgrade pip
pip install pypiwin32
echo export pythonLocation="%pythonLocation%" > %RUNNER_TEMP%\msys64\home\%USERNAME%\.pythonenv.sh
echo export PYTHONPATH="%pythonLocation%\Lib;%pythonLocation%\DLLs;%pythonLocation%\Lib\lib-tk" >> %RUNNER_TEMP%\msys64\home\%USERNAME%\.pythonenv.sh
echo ".pythonenv.sh was generated in %RUNNER_TEMP%\msys64\home\%USERNAME%"
- name: generate Visual Studio environment
shell: cmd
run: |
powershell -c ./build-aux/envdiff.ps1
@call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
powershell -c ./build-aux/envdiff.ps1 > %RUNNER_TEMP%\msys64\home\%USERNAME%\.visualstudio.sh
echo ".visualstudio.sh was generated in %RUNNER_TEMP%\msys64\home\%USERNAME%"
- name: configure python for MSYS
run: |
source ~/.pythonenv.sh
echo "using python from path $pythonLocation"
mv /ucrt64/bin/python /ucrt64/bin/python_off
mv /ucrt64/bin/python3 /ucrt64/bin/python3_off
ln -s "$pythonLocation\python" /ucrt64/bin/python3
- name: prepare
run: |
[[ -f /usr/bin/link ]] && mv /usr/bin/link /usr/bin/link_off
source ~/.visualstudio.sh
./.ci/windows-prepare.sh
- name: build
run: |
source ~/.visualstudio.sh
source ~/.pythonenv.sh
echo $PYTHONPATH
./.ci/windows-build.sh
- name: upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs-windows-${{ join(matrix.*, '-') }}
path: config.log
- name: install
run: |
source ~/.visualstudio.sh
source ~/.pythonenv.sh
make install
cp ./PTHREADS-BUILT/bin/pthreadVC3.dll /C/openvswitch/usr/sbin
cp ./PTHREADS-BUILT/bin/pthreadVC3.dll /C/openvswitch/usr/bin
mkdir /C/openvswitch/driver
cp ./datapath-windows/x64/Win10${{ matrix.target }}/package/* /C/openvswitch/driver
cp ./datapath-windows/x64/Win10${{ matrix.target }}/package.cer /C/openvswitch/driver
cp ./datapath-windows/misc/* /C/openvswitch/driver
cp ./datapath-windows/ovsext/x64/Win10${{ matrix.target }}/DBO_OVSE.pdb /C/openvswitch/driver
- name: upload build artifacts
uses: actions/upload-artifact@v2
with:
name: openvswitch-windows-${{ join(matrix.*, '-') }}
path: c:\openvswitch
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,14 @@ testsuite.tmp.orig
/Documentation/_build
/.venv
/cxx-check
snapshot.env
PTHREADS-BUILT/bin/pthreadVC3.dll
PTHREADS-BUILT/bin/pthreadVC3d.dll
PTHREADS-BUILT/bin/pthreadVCE3.dll
PTHREADS-BUILT/bin/pthreadVCE3d.dll
PTHREADS-BUILT/bin/pthreadVSE3.dll
PTHREADS-BUILT/bin/pthreadVSE3d.dll
PTHREADS-BUILT/include/_ptw32.h
PTHREADS-BUILT/include/pthread.h
PTHREADS-BUILT/include/sched.h
PTHREADS-BUILT/include/semaphore.h
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,14 @@ EXTRA_DIST = \
.ci/dpdk-prepare.sh \
.ci/linux-build.sh \
.ci/linux-prepare.sh \
.ci/windows-build.sh \
.ci/windows-prepare.sh \
.ci/osx-build.sh \
.ci/osx-prepare.sh \
.cirrus.yml \
.editorconfig \
.github/workflows/build-and-test.yml \
.github/workflows/build-windows.yml \
.readthedocs.yaml \
appveyor.yml \
boot.sh \
Expand Down
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
are kept up-to-date.

============
Open vSwitch
Open vSwitch (dbosoft fork)
============

.. image:: https://github.com/dbosoft/ovs/workflows/Build%20and%20Test/badge.svg
:target: https://github.com/dbosoft/ovs/actions
.. image:: https://github.com/openvswitch/ovs/workflows/Build%20and%20Test/badge.svg
:target: https://github.com/openvswitch/ovs/actions
.. image:: https://ci.appveyor.com/api/projects/status/github/openvswitch/ovs?branch=master&svg=true&retina=true
Expand Down Expand Up @@ -49,6 +51,10 @@ the kernel-based switch. OVS in userspace can access Linux or DPDK devices.
Note Open vSwitch with userspace datapath and non DPDK devices is considered
experimental and comes with a cost in performance.

What is the dbosoft fork?
-------------------------
We have forked openvswitch to build it for windows and to work on upstream patches.

What's here?
------------

Expand Down
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ init:

mkdir C:\openvswitch\driver

$source = "https://slproweb.com/download/Win64OpenSSL-1_0_2u.exe"
$source = "https://slproweb.com/download/Win64OpenSSL-1_1_1s.exe"

$destination = "C:\ovs-build-downloads\Win64OpenSSL-1_0_2u.exe"
$destination = "C:\ovs-build-downloads\Win64OpenSSL-1_1_1s.exe"

Invoke-WebRequest $source -OutFile $destination

cd C:\ovs-build-downloads

.\Win64OpenSSL-1_0_2u.exe /silent /verysilent /sp- /suppressmsgboxes
.\Win64OpenSSL-1_1_1s.exe /silent /verysilent /sp- /suppressmsgboxes

Start-Sleep -s 30

Expand Down
3 changes: 2 additions & 1 deletion build-aux/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ EXTRA_DIST += \
build-aux/sodepends.py \
build-aux/soexpand.py \
build-aux/text2c \
build-aux/xml2nroff
build-aux/xml2nroff \
build-aux/envdiff.ps1

FLAKE8_PYFILES += \
build-aux/dpdkstrip.py \
Expand Down
44 changes: 44 additions & 0 deletions build-aux/envdiff.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# script to export windows environment variables to bash shell
# This is useful to create bash environments from vcvars64.bat
# based on the solution from this article https://anadoxin.org/blog/bringing-visual-studio-compiler-into-msys2-environment.html/

if((Test-Path "snapshot.env") -eq $false){

Get-ChildItem env: | Select-Object Key,Value | ConvertTo-Json | Set-Content "snapshot.env"
Write-Host "Stored snapshot.env"
return
}

$snapshotEnv = Get-Content "snapshot.env" | ConvertFrom-Json

foreach($e in Get-ChildItem env:){
if($e.Key -contains '/') {
# Sometimes Windows uses environment variables like i.e.
# ProgramFiles(x86)=c:\...
# but let's just skip this.
continue;
}
$key = $e.Key
$keyUpperCase = $e.Key.ToUpperInvariant()

if($keyUpperCase -eq "PATH") {
$path = $e.Value.Replace("c:", "/c").Replace("C:", "/c").Replace("\", "/").Replace(";", ":")
Write-Output "export PATH=""`$PATH:$path"""
continue
}
$valueEscaped = $e.value.replace("\", "\\");

$snapShotEntry = $snapshotEnv | Where-Object -Property Key -eq $key | Select-Object -First 1

if($null -ne $snapShotEntry){
Write-Output "# debug: key=$keyUpperCase"
$oldValue = $snapShotEntry.Value
if($oldValue -ne $e.Value) {
Write-Output "export $key=""$valueEscaped"" #changed"
}
}
else{
Write-Output "export $key=""$valueEscaped"" #new"

}
}
8 changes: 3 additions & 5 deletions datapath-windows/Package/package.VcxProj
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,14 @@
<PlatformToolset>WindowsKernelModeDriver$(PlatformToolsetVer)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Debug|x64'" Label="Configuration">
<TargetVersion>
</TargetVersion>
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolsetVer Condition="'$(PlatformToolsetVer)' == ''">10.0</PlatformToolsetVer>
<PlatformToolset>WindowsKernelModeDriver$(PlatformToolsetVer)</PlatformToolset>
<DriverTargetPlatform>Desktop</DriverTargetPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win10Analyze|x64'" Label="Configuration">
<TargetVersion />
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolsetVer Condition="'$(PlatformToolsetVer)' == ''">10.0</PlatformToolsetVer>
<PlatformToolset>WindowsKernelModeDriver$(PlatformToolsetVer)</PlatformToolset>
Expand All @@ -95,8 +94,7 @@
<PlatformToolset>WindowsKernelModeDriver$(PlatformToolsetVer)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win10 Release|x64'" Label="Configuration">
<TargetVersion>
</TargetVersion>
<TargetVersion>Windows10</TargetVersion>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolsetVer Condition="'$(PlatformToolsetVer)' == ''">10.0</PlatformToolsetVer>
<PlatformToolset>WindowsKernelModeDriver$(PlatformToolsetVer)</PlatformToolset>
Expand Down
6 changes: 3 additions & 3 deletions datapath-windows/include/OvsDpInterfaceExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#define OVS_DATAPATH_EXT_VERSION 1

/* Name of the device. */
#define OVS_DEVICE_NAME_NT L"\\Device\\OpenvSwitchDevice"
#define OVS_DEVICE_NAME_DOS L"\\DosDevices\\OpenvSwitchDevice"
#define OVS_DEVICE_NAME_USER TEXT("\\\\.\\OpenvSwitchDevice")
#define OVS_DEVICE_NAME_NT L"\\Device\\DbosoftOVSD"
#define OVS_DEVICE_NAME_DOS L"\\DosDevices\\DbosoftOVSD"
#define OVS_DEVICE_NAME_USER TEXT("\\\\.\\DbosoftOVSD")

#define OVS_IOCTL_DEVICE_TYPE 45000

Expand Down
14 changes: 7 additions & 7 deletions datapath-windows/ovsext/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ NDIS_HANDLE gOvsExtDriverHandle;
*/
extern POVS_SWITCH_CONTEXT gOvsSwitchContext;

static PWCHAR ovsExtFriendlyName = L"Open vSwitch Extension";
static PWCHAR ovsExtServiceName = L"OVSExt";
static PWCHAR ovsExtFriendlyName = L"dbosoft Open vSwitch Extension";
static PWCHAR ovsExtServiceName = L"DBO_OVSE";
NDIS_STRING ovsExtGuidUC;
NDIS_STRING ovsExtFriendlyNameUC;

static PWCHAR ovsExtGuidStr = L"{583CC151-73EC-4A6A-8B47-578297AD7623}";
static PWCHAR ovsExtGuidStr = L"{63E968D9-754E-4704-A5CE-6E3BF7DDF59B}";
static const GUID ovsExtGuid = {
0x583cc151,
0x73ec,
0x4a6a,
{0x8b, 0x47, 0x57, 0x82, 0x97, 0xad, 0x76, 0x23}
0x63e968d9,
0x754e,
0x4704,
{0xa5, 0xce, 0x6e, 0x3b, 0xf7, 0xdd, 0xf5, 0x9b}
};

DRIVER_INITIALIZE DriverEntry;
Expand Down
5 changes: 4 additions & 1 deletion datapath-windows/ovsext/User.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,10 @@ _MapNlAttrToOvsPktExec(PNL_MSG_HDR nlMsgHdr, PNL_ATTR *nlAttrs,
execute->actionsLen = NlAttrGetSize(nlAttrs[OVS_PACKET_ATTR_ACTIONS]);

ASSERT(keyAttrs[OVS_KEY_ATTR_IN_PORT]);
execute->inPort = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_IN_PORT]);
if (keyAttrs[OVS_KEY_ATTR_IN_PORT]) {
execute->inPort = NlAttrGetU32(keyAttrs[OVS_KEY_ATTR_IN_PORT]);
}

execute->keyAttrs = keyAttrs;

if (nlAttrs[OVS_PACKET_ATTR_MRU]) {
Expand Down
Loading
Loading