[PATCHv2] libpcap: update to 1.10.0

Rosen Penev rosenp at gmail.com
Mon Jan 4 18:46:42 EST 2021


Simplify cmake option handling by putting everything in blocks.

Add openssl patch as there's no easy way to disable.

Rebase the skip manpages patch.

Remove the monitor mode patch as it no longer applies.

Remove flex patch as normal Makefile is no longer used.

Remove USB path patch. While it is deprecated, the codepath is never
taken. /sys/bus/usb/devices is checked before hand. If it exists, the
function does stuff and returns. Additionally, this path is used
elsewhere in the code.

Refresh other patches.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 v2: add back missing CONFIG_PCAP_HAS_NETFILTER
 package/libs/libpcap/Makefile                 |  22 ++--
 .../libs/libpcap/patches/100-no-openssl.patch |  10 ++
 .../libpcap/patches/102-skip-manpages.patch   | 110 +++++++++---------
 .../103-makefile_flex_workaround.patch        |  14 ---
 .../patches/201-space_optimization.patch      |   2 +-
 .../patches/203-undef_iw_mode_monitor.patch   |  11 --
 .../libpcap/patches/204-usb-bus-path.patch    |  13 ---
 7 files changed, 73 insertions(+), 109 deletions(-)
 create mode 100644 package/libs/libpcap/patches/100-no-openssl.patch
 delete mode 100644 package/libs/libpcap/patches/103-makefile_flex_workaround.patch
 delete mode 100644 package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch
 delete mode 100644 package/libs/libpcap/patches/204-usb-bus-path.patch

diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile
index 35ceb18c29..6168d4c459 100644
--- a/package/libs/libpcap/Makefile
+++ b/package/libs/libpcap/Makefile
@@ -8,22 +8,21 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libpcap
-PKG_VERSION:=1.9.1
-PKG_RELEASE:=3
+PKG_VERSION:=1.10.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.us.tcpdump.org/release/ \
         http://www.tcpdump.org/release/
-PKG_HASH:=635237637c5b619bcceba91900666b64d56ecb7be63f298f601ec786ce087094
+PKG_HASH:=8d12b42623eeefee872f123bd0dc85d535b00df4d42e865f993c40f7bfc92b1e
 
 PKG_MAINTAINER:=Felix Fietkau <nbd at nbd.name>
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=LICENSE
 
 PKG_ASLR_PIE_REGULAR:=1
 PKG_BUILD_PARALLEL:=1
 
-PKG_LICENSE:=BSD-3-Clause
-PKG_LICENSE_FILES:=LICENSE
-
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/cmake.mk
 
@@ -48,11 +47,16 @@ endef
 CMAKE_OPTIONS += \
 	-DBUILD_SHARED_LIBS=ON \
 	-DBUILD_WITH_LIBNL=OFF \
+	-DINET6=O$(if $(CONFIG_IPV6),N,FF) \
+	-DPCAP_SUPPORT_NETFILTER=O$(if $(CONFIG_PCAP_HAS_NETFILTER),N,FF)
 
 # grep 'option(DISABLE_' CMakeLists.txt | cut -f2 -d'(' | cut -f1 -d' ' | sort --unique
 CMAKE_OPTIONS += \
+	-DDISABLE_BLUETOOTH=O$(if $(CONFIG_PCAP_HAS_BT),FF,N) \
 	-DDISABLE_DAG=ON \
 	-DDISABLE_DBUS=ON \
+	-DDISABLE_DPDK=ON \
+	-DDISABLE_LINUX_USBMON=O$(if $(CONFIG_PCAP_HAS_USB),FF,N) \
 	-DDISABLE_NETMAP=ON \
 	-DDISABLE_RDMA=ON \
 	-DDISABLE_SEPTEL=ON \
@@ -64,12 +68,6 @@ CMAKE_OPTIONS += \
 	-DBDEBUG=OFF \
 	-DYYDEBUG=OFF \
 
-CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_USB)       ,,-DDISABLE_USB=ON)
-CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_BT)        ,,-DDISABLE_BLUETOOTH=ON)
-CMAKE_OPTIONS += $(if $(CONFIG_PCAP_HAS_NETFILTER) ,,-DPCAP_SUPPORT_NETFILTER=OFF)
-
-CMAKE_OPTIONS += $(if $(CONFIG_IPV6),-DINET6=ON,-DINET6=OFF)
-
 define Build/InstallDev
 	$(call Build/InstallDev/cmake,$(1))
 	$(SED) \
