瀏覽代碼

Merge branch 'SoftEtherVPN:master' into add-id-translation

kiraware 5 月之前
父節點
當前提交
c742f6c5cf
共有 7 個文件被更改,包括 24 次插入9 次删除
  1. 2 2
      .cirrus.yml
  2. 2 2
      .github/workflows/fedora-rawhide.yml
  3. 1 1
      description
  4. 1 2
      docker-compose.yaml
  5. 3 0
      src/CMakeLists.txt
  6. 1 1
      src/Mayaqua/3rdparty/cpu_features
  7. 14 1
      src/Mayaqua/CMakeLists.txt

+ 2 - 2
.cirrus.yml

@@ -13,10 +13,10 @@ FreeBSD_task:
     freebsd_instance:
     freebsd_instance:
       image_family: freebsd-14-2
       image_family: freebsd-14-2
   prepare_script:
   prepare_script:
-    - pkg install -y pkgconf cmake git libsodium $SSL
+    - pkg install -y pkgconf cmake git libsodium cpu_features $SSL
     - git submodule update --init --recursive
     - git submodule update --init --recursive
   configure_script:
   configure_script:
-    - ./configure
+    - CMAKE_FLAGS="-DUSE_SYSTEM_CPU_FEATURES=1" CFLAGS="-I/usr/local/include/cpu_features" ./configure
   build_script:
   build_script:
     - make -j $(sysctl -n hw.ncpu || echo 4) -C build
     - make -j $(sysctl -n hw.ncpu || echo 4) -C build
   test_script:
   test_script:

+ 2 - 2
.github/workflows/fedora-rawhide.yml

@@ -25,10 +25,10 @@ jobs:
         submodules: true
         submodules: true
     - name: Install dependencies
     - name: Install dependencies
       run: |
       run: |
-        dnf -y install git cmake ncurses-devel openssl-devel-engine libsodium-devel readline-devel zlib-devel gcc-c++ clang
+        dnf -y install git cmake ncurses-devel openssl-devel-engine libsodium-devel readline-devel zlib-devel gcc-c++ clang google-cpu_features-devel
     - name: Compile with ${{ matrix.cc }}
     - name: Compile with ${{ matrix.cc }}
       run: |
       run: |
         export CC=${{ matrix.cc }}
         export CC=${{ matrix.cc }}
-        ./configure
+        CMAKE_FLAGS="-DUSE_SYSTEM_CPU_FEATURES=1" CFLAGS="-I/usr/include/cpu_features" ./configure
         make -C build
         make -C build
 
 

+ 1 - 1
description

@@ -2,4 +2,4 @@ SoftEther VPN ("SoftEther" means "Software Ethernet") is an open-source cross-pl
 Its protocol is very fast and it can be used in very restricted environments, as it's able to transfer packets over DNS and ICMP.
 Its protocol is very fast and it can be used in very restricted environments, as it's able to transfer packets over DNS and ICMP.
 The server includes a free Dynamic DNS service, which can be used to access the server even if the public IP address changes.
 The server includes a free Dynamic DNS service, which can be used to access the server even if the public IP address changes.
 A NAT-Traversal function is also available, very useful in case the required ports cannot be opened on the firewall.
 A NAT-Traversal function is also available, very useful in case the required ports cannot be opened on the firewall.
-The supported third party protocols are OpenVPN, L2TP/IPSec and SSTP.
+The supported third party protocols are OpenVPN, L2TP/IPSec, SSTP and WireGuard.

+ 1 - 2
docker-compose.yaml

@@ -1,8 +1,7 @@
-version: '3'
-
 services:
 services:
   softether:
   softether:
     image: softethervpn/vpnserver:latest
     image: softethervpn/vpnserver:latest
+    hostname: softethervpnserver
     cap_add:
     cap_add:
       - NET_ADMIN
       - NET_ADMIN
     restart: always
     restart: always

+ 3 - 0
src/CMakeLists.txt

@@ -127,6 +127,9 @@ if(UNIX)
   if(SE_PIDDIR)
   if(SE_PIDDIR)
     add_definitions(-DSE_PIDDIR="${SE_PIDDIR}")
     add_definitions(-DSE_PIDDIR="${SE_PIDDIR}")
   endif()
   endif()
+
+  # Use system libraries instead of bundled
+  set(USE_SYSTEM_CPU_FEATURES false CACHE BOOL "Use system cpu_features")
 endif()
 endif()
 
 
 # Cedar communication module
 # Cedar communication module

+ 1 - 1
src/Mayaqua/3rdparty/cpu_features

@@ -1 +1 @@
-Subproject commit 26133d3b620c2c27f31d571efd27371100f891e9
+Subproject commit ba4bffa86cbb5456bdb34426ad22b9551278e2c0

+ 14 - 1
src/Mayaqua/CMakeLists.txt

@@ -109,8 +109,21 @@ if(UNIX)
       $<$<BOOL:${LIB_RT}>:${LIB_RT}>
       $<$<BOOL:${LIB_RT}>:${LIB_RT}>
   )
   )
 
 
-  if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|aarch64|s390x)$" OR NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES)
+  if (NOT HAVE_SYS_AUXV OR SKIP_CPU_FEATURES)
     add_definitions(-DSKIP_CPU_FEATURES)
     add_definitions(-DSKIP_CPU_FEATURES)
+  elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(amd64|i386)")
+    message("cpu_features is not available on FreeBSD/${CMAKE_SYSTEM_PROCESSOR}")
+    add_definitions(-DSKIP_CPU_FEATURES)
+  elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND NOT CMAKE_SYSTEM_NAME MATCHES "^(arm64|x86_64)")
+    # macOS runs only on Intel or ARM architecrues, should not reach here
+    add_definitions(-DSKIP_CPU_FEATURES)
+  elseif(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+    message("cpu_features is not available on ${CMAKE_SYSTEM_NAME}")
+    add_definitions(-DSKIP_CPU_FEATURES)
+  elseif(USE_SYSTEM_CPU_FEATURES)
+    CHECK_INCLUDE_FILE(cpu_features_macros.h HAVE_CPU_FEATURES)
+    message("-- Using system's cpu_features")
+    target_link_libraries(mayaqua PRIVATE cpu_features)
   else()
   else()
     add_subdirectory(3rdparty/cpu_features)
     add_subdirectory(3rdparty/cpu_features)
     set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ON)
     set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ON)