Skip to contentSkip to conversation

wireshark: Update to a supported version 4.0.x

PATCH New Armin Kuster 1 participant 1 message Jun 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wireshark: Update to a supported version 4.0.x

Drop CVE patch as its included.
Drop 0003-bison-Remove-line-directives.patch as file is not longer there. refactor 0001-wireshark-src-improve-reproducibility.patch LIC_FILES_CHKSUM changed do to re-structuring.
Remove TMPDIR found in some files.
Remove c-ares PACKAGECONFIG as its a required pkg

---
 ...-a-try_run-test-when-cross-compiling.patch |  66 ++++++++
 ...ireshark-src-improve-reproducibility.patch |  26 +---
 .../0003-bison-Remove-line-directives.patch   |  59 -------
 .../wireshark/files/CVE-2022-3190.patch       | 145 ------------------
 ...wireshark_3.4.12.bb => wireshark_4.0.6.bb} |  37 +++--
 5 files changed, 94 insertions(+), 239 deletions(-)
 create mode 100644 meta-networking/recipes-support/wireshark/files/0001-CMake-Fix-a-try_run-test-when-cross-compiling.patch
 delete mode 100644 meta-networking/recipes-support/wireshark/files/0003-bison-Remove-line-directives.patch
 delete mode 100644 meta-networking/recipes-support/wireshark/files/CVE-2022-3190.patch
 rename meta-networking/recipes-support/wireshark/{wireshark_3.4.12.bb => wireshark_4.0.6.bb} (67%)
