[libpcap] Update to 1.10.5, cleanup (#41453)

This commit is contained in:
Kai Pastor 2024-10-11 16:47:00 +02:00 committed by GitHub
parent 748125eea8
commit 99685fae17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 132 additions and 118 deletions

View File

@ -1,29 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 650be01..7565e58 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -521,6 +521,7 @@ set(SEPTEL_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../septel" CACHE PATH "Path to dire
option(DISABLE_SNF "Disable Myricom SNF support" OFF)
option(DISABLE_TC "Disable Riverbed TurboCap support" OFF)
+option(DISABLE_PACKET "Disable Packet support" OFF)
#
# Debugging options.
@@ -579,7 +580,7 @@ if(WIN32)
if(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common)
include_directories(${CMAKE_HOME_DIRECTORY}/../../Common)
endif(IS_DIRECTORY ${CMAKE_HOME_DIRECTORY}/../../Common)
-
+ if(NOT DISABLE_PACKET)
find_package(Packet)
if(Packet_FOUND)
set(HAVE_PACKET32 TRUE)
@@ -594,6 +595,7 @@ if(WIN32)
check_function_exists(PacketGetTimestampModes HAVE_PACKET_GET_TIMESTAMP_MODES)
cmake_pop_check_state()
endif(Packet_FOUND)
+ endif()
message(STATUS "checking for Npcap's version.h")
check_symbol_exists(WINPCAP_PRODUCT_NAME "${CMAKE_SOURCE_DIR}/../../version.h" HAVE_VERSION_H)

View File

@ -1,37 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58c5159..650be01 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3238,9 +3238,12 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-bpf.h DESTINATION include)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-namedb.h DESTINATION include)
-# On UN*X, and on Windows when not using MSVC, generate libpcap.pc and
-# pcap-config and process man pages and arrange that they be installed.
-if(NOT MSVC)
+# Generate libpcap.pc
+if(MSVC AND NOT BUILD_SHARED_LIBS)
+ set(PACKAGE_NAME ${LIBRARY_NAME}_static)
+else()
+ set(PACKAGE_NAME ${LIBRARY_NAME})
+endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(includedir "\${prefix}/include")
@@ -3308,10 +3311,14 @@ if(NOT MSVC)
set(RPATH "")
endif()
endif()
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)
+# On UN*X, and on Windows when not using MSVC, generate libpcap.pc and
+# pcap-config and process man pages and arrange that they be installed.
+if(NOT MSVC)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
+
#
# Man pages.

View File

@ -0,0 +1,53 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9012ef4..88179b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -798,6 +798,7 @@ if(WIN32)
cmake_pop_check_state()
if(LIBWS2_32_HAS_GETADDRINFO)
set(PCAP_LINK_LIBRARIES ws2_32 ${PCAP_LINK_LIBRARIES})
+ set(LIBS "-lws2_32 ${LIBS}")
else(LIBWS2_32_HAS_GETADDRINFO)
message(FATAL_ERROR "getaddrinfo is required, but wasn't found")
endif(LIBWS2_32_HAS_GETADDRINFO)
@@ -3405,7 +3406,8 @@ set(MANMISC_EXPAND
)
if(BUILD_SHARED_LIBS)
- set(LIBRARIES_TO_INSTALL "${LIBRARY_NAME}" "${LIBRARY_NAME_STATIC}")
+ set(LIBRARIES_TO_INSTALL "${LIBRARY_NAME}")
+ set_target_properties(${LIBRARY_NAME_STATIC} PROPERTIES EXCLUDE_FROM_ALL 1)
else(BUILD_SHARED_LIBS)
set(LIBRARIES_TO_INSTALL "${LIBRARY_NAME_STATIC}")
endif(BUILD_SHARED_LIBS)
@@ -3416,7 +3418,7 @@ if(WIN32 OR CYGWIN OR MSYS)
# the target is Windows; would there ever be a case where
# CYGWIN or MSYS are set but WIN32 *isn't* set?
#
- if(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+ if(0)
#
# Install 64-bit code built with MSVC in the x64 subdirectories,
# as that's where it expects it to be.
@@ -3463,7 +3465,10 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pcap-namedb.h DESTINATION ${CMAKE_INST
# On UN*X, and on Windows when not using MSVC, generate libpcap.pc and
# pcap-config and process man pages and arrange that they be installed.
-if(NOT MSVC)
+if(1)
+ if(MSVC AND NOT BUILD_SHARED_LIBS)
+ string(APPEND PACKAGE_NAME "_static")
+ endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix "\${prefix}")
set(includedir "\${prefix}/include")
@@ -3533,8 +3538,8 @@ if(NOT MSVC)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pcap-config.in ${CMAKE_CURRENT_BINARY_DIR}/pcap-config @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpcap.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc @ONLY)
- install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pcap-config DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpcap.pc DESTINATION lib/pkgconfig)
+elseif(0)
#
# Man pages.