diff --git a/package/libs/libpcap/patches/100-no-openssl.patch b/package/libs/libpcap/patches/100-no-openssl.patch
new file mode 100644
index 0000000000..6424cf8c6f
--- /dev/null
+++ b/package/libs/libpcap/patches/100-no-openssl.patch
@@ -0,0 +1,10 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1006,7 +1006,6 @@ endif()
+ #
+ # OpenSSL/libressl.
+ #
+-find_package(OpenSSL)
+ if(OPENSSL_FOUND)
+   #
+   # We have OpenSSL.
diff --git a/package/libs/libpcap/patches/102-skip-manpages.patch b/package/libs/libpcap/patches/102-skip-manpages.patch
index 28f572c913..57b780c1fe 100644
--- a/package/libs/libpcap/patches/102-skip-manpages.patch
+++ b/package/libs/libpcap/patches/102-skip-manpages.patch
@@ -7,69 +7,63 @@ Subject: [PATCH] skip manpages
  CMakeLists.txt | 55 --------------------------------------------------
  1 file changed, 55 deletions(-)
 
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 55b93f14..acf1a904 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -2397,61 +2397,6 @@ if(NOT MSVC)
-     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)
+@@ -2701,57 +2701,6 @@ if(NOT MSVC)
+     if(MINGW)
+         find_program(LINK_EXECUTABLE ln)
+     endif(MINGW)
+-    if(UNIX OR (MINGW AND LINK_EXECUTABLE))
+-        set(MAN1 "")
+-        foreach(MANPAGE ${MAN1_NOEXPAND})
+-            set(MAN1 ${MAN1} ${CMAKE_CURRENT_SOURCE_DIR}/${MANPAGE})
+-        endforeach(MANPAGE)
+-        install(FILES ${MAN1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 -
--    #
--    # Man pages.
--    #
--    # For each section of the manual for which we have man pages
--    # that require macro expansion, do the expansion.
--    #
--    set(MAN1 "")
--    foreach(MANPAGE ${MAN1_NOEXPAND})
--        set(MAN1 ${MAN1} ${CMAKE_CURRENT_SOURCE_DIR}/${MANPAGE})
--    endforeach(MANPAGE)
--    install(FILES ${MAN1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+-        set(MAN3PCAP "")
+-        foreach(MANPAGE ${MAN3PCAP_NOEXPAND})
+-            set(MAN3PCAP ${MAN3PCAP} ${CMAKE_CURRENT_SOURCE_DIR}/${MANPAGE})
+-        endforeach(MANPAGE)
+-        foreach(TEMPLATE_MANPAGE ${MAN3PCAP_EXPAND})
+-            string(REPLACE ".in" "" MANPAGE ${TEMPLATE_MANPAGE})
+-            configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
+-            set(MAN3PCAP ${MAN3PCAP} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
+-        endforeach(TEMPLATE_MANPAGE)
+-        install(FILES ${MAN3PCAP} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_datalink_val_to_name.3pcap pcap_datalink_val_to_description.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_datalink_val_to_name.3pcap pcap_datalink_val_to_description_or_dlt.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_dump_open.3pcap pcap_dump_fopen.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_findalldevs.3pcap pcap_freealldevs.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_geterr.3pcap pcap_perror.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_inject.3pcap pcap_sendpacket.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_list_datalinks.3pcap pcap_free_datalinks.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_list_tstamp_types.3pcap pcap_free_tstamp_types.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_loop.3pcap pcap_dispatch.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_major_version.3pcap pcap_minor_version.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_next_ex.3pcap pcap_next.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_open_dead.3pcap pcap_open_dead_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_open_offline.3pcap pcap_open_offline_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_open_offline.3pcap pcap_fopen_offline.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        install_manpage_symlink(pcap_setnonblock.3pcap pcap_getnonblock.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
 -
--    set(MAN3PCAP "")
--    foreach(MANPAGE ${MAN3PCAP_NOEXPAND})
--        set(MAN3PCAP ${MAN3PCAP} ${CMAKE_CURRENT_SOURCE_DIR}/${MANPAGE})
--    endforeach(MANPAGE)
--    foreach(TEMPLATE_MANPAGE ${MAN3PCAP_EXPAND})
--        string(REPLACE ".in" "" MANPAGE ${TEMPLATE_MANPAGE})
--        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
--        set(MAN3PCAP ${MAN3PCAP} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
--    endforeach(TEMPLATE_MANPAGE)
--    install(FILES ${MAN3PCAP} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_datalink_val_to_name.3pcap pcap_datalink_val_to_description.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_dump_open.3pcap pcap_dump_fopen.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_findalldevs.3pcap pcap_freealldevs.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_geterr.3pcap pcap_perror.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_inject.3pcap pcap_sendpacket.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_list_datalinks.3pcap pcap_free_datalinks.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_list_tstamp_types.3pcap pcap_free_tstamp_types.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_loop.3pcap pcap_dispatch.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_major_version.3pcap pcap_minor_version.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_next_ex.3pcap pcap_next.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_open_dead.3pcap pcap_open_dead_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_open_offline.3pcap pcap_open_offline_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_open_offline.3pcap pcap_fopen_offline.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
--    install_manpage_symlink(pcap_setnonblock.3pcap pcap_getnonblock.3pcap ${CMAKE_INSTALL_MANDIR}/man3)
+-        set(MANFILE "")
+-        foreach(TEMPLATE_MANPAGE ${MANFILE_EXPAND})
+-            string(REPLACE ".manfile.in" ".${MAN_FILE_FORMATS}" MANPAGE ${TEMPLATE_MANPAGE})
+-            configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
+-            set(MANFILE ${MANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
+-        endforeach(TEMPLATE_MANPAGE)
+-        install(FILES ${MANFILE} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_FILE_FORMATS})
 -
--    set(MANFILE "")
--    foreach(TEMPLATE_MANPAGE ${MANFILE_EXPAND})
--        string(REPLACE ".manfile.in" ".${MAN_FILE_FORMATS}" MANPAGE ${TEMPLATE_MANPAGE})
--        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
--        set(MANFILE ${MANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
--    endforeach(TEMPLATE_MANPAGE)
--    install(FILES ${MANFILE} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_FILE_FORMATS})
--
--    set(MANMISC "")
--    foreach(TEMPLATE_MANPAGE ${MANMISC_EXPAND})
--        string(REPLACE ".manmisc.in" ".${MAN_MISC_INFO}" MANPAGE ${TEMPLATE_MANPAGE})
--        configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
--        set(MANMISC ${MANMISC} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
--    endforeach(TEMPLATE_MANPAGE)
--    install(FILES ${MANMISC} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_MISC_INFO})
+-        set(MANMISC "")
+-        foreach(TEMPLATE_MANPAGE ${MANMISC_EXPAND})
+-            string(REPLACE ".manmisc.in" ".${MAN_MISC_INFO}" MANPAGE ${TEMPLATE_MANPAGE})
+-            configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
+-            set(MANMISC ${MANMISC} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
+-        endforeach(TEMPLATE_MANPAGE)
+-        install(FILES ${MANMISC} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${MAN_MISC_INFO})
+-    endif(UNIX OR (MINGW AND LINK_EXECUTABLE))
  endif(NOT MSVC)
  
  # uninstall target
diff --git a/package/libs/libpcap/patches/103-makefile_flex_workaround.patch b/package/libs/libpcap/patches/103-makefile_flex_workaround.patch
deleted file mode 100644
index 93e07c69c2..0000000000
--- a/package/libs/libpcap/patches/103-makefile_flex_workaround.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-
-	Copyright (C) 2006 Markus Wigge
-
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -59,7 +59,7 @@ MKDEP = @MKDEP@
- CCOPT = @V_CCOPT@
- SHLIB_CCOPT = @V_SHLIB_CCOPT@
- INCLS = -I. @V_INCLS@
--DEFS = -DBUILDING_PCAP -Dpcap_EXPORTS @DEFS@ @V_DEFS@
-+DEFS = -DBUILDING_PCAP -D_BSD_SOURCE -Dpcap_EXPORTS @DEFS@ @V_DEFS@
- ADDLOBJS = @ADDLOBJS@
- ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
- LIBS = @LIBS@
diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch
index 80e3824d82..bf9374dd54 100644
--- a/package/libs/libpcap/patches/201-space_optimization.patch
+++ b/package/libs/libpcap/patches/201-space_optimization.patch
@@ -1,6 +1,6 @@
 --- a/pcap-common.c
 +++ b/pcap-common.c
-@@ -1570,14 +1570,23 @@ swap_pseudo_headers(int linktype, struct
+@@ -1662,14 +1662,23 @@ swap_pseudo_headers(int linktype, struct
  		break;
  
  	case DLT_USB_LINUX:
diff --git a/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch b/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch
deleted file mode 100644
index 53dd50137b..0000000000
--- a/package/libs/libpcap/patches/203-undef_iw_mode_monitor.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/pcap-linux.c
-+++ b/pcap-linux.c
-@@ -263,6 +263,8 @@
- typedef int		socklen_t;
- #endif
- 
-+#undef IW_MODE_MONITOR
-+
- #ifndef MSG_TRUNC
- /*
-  * This is being compiled on a system that lacks MSG_TRUNC; define it
diff --git a/package/libs/libpcap/patches/204-usb-bus-path.patch b/package/libs/libpcap/patches/204-usb-bus-path.patch
deleted file mode 100644
index 0c967a00ba..0000000000
--- a/package/libs/libpcap/patches/204-usb-bus-path.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Fix USB bus path; /proc/bus/usb is deprecated.
-
---- a/pcap-usb-linux.c
-+++ b/pcap-usb-linux.c
-@@ -73,7 +73,7 @@
- #define USB_TEXT_DIR_OLD "/sys/kernel/debug/usbmon"
- #define USB_TEXT_DIR "/sys/kernel/debug/usb/usbmon"
- #define SYS_USB_BUS_DIR "/sys/bus/usb/devices"
--#define PROC_USB_BUS_DIR "/proc/bus/usb"
-+#define PROC_USB_BUS_DIR "/dev/bus/usb"
- #define USB_LINE_LEN 4096
- 
- #if __BYTE_ORDER == __LITTLE_ENDIAN
-- 
2.29.2




More information about the openwrt-devel mailing list