meta-networking/recipes-support/wireshark/files/0001-CMake-Fix-a-try_run-test-when-cross-compiling.patch new file +66 -0
new file mode 100644
index 0000000000..0d51ce1b8f
@@ -0,0 +1,66 @@
+From b4f29807225cf3744c2f4f971902fbdd7486fc19 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= <[email protected]>
+Date: Fri, 26 May 2023 13:29:23 +0100
+Subject: [PATCH] CMake: Fix a try_run() test when cross-compiling
+
+Upstream-Status: Backport
+Signed-off-by: Armin Kuster <[email protected]>
+
+---
+ ConfigureChecks.cmake | 36 ++++++++++++++++++++----------------
+ 1 file changed, 20 insertions(+), 16 deletions(-)
+
+diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
+index dd8268e077..d8bca54115 100644
+--- a/ConfigureChecks.cmake
++++ b/ConfigureChecks.cmake
+@@ -122,26 +122,30 @@ check_type_size("ssize_t"       SSIZE_T)
+ # Check if the libc vsnprintf() conforms to C99. If this fails we may
+ # need to fall-back on GLib I/O.
+ #
+-check_c_source_runs("
+-	#include <stdio.h>
+-	int main(void)
+-	{
+-		/* Check that snprintf() and vsnprintf() don't return
+-		 * -1 if the buffer is too small. C99 says this value
+-		 * is the length that would be written not including
+-		 * the nul byte. */
+-		char buf[3];
+-		return snprintf(buf, sizeof(buf), \"%s\", \"ABCDEF\") > 0 ? 0 : 1;
+-	}"
+-	HAVE_C99_VSNPRINTF
+-)
+-if (NOT HAVE_C99_VSNPRINTF)
+-	message(FATAL_ERROR
++# If cross-compiling we can't check so just assume this requirement is met.
++#
++if(NOT CMAKE_CROSSCOMPILING)
++	check_c_source_runs("
++		#include <stdio.h>
++		int main(void)
++		{
++			/* Check that snprintf() and vsnprintf() don't return
++			* -1 if the buffer is too small. C99 says this value
++			* is the length that would be written not including
++			* the nul byte. */
++			char buf[3];
++			return snprintf(buf, sizeof(buf), \"%s\", \"ABCDEF\") > 0 ? 0 : 1;
++		}"
++		HAVE_C99_VSNPRINTF
++	)
++	if (NOT HAVE_C99_VSNPRINTF)
++		message(FATAL_ERROR
+ "Building Wireshark requires a C99 compliant vsnprintf() and this \
+ target does not meet that requirement. Compiling for ${CMAKE_SYSTEM} \
+ using ${CMAKE_C_COMPILER_ID}. Please report this issue to the Wireshark \
+ developers at [email protected]."
+-	)
++		)
++	endif()
+ endif()
+ 
+ #
+-- 
+2.25.1
+
meta-networking/recipes-support/wireshark/files/0001-wireshark-src-improve-reproducibility.patch +5 -21
index 0b83ca4ae4..6ad8a62c28 100644
@@ -13,24 +13,11 @@ Signed-off-by: Oleksiy Obitotskyy <[email protected]>
  tools/ncp2222.py         | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/tools/make-plugin-reg.py b/tools/make-plugin-reg.py
-index 66b4656..c52b3fc 100755
---- a/tools/make-plugin-reg.py
-+++ b/tools/make-plugin-reg.py
-@@ -28,7 +28,7 @@ preamble = """\
-  *
-  * Generated automatically from %s.
-  */
--""" % (sys.argv[0])
-+""" % (os.path.basename(sys.argv[0]))
- 
- # Create the proper list of filenames
- filenames = []
-diff --git a/tools/ncp2222.py b/tools/ncp2222.py
-index 1dea4ec..dc376e3 100755
---- a/tools/ncp2222.py
-+++ b/tools/ncp2222.py
-@@ -5858,7 +5858,7 @@ def produce_code():
+Index: wireshark-4.0.6/tools/ncp2222.py
+===================================================================
+--- wireshark-4.0.6.orig/tools/ncp2222.py
++++ wireshark-4.0.6/tools/ncp2222.py
+@@ -5891,7 +5891,7 @@ def produce_code():
  
      print("/*")
      print(" * Do not modify this file. Changes will be overwritten.")
@@ -39,6 +26,3 @@ index 1dea4ec..dc376e3 100755
      print(" */\n")
  
      print("""
--- 
-2.26.2.Cisco
-
meta-networking/recipes-support/wireshark/files/0003-bison-Remove-line-directives.patch deleted +0 -59

59 lines not on this page · raw message

meta-networking/recipes-support/wireshark/files/CVE-2022-3190.patch deleted +0 -145

145 lines not on this page · raw message

meta-networking/recipes-support/wireshark/wireshark_4.0.6.bb renamed from meta-networking/recipes-support/wireshark/wireshark_3.4.12.bb +23 -14
similarity index 67%
rename from meta-networking/recipes-support/wireshark/wireshark_3.4.12.bb
rename to meta-networking/recipes-support/wireshark/wireshark_4.0.6.bb
index 693a167938..f822dce672 100644
@@ -2,25 +2,22 @@ DESCRIPTION = "wireshark - a popular network protocol analyzer"
 HOMEPAGE = "http://www.wireshark.org"
 SECTION = "net"
 LICENSE = "GPL-2.0-only"
-LIC_FILES_CHKSUM = "file://COPYING;md5=6e271234ba1a13c6e512e76b94ac2f77"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-DEPENDS = "pcre expat glib-2.0 glib-2.0-native libgcrypt libgpg-error libxml2 bison-native c-ares"
+DEPENDS = "pcre2 expat glib-2.0 glib-2.0-native libgcrypt libgpg-error libxml2 bison-native c-ares"
 
 DEPENDS:append:class-target = " wireshark-native chrpath-replacement-native "
 
-SRC_URI = "https://1.eu.dl.wireshark.org/src/all-versions/wireshark-${PV}.tar.xz"
-
-SRC_URI += " \
-    file://0001-wireshark-src-improve-reproducibility.patch \
-    file://0002-flex-Remove-line-directives.patch \
-    file://0003-bison-Remove-line-directives.patch \
-    file://0004-lemon-Remove-line-directives.patch \
-    file://CVE-2022-3190.patch \
-"
+SRC_URI = "https://1.eu.dl.wireshark.org/src/wireshark-${PV}.tar.xz \
+           file://0001-CMake-Fix-a-try_run-test-when-cross-compiling.patch \
+           file://0001-wireshark-src-improve-reproducibility.patch \
+           file://0002-flex-Remove-line-directives.patch \
+           file://0004-lemon-Remove-line-directives.patch \
+           "
 
 UPSTREAM_CHECK_URI = "https://1.as.dl.wireshark.org/src"
 
-SRC_URI[sha256sum] = "881a13303e263b7dc7fe337534c8a541d4914552287879bed30bbe76c5bf68ca"
+SRC_URI[sha256sum] = "0079097a1b17ebc7250a73563f984c13327dac5016b7d53165810fbcca4bd884"
 
 PE = "1"
 
@@ -43,13 +40,12 @@ PACKAGECONFIG[zlib] = "-DENABLE_ZLIB=ON,-DENABLE_ZLIB=OFF, zlib"
 PACKAGECONFIG[geoip] = ",, geoip"
 PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
 PACKAGECONFIG[sbc] = "-DENABLE_SBC=ON,-DENABLE_SBC=OFF, sbc"
-PACKAGECONFIG[libssh] = ",,libssh2"
+PACKAGECONFIG[libssh] = "-DENABLE_LIBSSH=ON,-DENABLE_LIBSSH=OFF, libssh2"
 PACKAGECONFIG[lz4] = "-DENABLE_LZ4=ON,-DENABLE_LZ4=OFF, lz4"
 PACKAGECONFIG[zstd] = "-DENABLE_STTD=ON,-DENABLE_ZSTD=OFF, zstd"
 PACKAGECONFIG[nghttp2] = "-DENABLE_NGHTTP2=ON,-DENABLE_NGHTTP2=OFF, nghttp2"
 
 # these next two options require addional layers
-PACKAGECONFIG[c-ares] = "-DENABLE_CARES=ON,-DENABLE_CARES=OFF, c-ares"
 PACKAGECONFIG[qt5] = "-DENABLE_QT5=ON -DBUILD_wireshark=ON, -DENABLE_QT5=OFF -DBUILD_wireshark=OFF, qttools-native qtmultimedia qtsvg"
 
 inherit ${@bb.utils.contains('PACKAGECONFIG', 'qt5', 'cmake_qt5', '', d)}
@@ -64,6 +60,16 @@ EXTRA_OECMAKE += "-DENABLE_NETLINK=ON \
                  "
 CFLAGS:append = " -lm"
 
+do_compile:append:class-target() {
+    # Fix TMPDIR, these are in the comments section
+    sed -i -e "s:** source file.*::g"  ${B}/wiretap/ascend_parser.c
+    sed -i -e "s:** source file.*::g"  ${B}/wiretap/candump_parser.c
+    sed -i -e "s:** source file.*::g"  ${B}/wiretap/busmaster_parser.c
+    sed -i -e "s:** source file.*::g"  ${B}/epan/protobuf_lang_parser.c
+    sed -i -e "s:** source file.*::g"  ${B}/epan/dtd_grammar.c
+    sed -i -e "s:** source file.*::g"  ${B}/epan/dfilter/grammar.c
+}
+
 do_install:append:class-native() {
 	install -d ${D}${bindir}
 	for f in lemon
@@ -77,6 +83,9 @@ do_install:append:class-target() {
 	do
 		chrpath --delete $f
 	done
+
+    # We don't need the cmake files installed
+    rm -fr ${D}${usrlib}/${BPN}/cmake
 }
 
 PACKAGE_BEFORE_PN += "tshark"
Signature · 1 line
2.25.1