diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c7aa32..f6e2d90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,9 @@ name: "CI" on: push: + branches: + - master pull_request: - workflow_dispatch: jobs: smoke: name: "Smoke test" @@ -10,17 +11,16 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} - timeout-minutes: 30 steps: - - name: "Check out" - uses: actions/checkout@v2 - with: - fetch-depth: 1 - name: "Install dependencies (Linux)" if: runner.os == 'Linux' run: | - sudo apt-get update - sudo apt-get install -y cmake libvdeplug-dev + sudo apt-get update -q + sudo apt-get install -y --no-install-recommends -q cmake libvdeplug-dev libpcap-dev + - name: "Check out" + uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: "Build" run: | mkdir build diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ddb17f..01a7e5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,7 @@ cm_check_include(sys/type32.h HAVE_SYS_TYPE32_H) cm_check_include(syslimits.h HAVE_SYSLIMITS_H) cm_check_include(sys/syslimits.h HAVE_SYS_SYSLIMITS_H) cm_check_include(sysexits.h HAVE_SYSEXITS_H) +cm_check_include(pcap.h HAVE_PCAP_H) cm_check_include(wolfssl/wolfcrypt/chacha.h HAVE_WOLFSSL_CHACHA_H) cm_check_include(mbedtls/chacha20.h HAVE_MBEDTLS_CHACHA20_H) @@ -190,8 +191,14 @@ if(ENABLE_ROUTER AND PTHREAD_LIBRARY) set(CAN_MAKE_VDE_ROUTER TRUE) endif() -if(ENABLE_PCAP AND HAVE_PCAP_OPEN_DEAD) +if(ENABLE_PCAP AND PCAP_LIBRARY AND HAVE_PCAP_H) set(CAN_MAKE_VDE_PCAP TRUE) +else() + set(CAN_MAKE_VDE_PCAP FALSE) + if(ENABLE_PCAP) + message(WARNING "Cannot make vde_pcapplug: libpcap headers or library not found") + set(ENABLE_PCAP OFF) + endif() endif() if(HAVE_SYSEXITS_H) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1f53cfb..e1cd2b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,7 +23,7 @@ endif() if (CAN_MAKE_VDE_PCAP) add_executable(vde_pcapplug vde_pcapplug.c) - target_link_libraries(vde_pcapplug vdeplug pcap) + target_link_libraries(vde_pcapplug vdeplug pcap vdecommon) endif() if(ENABLE_VXLAN) @@ -52,13 +52,15 @@ target_link_libraries(wirefilter vdeplug m vdecommon) add_executable(vdeterm vdeterm.c) target_link_libraries(vdeterm vdeplug vdehist vdecommon) -add_executable(vde_pcapplug vde_pcapplug.c) -target_link_libraries(vde_pcapplug vdeplug pcap vdecommon) - if (NOT WITH_VDEPLUG4) install(TARGETS vde_plug dpipe DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() -install(TARGETS unixcmd vde_plug2tap vde_autolink wirefilter vdeterm vde_pcapplug +install(TARGETS unixcmd vde_plug2tap vde_autolink wirefilter vdeterm DESTINATION ${CMAKE_INSTALL_BINDIR}) + +if (CAN_MAKE_VDE_PCAP) + install(TARGETS vde_pcapplug + DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/src/vde_switch/plugins/CMakeLists.txt b/src/vde_switch/plugins/CMakeLists.txt index d945533..fc69338 100644 --- a/src/vde_switch/plugins/CMakeLists.txt +++ b/src/vde_switch/plugins/CMakeLists.txt @@ -13,8 +13,8 @@ if(ENABLE_EXPERIMENTAL) add_definitions(-DDEBUGOPT -DPORTCOUNTERS -DVDEPLUGIN) endif() -# Handle ENABLE_PCAP flag -if(ENABLE_PCAP) +# Handle pcap support +if(CAN_MAKE_VDE_PCAP) add_library(pdump MODULE pdump.c) target_link_libraries(pdump vdecommon pcap) else() @@ -22,5 +22,10 @@ else() endif() # install modules -install(TARGETS dump iplog pdump DESTINATION +install(TARGETS dump iplog DESTINATION ${CMAKE_INSTALL_LIBDIR}/vde2/plugins) + +if(CAN_MAKE_VDE_PCAP) + install(TARGETS pdump DESTINATION + ${CMAKE_INSTALL_LIBDIR}/vde2/plugins) +endif()