View File

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88179b0..51a2732 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3222,10 +3222,6 @@ if(WIN32)
# For compatibility, build the shared library without the "lib" prefix on
# MinGW as well.
#
- set_target_properties(${LIBRARY_NAME} PROPERTIES
- PREFIX ""
- OUTPUT_NAME "${LIBRARY_NAME}"
- )
set_target_properties(${LIBRARY_NAME}_static PROPERTIES
OUTPUT_NAME "${LIBRARY_NAME}"
)

View File

@ -2,80 +2,65 @@ if(EXISTS "${CURRENT_INSTALLED_DIR}/share/winpcap")
message(FATAL_ERROR "FATAL ERROR: winpcap and libpcap are incompatible.")
endif()
if(VCPKG_TARGET_IS_LINUX)
message(
"libpcap currently requires the following libraries from the system package manager:
flex
libbison-dev
These can be installed on Ubuntu systems via sudo apt install flex libbison-dev"
)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO the-tcpdump-group/libpcap
REF "libpcap-${VERSION}"
SHA512 7352ff4d5bded916c0802e4a846fcb6b26e3ea8025dbbf58543abd9d9f6e8f7f5d60e03bcadb222d20434b7e052f663a560d7487af4b81fba74cf5aea040d733
SHA512 bb8ba3a589425d71531312285a3c7ded4abdff5ea157b88195e06a2b4f8c93b4db0bca122e9ac853cff14cd16e9519dca30b6bdf0311e7749038fdce57325726
HEAD_REF master
PATCHES
install-pc-on-msvc.patch
add-disable-packet-option.patch
PATCHES
install.diff
mingw-dynamic-libname.diff
)
vcpkg_find_acquire_program(BISON)
get_filename_component(BISON_PATH ${BISON} DIRECTORY)
vcpkg_add_to_path(${BISON_PATH})
vcpkg_find_acquire_program(FLEX)
get_filename_component(FLEX_PATH ${FLEX} DIRECTORY)
vcpkg_add_to_path(${FLEX_PATH})
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RT)
SET(options "")
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_CMAKE_CONFIGURE_OPTIONS MATCHES "Packet_ROOT")
list(APPEND options "-DPCAP_TYPE=null")
message(STATUS [[Attention:
This build does not include packet capture capabilities.
In order to enable such capabilities, install the Npcap SDK or the WinPcap SDK,
and pass '-DPacket_ROOT=<path of SDK>' via VCPKG_CMAKE_CONFIGURE_OPTIONS
in a custom triplet file.
]])
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DDISABLE_NETMAP=ON
${options}
-DBUILD_WITH_LIBNL=OFF
-DDISABLE_AIRPCAP=ON
-DDISABLE_BLUETOOTH=ON
-DDISABLE_DBUS=ON
-DDISABLE_RDMA=ON
-DDISABLE_DAG=ON
-DDISABLE_DBUS=ON
-DDISABLE_DPDK=ON
-DDISABLE_NETMAP=ON
-DDISABLE_RDMA=ON
-DDISABLE_SEPTEL=ON
-DDISABLE_SNF=ON
-DDISABLE_TC=ON
-DDISABLE_PACKET=ON
-DENABLE_REMOTE=OFF
"-DLEX_EXECUTABLE=${FLEX}"
"-DYACC_EXECUTABLE=${BISON}"
-DUSE_STATIC_RT=${USE_STATIC_RT}
MAYBE_UNUSED_VARIABLES
BUILD_WITH_LIBNL # linux only
CMAKE_DISABLE_FIND_PACKAGE_Packet # windows only
)
vcpkg_cmake_install()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
# On Windows 64-bit, libpcap 1.10.1 installs the libraries in a x64 subdirectory of the usual directories
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(libsubdir "x64")
file(GLOB_RECURSE FILES_TO_MOVE "${CURRENT_PACKAGES_DIR}/lib/${libsubdir}/*")
file(COPY ${FILES_TO_MOVE} DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
file(GLOB_RECURSE FILES_TO_MOVE "${CURRENT_PACKAGES_DIR}/debug/lib/${libsubdir}/*")
file(COPY ${FILES_TO_MOVE} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
file(GLOB_RECURSE FILES_TO_MOVE "${CURRENT_PACKAGES_DIR}/bin/${libsubdir}/*")
file(COPY ${FILES_TO_MOVE} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
file(GLOB_RECURSE FILES_TO_MOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${libsubdir}/*")
file(COPY ${FILES_TO_MOVE} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/${libsubdir}"
"${CURRENT_PACKAGES_DIR}/debug/lib/${libsubdir}"
"${CURRENT_PACKAGES_DIR}/bin/${libsubdir}"
"${CURRENT_PACKAGES_DIR}/debug/bin/${libsubdir}")
endif()
# Even if compiled with BUILD_SHARED_LIBS=ON, pcap also install a pcap_static library
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/pcap_static.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/pcap_static.lib")
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/share/man")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,7 +1,6 @@
{
"name": "libpcap",
"version-semver": "1.10.4",
"port-version": 1,
"version-semver": "1.10.5",
"description": "A portable C/C++ library for network traffic capture",
"homepage": "https://www.tcpdump.org/",
"license": "BSD-3-Clause",

View File

@ -0,0 +1,14 @@
diff --git a/nse_nsock.cc b/nse_nsock.cc
index 7cbfcd2..cf9d5db 100644
--- a/nse_nsock.cc
+++ b/nse_nsock.cc
@@ -29,6 +29,9 @@
#define DEFAULT_TIMEOUT 30000
+#ifdef PCAP_SOCKET
+# undef PCAP_SOCKET
+#endif
/* Upvalues for library variables */
enum {
NSOCK_POOL = lua_upvalueindex(1),

View File

@ -60,6 +60,8 @@ else()
vcpkg_extract_source_archive(source_path_release
ARCHIVE "${ARCHIVE}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
PATCHES
pcap_socket.diff
)
vcpkg_execute_required_process(
@ -84,6 +86,8 @@ else()
vcpkg_extract_source_archive(source_path_debug
ARCHIVE "${ARCHIVE}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
PATCHES
pcap_socket.diff
)
vcpkg_execute_required_process(

View File

@ -1,7 +1,7 @@
{
"name": "nmap",
"version": "7.70",
"port-version": 11,
"port-version": 12,
"description": "A library for scanning network ports.",
"dependencies": [
{

View File

@ -4909,8 +4909,8 @@
"port-version": 5
},
"libpcap": {
"baseline": "1.10.4",
"port-version": 1
"baseline": "1.10.5",
"port-version": 0
},
"libpff": {
"baseline": "2021-11-14",
@ -6322,7 +6322,7 @@
},
"nmap": {
"baseline": "7.70",
"port-version": 11
"port-version": 12
},
"nmslib": {
"baseline": "2.1.1",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bb54ee6890b51e54614371d548053020585027ea",
"version-semver": "1.10.5",
"port-version": 0
},
{
"git-tree": "7bfda50e586151e14fb6704ed154e8747bc64ea9",
"version-semver": "1.10.4",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b4b897cddcd9c1849f9181b400599aa7b93be5bd",
"version": "7.70",
"port-version": 12
},
{
"git-tree": "d96fe27573cd4c06549f6a711e54f0f26a1c4485",
"version": "7.70",